Added:
trunk/Samples/Profiling/
trunk/Samples/Profiling/cs/
trunk/Samples/Profiling/cs/Form1.Designer.cs
trunk/Samples/Profiling/cs/Form1.cs
trunk/Samples/Profiling/cs/Form1.resx
trunk/Samples/Profiling/cs/Profiling.csproj
trunk/Samples/Profiling/cs/Program.cs
trunk/Samples/Profiling/cs/Properties/
trunk/Samples/Profiling/cs/Properties/AssemblyInfo.cs
trunk/Samples/Profiling/cs/Properties/Resources.Designer.cs
trunk/Samples/Profiling/cs/Properties/Resources.resx
trunk/Samples/Profiling/cs/Properties/Settings.Designer.cs
trunk/Samples/Profiling/cs/Properties/Settings.settings
Modified:
trunk/mysqlclient/CompressedStream.cs
trunk/mysqlclient/Driver.cs
trunk/mysqlclient/common/SocketStream.cs
trunk/mysqlclient/common/StreamCreator.cs
trunk/mysqlclient/zlib/ZInputStream.cs
Log:
Fixed bug with compression
plus some whitespace cleanups
and added the Profiling sample
Added: trunk/Samples/Profiling/cs/Form1.Designer.cs
===================================================================
--- trunk/Samples/Profiling/cs/Form1.Designer.cs 2006-09-18 16:39:35 UTC (rev 346)
+++ trunk/Samples/Profiling/cs/Form1.Designer.cs 2006-09-18 22:19:32 UTC (rev 347)
@@ -0,0 +1,278 @@
+namespace Profiling
+{
+ partial class Form1
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.server = new System.Windows.Forms.TextBox();
+ this.userid = new System.Windows.Forms.TextBox();
+ this.label3 = new System.Windows.Forms.Label();
+ this.password = new System.Windows.Forms.TextBox();
+ this.label4 = new System.Windows.Forms.Label();
+ this.database = new System.Windows.Forms.TextBox();
+ this.sockets = new System.Windows.Forms.CheckBox();
+ this.portNum = new System.Windows.Forms.TextBox();
+ this.label5 = new System.Windows.Forms.Label();
+ this.pipeName = new System.Windows.Forms.TextBox();
+ this.label6 = new System.Windows.Forms.Label();
+ this.useNamedPipes = new System.Windows.Forms.CheckBox();
+ this.memName = new System.Windows.Forms.TextBox();
+ this.label7 = new System.Windows.Forms.Label();
+ this.useSharedMem = new System.Windows.Forms.CheckBox();
+ this.output = new System.Windows.Forms.TextBox();
+ this.testBtn = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(12, 15);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(41, 13);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "Server:";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(12, 40);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(44, 13);
+ this.label2.TabIndex = 1;
+ this.label2.Text = "User Id:";
+ //
+ // server
+ //
+ this.server.Location = new System.Drawing.Point(59, 8);
+ this.server.Name = "server";
+ this.server.Size = new System.Drawing.Size(149, 20);
+ this.server.TabIndex = 2;
+ //
+ // userid
+ //
+ this.userid.Location = new System.Drawing.Point(59, 34);
+ this.userid.Name = "userid";
+ this.userid.Size = new System.Drawing.Size(149, 20);
+ this.userid.TabIndex = 3;
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(214, 37);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(56, 13);
+ this.label3.TabIndex = 4;
+ this.label3.Text = "Password:";
+ //
+ // password
+ //
+ this.password.Location = new System.Drawing.Point(276, 37);
+ this.password.Name = "password";
+ this.password.Size = new System.Drawing.Size(149, 20);
+ this.password.TabIndex = 5;
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Location = new System.Drawing.Point(214, 15);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(56, 13);
+ this.label4.TabIndex = 6;
+ this.label4.Text = "Database:";
+ //
+ // database
+ //
+ this.database.Location = new System.Drawing.Point(276, 8);
+ this.database.Name = "database";
+ this.database.Size = new System.Drawing.Size(149, 20);
+ this.database.TabIndex = 7;
+ this.database.Text = "test";
+ //
+ // sockets
+ //
+ this.sockets.AutoSize = true;
+ this.sockets.Checked = true;
+ this.sockets.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.sockets.Location = new System.Drawing.Point(15, 65);
+ this.sockets.Name = "sockets";
+ this.sockets.Size = new System.Drawing.Size(84, 17);
+ this.sockets.TabIndex = 8;
+ this.sockets.Text = "Use TCP/IP";
+ this.sockets.UseVisualStyleBackColor = true;
+ //
+ // portNum
+ //
+ this.portNum.Location = new System.Drawing.Point(220, 62);
+ this.portNum.Name = "portNum";
+ this.portNum.Size = new System.Drawing.Size(53, 20);
+ this.portNum.TabIndex = 10;
+ this.portNum.Text = "3306";
+ //
+ // label5
+ //
+ this.label5.AutoSize = true;
+ this.label5.Location = new System.Drawing.Point(139, 65);
+ this.label5.Name = "label5";
+ this.label5.Size = new System.Drawing.Size(29, 13);
+ this.label5.TabIndex = 9;
+ this.label5.Text = "Port:";
+ //
+ // pipeName
+ //
+ this.pipeName.Location = new System.Drawing.Point(220, 86);
+ this.pipeName.Name = "pipeName";
+ this.pipeName.Size = new System.Drawing.Size(53, 20);
+ this.pipeName.TabIndex = 13;
+ this.pipeName.Text = "MYSQL";
+ //
+ // label6
+ //
+ this.label6.AutoSize = true;
+ this.label6.Location = new System.Drawing.Point(139, 89);
+ this.label6.Name = "label6";
+ this.label6.Size = new System.Drawing.Size(62, 13);
+ this.label6.TabIndex = 12;
+ this.label6.Text = "Pipe Name:";
+ //
+ // useNamedPipes
+ //
+ this.useNamedPipes.AutoSize = true;
+ this.useNamedPipes.Checked = true;
+ this.useNamedPipes.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.useNamedPipes.Location = new System.Drawing.Point(15, 88);
+ this.useNamedPipes.Name = "useNamedPipes";
+ this.useNamedPipes.Size = new System.Drawing.Size(111, 17);
+ this.useNamedPipes.TabIndex = 11;
+ this.useNamedPipes.Text = "Use Named Pipes";
+ this.useNamedPipes.UseVisualStyleBackColor = true;
+ //
+ // memName
+ //
+ this.memName.Location = new System.Drawing.Point(220, 109);
+ this.memName.Name = "memName";
+ this.memName.Size = new System.Drawing.Size(53, 20);
+ this.memName.TabIndex = 16;
+ this.memName.Text = "MYSQL";
+ //
+ // label7
+ //
+ this.label7.AutoSize = true;
+ this.label7.Location = new System.Drawing.Point(139, 112);
+ this.label7.Name = "label7";
+ this.label7.Size = new System.Drawing.Size(78, 13);
+ this.label7.TabIndex = 15;
+ this.label7.Text = "Memory Name:";
+ //
+ // useSharedMem
+ //
+ this.useSharedMem.AutoSize = true;
+ this.useSharedMem.Checked = true;
+ this.useSharedMem.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.useSharedMem.Location = new System.Drawing.Point(15, 111);
+ this.useSharedMem.Name = "useSharedMem";
+ this.useSharedMem.Size = new System.Drawing.Size(122, 17);
+ this.useSharedMem.TabIndex = 14;
+ this.useSharedMem.Text = "Use Shared Memory";
+ this.useSharedMem.UseVisualStyleBackColor = true;
+ //
+ // output
+ //
+ this.output.Location = new System.Drawing.Point(12, 160);
+ this.output.Multiline = true;
+ this.output.Name = "output";
+ this.output.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
+ this.output.Size = new System.Drawing.Size(413, 332);
+ this.output.TabIndex = 17;
+ //
+ // testBtn
+ //
+ this.testBtn.Location = new System.Drawing.Point(350, 102);
+ this.testBtn.Name = "testBtn";
+ this.testBtn.Size = new System.Drawing.Size(75, 23);
+ this.testBtn.TabIndex = 18;
+ this.testBtn.Text = "Test";
+ this.testBtn.UseVisualStyleBackColor = true;
+ this.testBtn.Click += new System.EventHandler(this.testBtn_Click);
+ //
+ // Form1
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(436, 504);
+ this.Controls.Add(this.testBtn);
+ this.Controls.Add(this.output);
+ this.Controls.Add(this.memName);
+ this.Controls.Add(this.label7);
+ this.Controls.Add(this.useSharedMem);
+ this.Controls.Add(this.pipeName);
+ this.Controls.Add(this.label6);
+ this.Controls.Add(this.useNamedPipes);
+ this.Controls.Add(this.portNum);
+ this.Controls.Add(this.label5);
+ this.Controls.Add(this.sockets);
+ this.Controls.Add(this.database);
+ this.Controls.Add(this.label4);
+ this.Controls.Add(this.password);
+ this.Controls.Add(this.label3);
+ this.Controls.Add(this.userid);
+ this.Controls.Add(this.server);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.label1);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
+ this.Name = "Form1";
+ this.Text = "Form1";
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.TextBox server;
+ private System.Windows.Forms.TextBox userid;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.TextBox password;
+ private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.TextBox database;
+ private System.Windows.Forms.CheckBox sockets;
+ private System.Windows.Forms.TextBox portNum;
+ private System.Windows.Forms.Label label5;
+ private System.Windows.Forms.TextBox pipeName;
+ private System.Windows.Forms.Label label6;
+ private System.Windows.Forms.CheckBox useNamedPipes;
+ private System.Windows.Forms.TextBox memName;
+ private System.Windows.Forms.Label label7;
+ private System.Windows.Forms.CheckBox useSharedMem;
+ private System.Windows.Forms.TextBox output;
+ private System.Windows.Forms.Button testBtn;
+ }
+}
+
Added: trunk/Samples/Profiling/cs/Form1.cs
===================================================================
--- trunk/Samples/Profiling/cs/Form1.cs 2006-09-18 16:39:35 UTC (rev 346)
+++ trunk/Samples/Profiling/cs/Form1.cs 2006-09-18 22:19:32 UTC (rev 347)
@@ -0,0 +1,159 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using System.Data.Common;
+using MySql.Data.MySqlClient;
+using System.Diagnostics;
+
+namespace Profiling
+{
+ public partial class Form1 : Form
+ {
+ MySqlConnection connection;
+
+ public Form1()
+ {
+ InitializeComponent();
+ }
+
+ private void Log(string s)
+ {
+ output.Text += "\r\n" + s;
+ output.Refresh();
+ }
+
+ private void testBtn_Click(object sender, EventArgs e)
+ {
+ output.Clear();
+ DateTime start = DateTime.Now;
+ Log("Starting tests at " + start.ToString());
+
+ try
+ {
+ if (sockets.Checked)
+ {
+ Log("\r\nTesting sockets");
+ TestSockets();
+ }
+ if (useNamedPipes.Checked)
+ {
+ Log("\r\nTesting named pipes");
+ TestNamedPipes();
+ }
+ if (useSharedMem.Checked)
+ {
+ Log("\r\nTesting shared memory");
+ TestSharedMemory();
+ }
+ Log("Done!");
+ }
+ catch (Exception ex)
+ {
+ Log(ex.Message);
+ }
+ TimeSpan ts = DateTime.Now.Subtract(start);
+ Log(ts.ToString());
+ }
+
+ private void TestSockets()
+ {
+ Test(String.Format(
+ "server={0};uid={1};password={2};database={3};port={4}",
+ server.Text, userid.Text, password.Text, database.Text, portNum.Text));
+ }
+
+ private void TestNamedPipes()
+ {
+ Test(String.Format(
+ "server={0};uid={1};password={2};database={3};protocol=pipe;pipe={4}",
+ server.Text, userid.Text, password.Text, database.Text, pipeName.Text));
+ }
+
+ private void TestSharedMemory()
+ {
+ Test(String.Format(
+ "server={0};uid={1};password={2};database={3};protocol=memory;shared memory name={4}",
+ server.Text, userid.Text, password.Text, database.Text, memName.Text));
+ }
+
+ private void Test(string connectionString)
+ {
+ string[] desc = new string[4] { "no compression, no pooling",
+ "no compression, pooling", "compression, no pooling", "compression, pooling" };
+
+ string[] addons = new string[4] { ";compress=false;pooling=false",
+ ";compress=false;pooling=true", ";compress=true;pooling=false",
+ ";compress=true;pooling=true"};
+
+ for (int x=0; x < addons.Length; x++)
+ {
+ if (connection != null)
+ connection.Close();
+
+ Log("\r\nTest " + desc[x]);
+ connection = new MySqlConnection(connectionString + addons[x]);
+ connection.Open();
+
+ Log("\r\nnot using prepared tests");
+ DoInsertTests(false);
+ DoSelectTests(false);
+
+ Log("\r\nusing prepared tests");
+ DoInsertTests(true);
+ DoSelectTests(true);
+ }
+ }
+
+ private void DoInsertTests(bool prepared)
+ {
+ Log("Starting Insert tests");
+ MySqlCommand cmd = new MySqlCommand("DROP TABLE IF EXISTS test", connection);
+ cmd.ExecuteNonQuery();
+
+ cmd.CommandText = "CREATE TABLE test (id INT, name VARCHAR(50), fl FLOAT, dt DATETIME)";
+ cmd.ExecuteNonQuery();
+
+ cmd.CommandText = "INSERT INTO test VALUES (?id, ?name, ?f1, ?dt)";
+ cmd.Parameters.Add("?id", MySqlDbType.Int32);
+ cmd.Parameters.Add("?name", MySqlDbType.VarChar);
+ cmd.Parameters.Add("?f1", MySqlDbType.Float);
+ cmd.Parameters.Add("?dt", MySqlDbType.Datetime);
+ if (prepared)
+ cmd.Prepare();
+
+ for (int x=0; x < 500; x++)
+ {
+ cmd.Parameters[0].Value = x;
+ cmd.Parameters[1].Value = "Test";
+ cmd.Parameters[2].Value = 0.0;
+ cmd.Parameters[3].Value = DateTime.Now;
+ cmd.ExecuteNonQuery();
+ }
+ }
+
+ private void DoSelectTests(bool prepared)
+ {
+ Log("Starting select tests");
+ MySqlCommand cmd = new MySqlCommand("SELECT * FROM test", connection);
+ cmd.CommandTimeout = 0;
+ using (MySqlDataReader reader = cmd.ExecuteReader())
+ {
+ int count = 0;
+ while (reader.Read())
+ {
+ int id = reader.GetInt32(0);
+ Trace.WriteLine("id = " + id);
+ string name = reader.GetString(1);
+ float fl = reader.GetFloat(2);
+ DateTime dt = reader.GetDateTime(3);
+ count++;
+ }
+ Log("read " + count + " records");
+ }
+ }
+ }
+}
\ No newline at end of file
Added: trunk/Samples/Profiling/cs/Form1.resx
===================================================================
--- trunk/Samples/Profiling/cs/Form1.resx 2006-09-18 16:39:35 UTC (rev 346)
+++ trunk/Samples/Profiling/cs/Form1.resx 2006-09-18 22:19:32 UTC (rev 347)
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
\ No newline at end of file
Added: trunk/Samples/Profiling/cs/Profiling.csproj
===================================================================
--- trunk/Samples/Profiling/cs/Profiling.csproj 2006-09-18 16:39:35 UTC (rev 346)
+++ trunk/Samples/Profiling/cs/Profiling.csproj 2006-09-18 22:19:32 UTC (rev 347)
@@ -0,0 +1,83 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{79AEF3F3-2D3F-4CF4-91C8-BE94F77B6150}</ProjectGuid>
+ <OutputType>WinExe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Profiling</RootNamespace>
+ <AssemblyName>Profiling</AssemblyName>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="MySql.Data, Version=5.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\..\mysqlclient\bin\net-2.0\Debug\MySql.Data.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Deployment" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Form1.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="Form1.Designer.cs">
+ <DependentUpon>Form1.cs</DependentUpon>
+ </Compile>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <EmbeddedResource Include="Form1.resx">
+ <SubType>Designer</SubType>
+ <DependentUpon>Form1.cs</DependentUpon>
+ </EmbeddedResource>
+ <EmbeddedResource Include="Properties\Resources.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ <Compile Include="Properties\Resources.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Resources.resx</DependentUpon>
+ </Compile>
+ <None Include="Default.sql" />
+ <None Include="Properties\Settings.settings">
+ <Generator>SettingsSingleFileGenerator</Generator>
+ <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+ </None>
+ <Compile Include="Properties\Settings.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Settings.settings</DependentUpon>
+ <DesignTimeSharedInput>True</DesignTimeSharedInput>
+ </Compile>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
Added: trunk/Samples/Profiling/cs/Program.cs
===================================================================
--- trunk/Samples/Profiling/cs/Program.cs 2006-09-18 16:39:35 UTC (rev 346)
+++ trunk/Samples/Profiling/cs/Program.cs 2006-09-18 22:19:32 UTC (rev 347)
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+
+namespace Profiling
+{
+ static class Program
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new Form1());
+ }
+ }
+}
\ No newline at end of file
Added: trunk/Samples/Profiling/cs/Properties/AssemblyInfo.cs
===================================================================
--- trunk/Samples/Profiling/cs/Properties/AssemblyInfo.cs 2006-09-18 16:39:35 UTC (rev 346)
+++ trunk/Samples/Profiling/cs/Properties/AssemblyInfo.cs 2006-09-18 22:19:32 UTC (rev 347)
@@ -0,0 +1,33 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Profiling")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Profiling")]
+[assembly: AssemblyCopyright("Copyright © 2006")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("2c383097-c402-454b-bb02-57d84d96a540")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Added: trunk/Samples/Profiling/cs/Properties/Resources.Designer.cs
===================================================================
--- trunk/Samples/Profiling/cs/Properties/Resources.Designer.cs 2006-09-18 16:39:35 UTC (rev 346)
+++ trunk/Samples/Profiling/cs/Properties/Resources.Designer.cs 2006-09-18 22:19:32 UTC (rev 347)
@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.112
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Profiling.Properties
+{
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources
+ {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources()
+ {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager
+ {
+ get
+ {
+ if ((resourceMan == null))
+ {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Profiling.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture
+ {
+ get
+ {
+ return resourceCulture;
+ }
+ set
+ {
+ resourceCulture = value;
+ }
+ }
+ }
+}
Added: trunk/Samples/Profiling/cs/Properties/Resources.resx
===================================================================
--- trunk/Samples/Profiling/cs/Properties/Resources.resx 2006-09-18 16:39:35 UTC (rev 346)
+++ trunk/Samples/Profiling/cs/Properties/Resources.resx 2006-09-18 22:19:32 UTC (rev 347)
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
\ No newline at end of file
Added: trunk/Samples/Profiling/cs/Properties/Settings.Designer.cs
===================================================================
--- trunk/Samples/Profiling/cs/Properties/Settings.Designer.cs 2006-09-18 16:39:35 UTC (rev 346)
+++ trunk/Samples/Profiling/cs/Properties/Settings.Designer.cs 2006-09-18 22:19:32 UTC (rev 347)
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.112
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Profiling.Properties
+{
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
Added: trunk/Samples/Profiling/cs/Properties/Settings.settings
===================================================================
--- trunk/Samples/Profiling/cs/Properties/Settings.settings 2006-09-18 16:39:35 UTC (rev 346)
+++ trunk/Samples/Profiling/cs/Properties/Settings.settings 2006-09-18 22:19:32 UTC (rev 347)
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
+ <Profiles>
+ <Profile Name="(Default)" />
+ </Profiles>
+ <Settings />
+</SettingsFile>
Modified: trunk/mysqlclient/CompressedStream.cs
===================================================================
--- trunk/mysqlclient/CompressedStream.cs 2006-09-18 16:39:35 UTC (rev 346)
+++ trunk/mysqlclient/CompressedStream.cs 2006-09-18 22:19:32 UTC (rev 347)
@@ -39,12 +39,10 @@
private byte[] localByte;
private int inPos;
private int maxInPos;
- private int maxBlockSize;
private ZInputStream zInStream;
public CompressedStream( Stream baseStream )
{
- maxBlockSize = Int32.MaxValue;
this.baseStream = baseStream;
localByte = new byte[1];
cache = new MemoryStream();
@@ -112,33 +110,18 @@
if ((offset + count) > buffer.Length)
throw new ArgumentException(Resources.BufferNotLargeEnough, "buffer");
- int totalRead = 0;
- while (count > 0)
+ if (inPos == maxInPos)
{
- if (inPos == maxInPos)
- {
- if (maxInPos != 0 && maxInPos < maxBlockSize)
- break;
- PrepareNextPacket();
- }
- int countToRead = Math.Min(count, maxInPos-inPos);
- int countRead = 0;
- if (zInStream != null)
- countRead = zInStream.read(buffer, offset, countToRead);
- else
- countRead =baseStream.Read(buffer, offset, countToRead);
- offset += countRead;
- count -= countRead;
- inPos += countRead;
- totalRead += countRead;
+ PrepareNextPacket();
}
-
- // if we have read everything from this packet, then reset maxInPos so
- // that the next time we come here we will load another packet
- if (inPos == maxInPos)
- inPos = maxInPos = 0;
-
- return totalRead;
+ int countToRead = Math.Min(count, maxInPos-inPos);
+ int countRead = 0;
+ if (zInStream != null)
+ countRead = zInStream.read(buffer, offset, countToRead);
+ else
+ countRead = baseStream.Read(buffer, offset, countToRead);
+ inPos += countRead;
+ return countRead;
}
private void PrepareNextPacket()
@@ -161,6 +144,7 @@
else
{
zInStream = new ZInputStream(baseStream);
+ zInStream.maxInput = compressedLength;
}
inPos = 0;
Modified: trunk/mysqlclient/Driver.cs
===================================================================
--- trunk/mysqlclient/Driver.cs 2006-09-18 16:39:35 UTC (rev 346)
+++ trunk/mysqlclient/Driver.cs 2006-09-18 22:19:32 UTC (rev 347)
@@ -216,9 +216,9 @@
}
if (charSet != null)
- Encoding = CharSetMap.GetEncoding( version, charSet );
+ Encoding = CharSetMap.GetEncoding(version, charSet);
else
- Encoding = CharSetMap.GetEncoding( version, "latin1" );
+ Encoding = CharSetMap.GetEncoding(version, "latin1");
}
/// <summary>
Modified: trunk/mysqlclient/common/SocketStream.cs
===================================================================
--- trunk/mysqlclient/common/SocketStream.cs 2006-09-18 16:39:35 UTC (rev 346)
+++ trunk/mysqlclient/common/SocketStream.cs 2006-09-18 22:19:32 UTC (rev 347)
@@ -116,7 +116,12 @@
int result = NativeMethods.connect(socket.Handle, buff, addr.Size);
int wsaerror = NativeMethods.WSAGetLastError();
if (wsaerror != 10035)
+ {
+ // this is probably an IPV6 address
+ if (wsaerror == 10047)
+ return false;
throw new SocketException(wsaerror);
+ }
// next we wait for our connect timeout or until the socket is connected
ArrayList write = new ArrayList();
Modified: trunk/mysqlclient/common/StreamCreator.cs
===================================================================
--- trunk/mysqlclient/common/StreamCreator.cs 2006-09-18 16:39:35 UTC (rev 346)
+++ trunk/mysqlclient/common/StreamCreator.cs 2006-09-18 22:19:32 UTC (rev 347)
@@ -136,7 +136,8 @@
ss = unix ?
new SocketStream(AddressFamily.Unix, SocketType.Stream, ProtocolType.IP) :
new SocketStream(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);
- ss.Connect(endPoint, (int)timeOut);
+ if (!ss.Connect(endPoint, (int)timeOut))
+ return null;
return ss;
}
catch (Exception)
Modified: trunk/mysqlclient/zlib/ZInputStream.cs
===================================================================
--- trunk/mysqlclient/zlib/ZInputStream.cs 2006-09-18 16:39:35 UTC (rev 346)
+++ trunk/mysqlclient/zlib/ZInputStream.cs 2006-09-18 22:19:32 UTC (rev 347)
@@ -47,6 +47,8 @@
public class ZInputStream:System.IO.BinaryReader
{
+ public long maxInput;
+
private void InitBlock()
{
flush = zlibConst.Z_NO_FLUSH;
@@ -141,7 +143,17 @@
{
// if buffer is empty and more input is avaiable, refill it
z.next_in_index = 0;
- z.avail_in = SupportClass.ReadInput(in_Renamed, buf, 0, bufsize); //(bufsize<z.avail_out ? bufsize : z.avail_out));
+
+ int inToRead = bufsize;
+ if (maxInput > 0)
+ {
+ if (TotalIn < maxInput)
+ inToRead = (int)(Math.Min(maxInput - TotalIn, (long)bufsize));
+ else
+ z.avail_in = -1;
+ }
+ if (z.avail_in != -1)
+ z.avail_in = SupportClass.ReadInput(in_Renamed, buf, 0, inToRead); //(bufsize<z.avail_out ? bufsize : z.avail_out));
if (z.avail_in == -1)
{
z.avail_in = 0;
| Thread |
|---|
| • Connector/NET commit: r347 - in trunk: Samples Samples/Profiling Samples/Profiling/cs Samples/Profiling/cs/Properties mysqlclient mysqlclient/common m... | rburnett | 19 Sep |