pgsqlclient-checkins Mailing List for PostgreSqlClient (Page 3)
Status: Inactive
Brought to you by:
carlosga_fb
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(120) |
Aug
(95) |
Sep
(95) |
Oct
(213) |
Nov
(114) |
Dec
(64) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(6) |
Feb
(134) |
Mar
(88) |
Apr
(28) |
May
(22) |
Jun
(15) |
Jul
(23) |
Aug
(2) |
Sep
(15) |
Oct
(2) |
Nov
(6) |
Dec
|
2005 |
Jan
(8) |
Feb
(6) |
Mar
|
Apr
(42) |
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
(84) |
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
(84) |
Apr
(46) |
May
(40) |
Jun
(8) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <car...@us...> - 2006-04-17 12:41:00
|
Revision: 127 Author: carlosga_fb Date: 2006-04-17 05:40:51 -0700 (Mon, 17 Apr 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=127&view=rev Log Message: ----------- Modified Paths: -------------- trunk/PostgreSqlClient/source/PostgreSql.Data.PostgreSqlClient.sln Modified: trunk/PostgreSqlClient/source/PostgreSql.Data.PostgreSqlClient.sln =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql.Data.PostgreSqlClient.sln 2006-04-17 12:40:26 UTC (rev 126) +++ trunk/PostgreSqlClient/source/PostgreSql.Data.PostgreSqlClient.sln 2006-04-17 12:40:51 UTC (rev 127) @@ -11,6 +11,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PostgreSql.VisualStudio.DataTools", "PostgreSql\VisualStudio\DataTools\PostgreSql.VisualStudio.DataTools.csproj", "{371E5E40-132D-4CBA-A93A-814B835A44D5}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApplication1", "C:\Documents and Settings\Carlos\Mis documentos\Visual Studio 2005\Projects\ConsoleApplication1\ConsoleApplication1.csproj", "{551AE979-8D9C-43AF-8021-4E5FB6865490}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -37,6 +39,10 @@ {371E5E40-132D-4CBA-A93A-814B835A44D5}.Debug|Any CPU.Build.0 = Debug|Any CPU {371E5E40-132D-4CBA-A93A-814B835A44D5}.Release|Any CPU.ActiveCfg = Release|Any CPU {371E5E40-132D-4CBA-A93A-814B835A44D5}.Release|Any CPU.Build.0 = Release|Any CPU + {551AE979-8D9C-43AF-8021-4E5FB6865490}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {551AE979-8D9C-43AF-8021-4E5FB6865490}.Debug|Any CPU.Build.0 = Debug|Any CPU + {551AE979-8D9C-43AF-8021-4E5FB6865490}.Release|Any CPU.ActiveCfg = Release|Any CPU + {551AE979-8D9C-43AF-8021-4E5FB6865490}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-04-17 12:40:39
|
Revision: 126 Author: carlosga_fb Date: 2006-04-17 05:40:26 -0700 (Mon, 17 Apr 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=126&view=rev Log Message: ----------- Modified Paths: -------------- trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgForeignKeys.cs Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgForeignKeys.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgForeignKeys.cs 2006-04-17 12:39:49 UTC (rev 125) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgForeignKeys.cs 2006-04-17 12:40:26 UTC (rev 126) @@ -66,7 +66,6 @@ if (restrictions != null && restrictions.Length > 0) { - /* CONSTRAINT_CATALOG */ if (restrictions.Length > 0 && restrictions[0] != null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-04-17 12:39:57
|
Revision: 125 Author: carlosga_fb Date: 2006-04-17 05:39:49 -0700 (Mon, 17 Apr 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=125&view=rev Log Message: ----------- Modified Paths: -------------- trunk/PostgreSqlClient/source/UnitTests/App.config Modified: trunk/PostgreSqlClient/source/UnitTests/App.config =================================================================== --- trunk/PostgreSqlClient/source/UnitTests/App.config 2006-04-17 12:38:55 UTC (rev 124) +++ trunk/PostgreSqlClient/source/UnitTests/App.config 2006-04-17 12:39:49 UTC (rev 125) @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> - <add key="User" value="" /> + <add key="User ID" value="postgres" /> <add key="Password" value="" /> <add key="Catalog" value="test" /> - <add key="DataSource" value="localhost" /> - <add key="PortNumber" value="5432" /> + <add key="Data Source" value="localhost" /> + <add key="Port Number" value="5432" /> <add key="Connection lifetime" value="1" /> <add key="Pooling" value="false" /> <add key="Packet Size" value="8192" /> - <add key="SSL" value="true" /> + <add key="Ssl" value="true" /> </appSettings> </configuration> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-04-17 12:39:15
|
Revision: 124 Author: carlosga_fb Date: 2006-04-17 05:38:55 -0700 (Mon, 17 Apr 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=124&view=rev Log Message: ----------- Modified Paths: -------------- trunk/PostgreSqlClient/source/UnitTests/PgBaseTest.cs Modified: trunk/PostgreSqlClient/source/UnitTests/PgBaseTest.cs =================================================================== --- trunk/PostgreSqlClient/source/UnitTests/PgBaseTest.cs 2006-04-14 14:17:26 UTC (rev 123) +++ trunk/PostgreSqlClient/source/UnitTests/PgBaseTest.cs 2006-04-17 12:38:55 UTC (rev 124) @@ -62,8 +62,8 @@ // Build the connection string PgConnectionStringBuilder csb = new PgConnectionStringBuilder(); - csb.DataSource = ConfigurationManager.AppSettings["Data Source"]; - csb.Catalog = ConfigurationManager.AppSettings["Catalog"]; + csb.DataSource = ConfigurationManager.AppSettings["Data Source"]; + csb.InitialCatalog = ConfigurationManager.AppSettings["Initial Catalog"]; csb.UserID = ConfigurationManager.AppSettings["User ID"]; csb.Password = ConfigurationManager.AppSettings["Password"]; csb.PortNumber = Convert.ToInt32(ConfigurationManager.AppSettings["Port Number"]); @@ -93,8 +93,8 @@ { PgConnectionStringBuilder csb = new PgConnectionStringBuilder(); - csb.DataSource = ConfigurationManager.AppSettings["Data Source"]; - csb.Catalog = ""; + csb.DataSource = ConfigurationManager.AppSettings["Data Source"]; + csb.InitialCatalog = ""; csb.UserID = ConfigurationManager.AppSettings["User ID"]; csb.Password = ConfigurationManager.AppSettings["Password"]; csb.PortNumber = Convert.ToInt32(ConfigurationManager.AppSettings["Port Number"]); @@ -117,8 +117,8 @@ { PgConnectionStringBuilder csb = new PgConnectionStringBuilder(); - csb.DataSource = ConfigurationManager.AppSettings["Data Source"]; - csb.Catalog = ""; + csb.DataSource = ConfigurationManager.AppSettings["Data Source"]; + csb.InitialCatalog = ""; csb.UserID = ConfigurationManager.AppSettings["User ID"]; csb.Password = ConfigurationManager.AppSettings["Password"]; csb.PortNumber = Convert.ToInt32(ConfigurationManager.AppSettings["Port Number"]); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-04-14 14:17:34
|
Revision: 123 Author: carlosga_fb Date: 2006-04-14 07:17:26 -0700 (Fri, 14 Apr 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=123&view=rev Log Message: ----------- Modified Paths: -------------- trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgDatabase.cs trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgOutputPacket.cs trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgResponsePacket.cs Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgDatabase.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgDatabase.cs 2006-04-14 14:16:59 UTC (rev 122) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgDatabase.cs 2006-04-14 14:17:26 UTC (rev 123) @@ -70,7 +70,7 @@ DataTypes.Add(629 , "_line" , PgDataType.Array , 628, PgTypeFormat.Binary, 32); DataTypes.Add(718 , "circle" , PgDataType.Circle , 0, PgTypeFormat.Binary, 24); DataTypes.Add(719 , "_circle" , PgDataType.Array , 718, PgTypeFormat.Binary, 24); - DataTypes.Add(700 , "float4" , PgDataType.Float , 0, PgTypeFormat.Binary, 4); + DataTypes.Add(700 , "float4" , PgDataType.Float , 0, PgTypeFormat.Text, 4); DataTypes.Add(701 , "float8" , PgDataType.Double , 0, PgTypeFormat.Binary, 8); DataTypes.Add(705 , "unknown" , PgDataType.Text , 0, PgTypeFormat.Binary, 0); DataTypes.Add(790 , "money" , PgDataType.Currency , 0, PgTypeFormat.Binary, 4); Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgOutputPacket.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgOutputPacket.cs 2006-04-14 14:16:59 UTC (rev 122) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgOutputPacket.cs 2006-04-14 14:17:26 UTC (rev 123) @@ -417,8 +417,11 @@ break; case PgDataType.Float: - packet.Write(size); - packet.Write(Convert.ToSingle(value)); + { + string paramValue = Convert.ToSingle(value).ToString(CultureInfo.InvariantCulture); + packet.Write(encoding.GetByteCount(paramValue)); + packet.Write(paramValue.ToCharArray()); + } break; case PgDataType.Currency: Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgResponsePacket.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgResponsePacket.cs 2006-04-14 14:16:59 UTC (rev 122) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgResponsePacket.cs 2006-04-14 14:17:26 UTC (rev 123) @@ -665,9 +665,13 @@ #endregion - internal byte[] ToArray() + #region \xB7 Internal Methods \xB7 + + internal byte[] ToArray() { return ((MemoryStream)this.stream).ToArray(); - } - } + } + + #endregion + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-04-14 14:17:14
|
Revision: 122 Author: carlosga_fb Date: 2006-04-14 07:16:59 -0700 (Fri, 14 Apr 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=122&view=rev Log Message: ----------- Modified Paths: -------------- trunk/PostgreSqlClient/changelog.txt Modified: trunk/PostgreSqlClient/changelog.txt =================================================================== --- trunk/PostgreSqlClient/changelog.txt 2006-04-14 13:41:48 UTC (rev 121) +++ trunk/PostgreSqlClient/changelog.txt 2006-04-14 14:16:59 UTC (rev 122) @@ -1,7 +1,14 @@ PostgreSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ ---------------- - ----------------------------------------- +2006-04-14 Carlos Guzman Alvarez (car...@te...) + * Ported the connection pooling implementation from the FirebirdClient provider. + + * Bug fix for the Decimal parameters handling ( found running nhibernate test suite ) + + * Bug fix on named parameters handling. + 2006-04-11 Carlos Guzman Alvarez (car...@te...) - Implemented Savepoint support. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-04-14 13:41:58
|
Revision: 121 Author: carlosga_fb Date: 2006-04-14 06:41:48 -0700 (Fri, 14 Apr 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=121&view=rev Log Message: ----------- Modified Paths: -------------- trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgConnectionOptions.cs Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgConnectionOptions.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgConnectionOptions.cs 2006-04-14 13:12:31 UTC (rev 120) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgConnectionOptions.cs 2006-04-14 13:41:48 UTC (rev 121) @@ -155,7 +155,7 @@ break; case "database": - case "catalog": + case "initial catalog": this.database = element.Groups[2].Value.Trim(); break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-04-14 13:12:38
|
Revision: 120 Author: carlosga_fb Date: 2006-04-14 06:12:31 -0700 (Fri, 14 Apr 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=120&view=rev Log Message: ----------- Modified Paths: -------------- trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj 2006-04-14 13:12:09 UTC (rev 119) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj 2006-04-14 13:12:31 UTC (rev 120) @@ -36,6 +36,7 @@ <ItemGroup> <Compile Include="Design\ParameterCollection\PgParameterCollectionEditor.cs" /> <Compile Include="Design\ParameterCollection\PgParameterConverter.cs" /> + <Compile Include="PostgreSqlClient\EmptyPoolEventHandler.cs" /> <Compile Include="PostgreSqlClient\PgCommand.cs"> <SubType>Component</SubType> </Compile> @@ -62,6 +63,7 @@ <Compile Include="PostgreSqlClient\PgNotificationEventHandler.cs" /> <Compile Include="PostgreSqlClient\PgParameter.cs" /> <Compile Include="PostgreSqlClient\PgParameterCollection.cs" /> + <Compile Include="PostgreSqlClient\PgPoolManager.cs" /> <Compile Include="PostgreSqlClient\PgRowUpdatedEventArgs.cs" /> <Compile Include="PostgreSqlClient\PgRowUpdatedEventHandler.cs" /> <Compile Include="PostgreSqlClient\PgRowUpdatingEventArgs.cs" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-04-14 13:12:16
|
Revision: 119 Author: carlosga_fb Date: 2006-04-14 06:12:09 -0700 (Fri, 14 Apr 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=119&view=rev Log Message: ----------- Modified Paths: -------------- trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgOutputPacket.cs Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgOutputPacket.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgOutputPacket.cs 2006-04-14 13:11:53 UTC (rev 118) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgOutputPacket.cs 2006-04-14 13:12:09 UTC (rev 119) @@ -405,7 +405,7 @@ case PgDataType.Decimal: { - string paramValue = value.ToString(); + string paramValue = Convert.ToDecimal(value).ToString(CultureInfo.InvariantCulture); packet.Write(encoding.GetByteCount(paramValue)); packet.Write(paramValue.ToCharArray()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-04-14 13:12:03
|
Revision: 118 Author: carlosga_fb Date: 2006-04-14 06:11:53 -0700 (Fri, 14 Apr 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=118&view=rev Log Message: ----------- Modified Paths: -------------- trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgDatabase.cs Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgDatabase.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgDatabase.cs 2006-04-14 13:11:20 UTC (rev 117) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgDatabase.cs 2006-04-14 13:11:53 UTC (rev 118) @@ -289,6 +289,9 @@ } } + // Clear parameter status + this.ParameterStatus.Clear(); + // Send Startup message PgOutputPacket packet = new PgOutputPacket(this.Encoding); @@ -624,10 +627,6 @@ switch (isolationLevel) { - case IsolationLevel.ReadCommitted: - sql += "READ COMMITTED"; - break; - case IsolationLevel.ReadUncommitted: throw new NotSupportedException("Read uncommitted transaction isolation is not supported"); @@ -637,6 +636,11 @@ case IsolationLevel.Serializable: sql += "SERIALIZABLE"; break; + + case IsolationLevel.ReadCommitted: + default: + sql += "READ COMMITTED"; + break; } PgStatement stmt = CreateStatement(sql); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-04-14 13:11:31
|
Revision: 117 Author: carlosga_fb Date: 2006-04-14 06:11:20 -0700 (Fri, 14 Apr 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=117&view=rev Log Message: ----------- Modified Paths: -------------- trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgCommand.cs Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgCommand.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgCommand.cs 2006-04-14 13:10:41 UTC (rev 116) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgCommand.cs 2006-04-14 13:11:20 UTC (rev 117) @@ -647,7 +647,7 @@ } else { - if (sym == '\'') + if (sym == '\'' || sym == '\"') { inCommas = !inCommas; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-04-14 13:10:59
|
Revision: 116 Author: carlosga_fb Date: 2006-04-14 06:10:41 -0700 (Fri, 14 Apr 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=116&view=rev Log Message: ----------- 2006-04-14 Carlos Guzman Alvarez (car...@te...) * Ported the connection pooling implementation from the FirebirdClient provider. * Bug fix for the Decimal parameters handling ( found running nhibernate test suite ) * Bug fix on named parameters handling. Modified Paths: -------------- trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgConnection.cs trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionInternal.cs trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionPool.cs Added Paths: ----------- trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/EmptyPoolEventHandler.cs trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgPoolManager.cs Added: trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/EmptyPoolEventHandler.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/EmptyPoolEventHandler.cs (rev 0) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/EmptyPoolEventHandler.cs 2006-04-14 13:10:41 UTC (rev 116) @@ -0,0 +1,23 @@ +/* + * PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ + * + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. + * + * Software distributed under the License is distributed on + * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez + * All Rights Reserved. + */ + +using System; + +namespace PostgreSql.Data.PostgreSqlClient +{ + internal delegate void EmptyPoolEventHandler(object sender, EventArgs e); +} Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgConnection.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgConnection.cs 2006-04-13 22:33:18 UTC (rev 115) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgConnection.cs 2006-04-14 13:10:41 UTC (rev 116) @@ -340,21 +340,21 @@ // Open connection if (this.options.Pooling) { - this.connectionInternal = PgConnectionPool.GetConnection(this); + this.connectionInternal = PgPoolManager.Instance.GetPool(this.connectionString).CheckOut(); } else { - this.connectionInternal = new PgConnectionInternal(this); - - this.SslSetup(); - - this.connectionInternal.OwningConnection = this; + this.connectionInternal = new PgConnectionInternal(this.connectionString); this.connectionInternal.Pooled = false; - this.connectionInternal.Connect(); } + + this.SslSetup(); + this.connectionInternal.OwningConnection = this; + this.connectionInternal.Connect(); // Set connection state to Open this.state = ConnectionState.Open; + if (this.StateChange != null) { this.StateChange(this, new StateChangeEventArgs(ConnectionState.Closed, state)); @@ -402,7 +402,7 @@ // Close connection permanently or send it back to the pool if (this.connectionInternal.Pooled) { - PgConnectionPool.FreeConnection(this.connectionInternal); + PgPoolManager.Instance.GetPool(this.connectionString).CheckIn(this.connectionInternal); } else { Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionInternal.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionInternal.cs 2006-04-13 22:33:18 UTC (rev 115) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionInternal.cs 2006-04-14 13:10:41 UTC (rev 116) @@ -32,7 +32,8 @@ private PgConnectionOptions options; private PgTransaction activeTransaction; private ArrayList preparedCommands; - private long created; + private long created; + private long lifetime; private bool pooled; #endregion @@ -93,17 +94,23 @@ set { this.owningConnection = value; } } + public long Lifetime + { + get { return this.lifetime; } + set { this.lifetime = value; } + } + #endregion #region \xB7 Constructors \xB7 - public PgConnectionInternal(PgConnection owningConnection) + public PgConnectionInternal(string connectionString) { - this.owningConnection = owningConnection; - this.options = new PgConnectionOptions(owningConnection.ConnectionString); - this.database = new PgDatabase(this.options); - this.created = 0; - this.pooled = true; + this.options = new PgConnectionOptions(connectionString); + this.database = new PgDatabase(this.options); + this.created = 0; + this.lifetime = 0; + this.pooled = true; } #endregion @@ -123,15 +130,26 @@ } public void Disconnect() - { - try - { - this.database.Disconnect(); - } - catch (PgClientException ex) - { - throw new PgException(ex.Message, ex); - } + { + try + { + this.database.Disconnect(); + } + catch (PgClientException ex) + { + throw new PgException(ex.Message, ex); + } + finally + { + this.owningConnection = null; + this.database = null; + this.options = null; + this.activeTransaction = null; + this.preparedCommands = null; + this.created = 0; + this.lifetime = 0; + this.pooled = false; + } } public PgTransaction BeginTransaction(IsolationLevel level) Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionPool.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionPool.cs 2006-04-13 22:33:18 UTC (rev 115) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionPool.cs 2006-04-14 13:10:41 UTC (rev 116) @@ -16,224 +16,396 @@ */ using System; -using System.Data; using System.Collections; using System.Threading; +using PostgreSql.Data.Protocol; + namespace PostgreSql.Data.PostgreSqlClient { - internal class PgConnectionPool : MarshalByRefObject - { - #region \xB7 Fields \xB7 + internal sealed class PgConnectionPool : MarshalByRefObject + { + #region \xB7 Inner Types \xB7 + + private enum MoveType + { + LockedToUnlocked, + UnlockedToLocked + } - private static ConnectionPool pool = null; + #endregion + #region \xB7 Events \xB7 + + public event EmptyPoolEventHandler EmptyPool; + + #endregion + + #region \xB7 Fields \xB7 + + private PgConnectionOptions options; + private ArrayList locked; + private ArrayList unlocked; + private Thread cleanUpThread; + private string connectionString; + private bool isRunning; + private long lifeTime; + private object syncObject; + #endregion - - #region \xB7 Methods \xB7 - public static void Init() - { - if (pool == null) - { - pool = new ConnectionPool(); - } - } - - public static PgConnectionInternal GetConnection(PgConnection owningConnection) - { - Init(); + #region \xB7 Properties \xB7 - return ((PgConnectionInternal)pool.CheckOut(owningConnection)); - } + public object SyncObject + { + get + { + if (this.syncObject == null) + { + Interlocked.CompareExchange(ref this.syncObject, new object(), null); + } - public static void FreeConnection(PgConnectionInternal c) + return this.syncObject; + } + } + + public int Count { - pool.CheckIn(c); + get + { + lock (this.unlocked.SyncRoot) + { + return this.unlocked.Count + this.locked.Count; + } + } } - #endregion - } - - internal class ConnectionPool - { - #region \xB7 Fields \xB7 + public bool HasUnlocked + { + get { return this.unlocked.Count > 0; } + } - private ArrayList locked; - private ArrayList unlocked; - private Thread cleanUpThread; - #endregion #region \xB7 Constructors \xB7 - public ConnectionPool() - { - this.locked = ArrayList.Synchronized(new ArrayList()); - this.unlocked = ArrayList.Synchronized(new ArrayList()); + public PgConnectionPool(string connectionString) + { + this.connectionString = connectionString; + this.options = new PgConnectionOptions(connectionString); + this.lifeTime = this.options.ConnectionLifeTime * TimeSpan.TicksPerSecond; - this.cleanUpThread = new Thread(new ThreadStart(RunCleanUp)); - this.cleanUpThread.Name = "CleanUp Thread"; - this.cleanUpThread.Start(); - this.cleanUpThread.IsBackground = true; + if (this.options.MaxPoolSize == 0) + { + this.locked = ArrayList.Synchronized(new ArrayList()); + this.unlocked = ArrayList.Synchronized(new ArrayList()); + } + else + { + this.locked = ArrayList.Synchronized(new ArrayList(this.options.MaxPoolSize)); + this.unlocked = ArrayList.Synchronized(new ArrayList(this.options.MaxPoolSize)); + } + + // If a minimun number of connections is requested initialize the pool + this.Initialize(); + + // Start the cleanup thread only if needed + if (this.lifeTime != 0) + { + this.isRunning = true; + + this.cleanUpThread = new Thread(new ThreadStart(this.RunCleanup)); + this.cleanUpThread.Name = "Cleanup Thread"; + this.cleanUpThread.Start(); + this.cleanUpThread.IsBackground = true; + } } #endregion #region \xB7 Methods \xB7 - - public PgConnectionInternal CheckOut(PgConnection owningConnection) + + public void CheckIn(PgConnectionInternal connection) { - string connectionString = owningConnection.ConnectionString; - PgConnectionInternal newConnection = null; + connection.OwningConnection = null; + connection.Created = System.DateTime.Now.Ticks; - lock (typeof(PgConnectionPool)) + this.MoveConnection(connection, MoveType.LockedToUnlocked); + } + + public PgConnectionInternal CheckOut() + { + PgConnectionInternal newConnection = null; + + lock (this.SyncObject) + { + // 1. Try to Get a connection from the unlocked connection list. + newConnection = this.GetConnection(); + if (newConnection != null) + { + return newConnection; + } + + // 2. Check if we have reached the max number of allowed connections + this.CheckMaxPoolSize(); + + // 3. Try to Get a connection from the unlocked connection list. + newConnection = this.GetConnection(); + if (newConnection != null) + { + return newConnection; + } + + // 4. In any other case create a new connection + newConnection = this.Create(); + + // Set connection pooling settings to the new connection + newConnection.Lifetime = this.options.ConnectionLifeTime; + newConnection.Pooled = true; + + // Added to the locked connections list. + this.locked.Add(newConnection); + } + + return newConnection; + } + + public void Clear() + { + lock (this.SyncObject) { - if (this.unlocked.Count > 0) + // Stop cleanup thread + if (this.cleanUpThread != null) { - long now = System.DateTime.Now.Ticks; + this.cleanUpThread.Abort(); + this.cleanUpThread.Join(); + } - PgConnectionInternal[] list = new PgConnectionInternal[this.unlocked.Count]; - this.unlocked.CopyTo(0, list, 0, list.Length); + // Close all unlocked connections + PgConnectionInternal[] list = (PgConnectionInternal[])this.unlocked.ToArray(typeof(PgConnectionInternal)); - foreach (PgConnectionInternal connection in list) - { - if (this.Validate(connection, connectionString)) - { - if (connection.Options.ConnectionLifeTime != 0) - { - if ((now - connection.Created) > connection.Options.ConnectionLifeTime) - { - this.unlocked.Remove(connection); - this.Expire(connection); - } - else - { - this.unlocked.Remove(connection); - this.locked.Add(connection); - - connection.OwningConnection = owningConnection; - - return connection; - } - } - else - { - this.unlocked.Remove(connection); - this.locked.Add(connection); - - connection.OwningConnection = owningConnection; - - return connection; - } - } - else - { - this.unlocked.Remove(connection); - this.Expire(connection); - } - } + foreach (PgConnectionInternal connection in list) + { + connection.Disconnect(); } - newConnection = this.Create(owningConnection); - - newConnection.OwningConnection = owningConnection; - newConnection.Pooled = true; - newConnection.Created = System.DateTime.Now.Ticks; + // Close all locked connections + list = (PgConnectionInternal[])this.locked.ToArray(typeof(PgConnectionInternal)); - owningConnection.SslSetup(); + foreach (PgConnectionInternal connection in list) + { + connection.Disconnect(); + } - newConnection.Connect(); + // Clear lists + this.unlocked.Clear(); + this.locked.Clear(); - this.locked.Add(newConnection); - } - - return newConnection; - } + // Raise EmptyPool event + if (this.EmptyPool != null) + { + this.EmptyPool(this.connectionString.GetHashCode(), null); + } - public void CheckIn(PgConnectionInternal connection) - { - lock (typeof(PgConnectionPool)) - { - connection.Created = System.DateTime.Now.Ticks; - connection.OwningConnection = null; - - this.locked.Remove(connection); - this.unlocked.Add(connection); + // Reset fields + this.unlocked = null; + this.locked = null; + this.connectionString = null; + this.cleanUpThread = null; + this.EmptyPool = null; } } - #endregion + #endregion - #region \xB7 Private Methods \xB7 + #region \xB7 Private Methods \xB7 - private void RunCleanUp() - { - TimeSpan interval = new TimeSpan(0, 0, 10); + private void Initialize() + { + lock (this.SyncObject) + { + for (int i = 0; i < this.options.MinPoolSize; i++) + { + this.unlocked.Add(this.Create()); + } + } + } - while (true) - { - this.CleanUp(null); + private PgConnectionInternal Create() + { + PgConnectionInternal connection = new PgConnectionInternal(this.connectionString); + connection.Connect(); - Thread.Sleep(interval); - } + connection.Pooled = true; + connection.Created = DateTime.Now.Ticks; + + return connection; + } + + private PgConnectionInternal GetConnection() + { + PgConnectionInternal result = null; + long check = -1; + + lock (this.unlocked.SyncRoot) + { + PgConnectionInternal[] connections = (PgConnectionInternal[])this.unlocked.ToArray(typeof(PgConnectionInternal)); + + for (int i = connections.Length - 1; i >= 0; i--) + { + if (connections[i].Verify()) + { + if (this.lifeTime != 0) + { + long now = DateTime.Now.Ticks; + long expire = connections[i].Created + this.lifeTime; + + if (now >= expire) + { + if (this.CheckMinPoolSize()) + { + this.unlocked.Remove(connections[i]); + this.Expire(connections[i]); + } + } + else + { + if (expire > check) + { + check = expire; + result = connections[i]; + } + } + } + else + { + result = connections[i]; + break; + } + } + else + { + this.unlocked.Remove(connections[i]); + this.Expire(connections[i]); + } + } + + if (result != null) + { + this.MoveConnection(result, MoveType.UnlockedToLocked); + } + } + + return result; + } + + private bool CheckMinPoolSize() + { + return !(this.options.MinPoolSize > 0 && this.Count == this.options.MinPoolSize); } - private PgConnectionInternal Create(PgConnection owningConnection) + private void CheckMaxPoolSize() { - try + if (this.options.MaxPoolSize > 0 && this.Count >= this.options.MaxPoolSize) + { + long timeout = this.options.ConnectionTimeout * TimeSpan.TicksPerSecond; + long start = DateTime.Now.Ticks; + + /* + Loop brakes without errors in next situations: + 1. connection was returned from locked to unlocked by calling CheckIn in other thread (HasUnlocked = true) + 2. connection was moved from locked to unlocked (by Checkin) and then cleaned (removed from unlocked by Cleanup) + */ + while (true) + { + if (this.Count >= this.options.MaxPoolSize && this.HasUnlocked == false) + { + if ((DateTime.Now.Ticks - start) > timeout) + { + throw new SystemException("Timeout exceeded."); + } + + Thread.Sleep(100); + } + else + { + break; + } + } + } + } + + private void RunCleanup() + { + int interval = Convert.ToInt32(TimeSpan.FromTicks(this.lifeTime).TotalMilliseconds); + + if (interval > 60000) { - return new PgConnectionInternal(owningConnection); + interval = 60000; } - catch + + try { - throw; + while (this.isRunning) + { + Thread.Sleep(interval); + + this.Cleanup(); + + if (this.Count == 0) + { + lock (this.SyncObject) + { + // Empty pool + if (this.EmptyPool != null) + { + this.EmptyPool(this.connectionString.GetHashCode(), null); + } + + // Stop running + this.isRunning = false; + } + } + } } - } - - private bool Validate(PgConnectionInternal connection, string connectionString) - { - try - { - return (connection.OwningConnection.ConnectionString == connectionString && connection.Verify()); - } - catch + catch (ThreadAbortException) { - return false; + this.isRunning = false; } } private void Expire(PgConnectionInternal connection) { - try + try { if (connection.Verify()) { connection.Disconnect(); } } - catch + catch (Exception) { - throw new PgException("Error closing database connection."); + // Do not raise an exception as the connection could be invalid due to several reasons + // ( network problems, server shutdown, ... ) } } - - private void CleanUp(object State) + + private void Cleanup() { - long now = System.DateTime.Now.Ticks; - lock (this.unlocked.SyncRoot) { - if (this.unlocked.Count > 0) + if (this.unlocked.Count > 0 && this.lifeTime != 0) { - PgConnectionInternal[] list = new PgConnectionInternal[this.unlocked.Count]; - this.unlocked.CopyTo(0, list, 0, list.Length); + PgConnectionInternal[] list = (PgConnectionInternal[])this.unlocked.ToArray(typeof(PgConnectionInternal)); foreach (PgConnectionInternal connection in list) { - if (connection.Options.ConnectionLifeTime != 0) + long now = DateTime.Now.Ticks; + long expire = connection.Created + this.lifeTime; + + if (now >= expire) { - if ((now - connection.Created) >= connection.Options.ConnectionLifeTime) + if (this.CheckMinPoolSize()) { this.unlocked.Remove(connection); this.Expire(connection); @@ -244,6 +416,30 @@ } } + private void MoveConnection(PgConnectionInternal connection, MoveType moveType) + { + if (null == connection) + { + return; + } + + lock (this.unlocked.SyncRoot) + { + switch (moveType) + { + case MoveType.LockedToUnlocked: + this.locked.Remove(connection); + this.unlocked.Add(connection); + break; + + case MoveType.UnlockedToLocked: + this.unlocked.Remove(connection); + this.locked.Add(connection); + break; + } + } + } + #endregion - } + } } Added: trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgPoolManager.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgPoolManager.cs (rev 0) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgPoolManager.cs 2006-04-14 13:10:41 UTC (rev 116) @@ -0,0 +1,260 @@ +/* + * PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ + * + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. + * + * Software distributed under the License is distributed on + * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez + * All Rights Reserved. + */ + +using System; +using System.Collections; +using System.Threading; + +namespace PostgreSql.Data.PostgreSqlClient +{ + internal sealed class PgPoolManager + { + #region \xB7 Static Fields \xB7 + + private static readonly PgPoolManager instance = new PgPoolManager(); + + #endregion + + #region \xB7 Static Properties \xB7 + + public static PgPoolManager Instance + { + get { return PgPoolManager.instance; } + } + + #endregion + + #region \xB7 Fields \xB7 + + private Hashtable pools; + private Hashtable handlers; + private object syncObject; + + #endregion + + #region \xB7 Properties \xB7 + + public int PoolsCount + { + get + { + if (this.pools != null) + { + return this.pools.Count; + } + return 0; + } + } + + #endregion + + #region \xB7 Private Properties \xB7 + + private Hashtable Pools + { + get + { + if (this.pools == null) + { + this.pools = Hashtable.Synchronized(new Hashtable()); + } + + return this.pools; + } + } + + private Hashtable Handlers + { + get + { + if (this.handlers == null) + { + this.handlers = Hashtable.Synchronized(new Hashtable()); + } + + return this.handlers; + } + } + + private object SyncObject + { + get + { + if (this.syncObject == null) + { + Interlocked.CompareExchange(ref this.syncObject, new object(), null); + } + + return this.syncObject; + } + } + + #endregion + + #region \xB7 Constructors \xB7 + + private PgPoolManager() + { + } + + #endregion + + #region \xB7 Methods \xB7 + + public PgConnectionPool GetPool(string connectionString) + { + PgConnectionPool pool = this.FindPool(connectionString); + + if (pool == null) + { + pool = this.CreatePool(connectionString); + } + + return pool; + } + + public PgConnectionPool FindPool(string connectionString) + { + PgConnectionPool pool = null; + + lock (this.SyncObject) + { + int hashCode = connectionString.GetHashCode(); + + if (this.Pools.ContainsKey(hashCode)) + { + pool = (PgConnectionPool)pools[hashCode]; + } + } + + return pool; + } + + public PgConnectionPool CreatePool(string connectionString) + { + PgConnectionPool pool = null; + + lock (this.SyncObject) + { + pool = this.FindPool(connectionString); + + if (pool == null) + { + lock (this.pools.SyncRoot) + { + int hashcode = connectionString.GetHashCode(); + + // Create an empty pool handler + EmptyPoolEventHandler handler = new EmptyPoolEventHandler(this.OnEmptyPool); + + this.Handlers.Add(hashcode, handler); + + // Create the new connection pool + pool = new PgConnectionPool(connectionString); + + this.pools.Add(hashcode, pool); + + pool.EmptyPool += handler; + } + } + } + + return pool; + } + + public void ClearAllPools() + { + lock (this.SyncObject) + { + lock (this.pools.SyncRoot) + { + PgConnectionPool[] tempPools = new PgConnectionPool[this.pools.Count]; + + this.pools.Values.CopyTo(tempPools, 0); + + foreach (PgConnectionPool pool in tempPools) + { + // Clear pool + pool.Clear(); + } + + // Clear Hashtables + this.pools.Clear(); + this.handlers.Clear(); + } + } + } + + public void ClearPool(string connectionString) + { + lock (this.SyncObject) + { + lock (this.pools.SyncRoot) + { + int hashCode = connectionString.GetHashCode(); + + if (this.pools.ContainsKey(hashCode)) + { + PgConnectionPool pool = (PgConnectionPool)this.pools[hashCode]; + + // Clear pool + pool.Clear(); + } + } + } + } + + public int GetPooledConnectionCount(string connectionString) + { + PgConnectionPool pool = this.FindPool(connectionString); + + return (pool != null) ? pool.Count : 0; + } + + #endregion + + #region \xB7 Event Handlers \xB7 + + private void OnEmptyPool(object sender, EventArgs e) + { + lock (this.Pools.SyncRoot) + { + int hashCode = (int)sender; + + if (this.pools.ContainsKey(hashCode)) + { + PgConnectionPool pool = (PgConnectionPool)this.Pools[hashCode]; + + lock (pool.SyncObject) + { + EmptyPoolEventHandler handler = (EmptyPoolEventHandler)this.Handlers[hashCode]; + + pool.EmptyPool -= handler; + + this.Pools.Remove(hashCode); + this.Handlers.Remove(hashCode); + + pool = null; + handler = null; + } + } + } + } + + #endregion + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-04-13 22:33:24
|
Revision: 115 Author: carlosga_fb Date: 2006-04-13 15:33:18 -0700 (Thu, 13 Apr 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=115&view=rev Log Message: ----------- Modified Paths: -------------- trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgParameter.cs Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgParameter.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgParameter.cs 2006-04-13 22:29:39 UTC (rev 114) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgParameter.cs 2006-04-13 22:33:18 UTC (rev 115) @@ -41,7 +41,7 @@ private byte scale; private int size; private PgDbType providerType; - private bool inferType; + private bool isTypeSet; private PgParameterCollection parent; #endregion @@ -86,7 +86,7 @@ public override DbType DbType { get { return this.PgDbTypeToDbType(this.providerType); } - set { this.providerType = this.DbTypeToPgType(value); } + set { this.PgDbType = this.DbTypeToPgType(value); } } [RefreshProperties(RefreshProperties.All)] @@ -95,7 +95,11 @@ public PgDbType PgDbType { get { return this.providerType; } - set { this.providerType = value; } + set + { + this.providerType = value; + this.isTypeSet = true; + } } [Category("Data")] @@ -144,8 +148,10 @@ { value = System.DBNull.Value; } - this.value = value; - if (this.inferType) + + this.value = value; + + if (!this.isTypeSet) { this.SetPgTypeFromValue(this.value); } @@ -178,28 +184,24 @@ this.sourceVersion = DataRowVersion.Current; this.isNullable = false; this.providerType = PgDbType.VarChar; - this.inferType = true; } public PgParameter(string parameterName, object value) : this() { - this.inferType = false; this.parameterName = parameterName; this.value = value; } public PgParameter(string parameterName, PgDbType dbType) : this() { - this.inferType = false; this.parameterName = parameterName; this.providerType = dbType; } public PgParameter(string parameterName, PgDbType dbType, int size) : this() { - this.inferType = false; this.parameterName = parameterName; - this.providerType = dbType; + this.PgDbType = dbType; this.size = size; } @@ -209,9 +211,8 @@ int size, string sourceColumn) : this() { - this.inferType = false; this.parameterName = parameterName; - this.providerType = dbType; + this.PgDbType = dbType; this.size = size; this.sourceColumn = sourceColumn; } @@ -229,9 +230,8 @@ DataRowVersion sourceVersion, object value) { - this.inferType = false; this.parameterName = parameterName; - this.providerType = dbType; + this.PgDbType = dbType; this.size = size; this.direction = direction; this.isNullable = isNullable; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-04-13 22:29:46
|
Revision: 114 Author: carlosga_fb Date: 2006-04-13 15:29:39 -0700 (Thu, 13 Apr 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=114&view=rev Log Message: ----------- Modified Paths: -------------- trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionStringBuilder.cs Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionStringBuilder.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionStringBuilder.cs 2006-04-13 14:39:55 UTC (rev 113) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionStringBuilder.cs 2006-04-13 22:29:39 UTC (rev 114) @@ -39,8 +39,8 @@ synonyms.Add("data source", "data source"); synonyms.Add("server", "data source"); synonyms.Add("host", "data source"); - synonyms.Add("database", "catalog"); - synonyms.Add("catalog", "catalog"); + synonyms.Add("database", "initial catalog"); + synonyms.Add("initial catalog", "initial catalog"); synonyms.Add("user id", "user id"); synonyms.Add("user name", "user id"); synonyms.Add("user", "user id"); @@ -69,10 +69,10 @@ set { this.SetValue("Data Source", value); } } - public string Catalog + public string InitialCatalog { - get { return this.GetString("Catalog"); } - set { this.SetValue("Catalog", value); } + get { return this.GetString("Initial Catalog"); } + set { this.SetValue("Initial Catalog", value); } } public string UserID This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-04-13 14:40:06
|
Revision: 113 Author: carlosga_fb Date: 2006-04-13 07:39:55 -0700 (Thu, 13 Apr 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=113&view=rev Log Message: ----------- Modified Paths: -------------- trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/MetaData.xml Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/MetaData.xml =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/MetaData.xml 2006-04-13 14:39:19 UTC (rev 112) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/MetaData.xml 2006-04-13 14:39:55 UTC (rev 113) @@ -890,7 +890,7 @@ </DataTypes> <DataTypes> <TypeName>text</TypeName> - <ProviderDbType>27</ProviderDbType> + <ProviderDbType>22</ProviderDbType> <ColumnSize>2147483647</ColumnSize> <CreateFormat /> <CreateParameters>length</CreateParameters> @@ -964,7 +964,7 @@ <DbType>6</DbType> </DataTypes> <DataTypes> - <TypeName>timestamp</TypeName> + <TypeName>time</TypeName> <ProviderDbType>23</ProviderDbType> <ColumnSize>8</ColumnSize> <CreateFormat /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-04-13 14:39:27
|
Revision: 112 Author: carlosga_fb Date: 2006-04-13 07:39:19 -0700 (Thu, 13 Apr 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=112&view=rev Log Message: ----------- Modified Paths: -------------- trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgDatabase.cs Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgDatabase.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgDatabase.cs 2006-04-13 14:28:46 UTC (rev 111) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/Protocol/PgDatabase.cs 2006-04-13 14:39:19 UTC (rev 112) @@ -50,7 +50,7 @@ } DataTypes.Add(16 , "bool" , PgDataType.Boolean , 0, PgTypeFormat.Binary, 1); - DataTypes.Add(17 , "bytea" , PgDataType.Binary , 0, PgTypeFormat.Binary, 0); + DataTypes.Add(17 , "bytea" , PgDataType.Binary , 0, PgTypeFormat.Binary, Int32.MaxValue); DataTypes.Add(18 , "char" , PgDataType.Char , 0, PgTypeFormat.Text, 0); DataTypes.Add(19 , "name" , PgDataType.VarChar , 0, PgTypeFormat.Text, 0); DataTypes.Add(20 , "int8" , PgDataType.Int8 , 0, PgTypeFormat.Binary, 8); @@ -58,7 +58,7 @@ DataTypes.Add(22 , "int2vector" , PgDataType.Vector , 21, PgTypeFormat.Binary, 2); DataTypes.Add(23 , "int4" , PgDataType.Int4 , 0, PgTypeFormat.Binary, 4); DataTypes.Add(24 , "regproc" , PgDataType.VarChar , 0, PgTypeFormat.Text, 0); - DataTypes.Add(25 , "text" , PgDataType.VarChar , 0, PgTypeFormat.Text, 0); + DataTypes.Add(25 , "text" , PgDataType.VarChar , 0, PgTypeFormat.Text, Int32.MaxValue); DataTypes.Add(26 , "oid" , PgDataType.Int4 , 0, PgTypeFormat.Binary, 4); DataTypes.Add(30 , "oidvector" , PgDataType.Vector , 26, PgTypeFormat.Binary, 4); DataTypes.Add(600 , "point" , PgDataType.Point , 701, PgTypeFormat.Binary, 16); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-04-13 14:28:57
|
Revision: 111 Author: carlosga_fb Date: 2006-04-13 07:28:46 -0700 (Thu, 13 Apr 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=111&view=rev Log Message: ----------- Modified Paths: -------------- trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgColumns.cs Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgColumns.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgColumns.cs 2006-04-12 18:12:39 UTC (rev 110) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgColumns.cs 2006-04-13 14:28:46 UTC (rev 111) @@ -18,6 +18,7 @@ using System; using System.Data; using PostgreSql.Data.PostgreSqlClient; +using PostgreSql.Data.Protocol; namespace PostgreSql.Data.Schema { @@ -38,9 +39,8 @@ "WHEN pg_type.typname = '_bpchar' THEN '_char' " + "ELSE pg_type.typname " + "END AS DATA_TYPE, " + - "cast(pg_attribute.attlen AS Int4) AS COLUMN_SIZE, " + - "information_schema.columns.character_octet_length AS CHARACTER_OCTET_LENGTH, " + - "information_schema.columns.character_maximum_length AS CHARACTER_LENGTH, " + + "cast(0 AS Int4) AS COLUMN_SIZE, " + + "cast(0 AS Int4) AS CHARACTER_LENGTH, " + "cast (0 AS Int4) AS NUMERIC_PRECISION, " + "cast (0 AS Int4) AS NUMERIC_SCALE, " + "CASE " + @@ -56,6 +56,7 @@ "when false then true " + "END AS IS_NULLABLE, " + "(pg_depend.objid is not null) AS IS_AUTOINCREMENT, " + + "pg_attribute.atttypmod AS TYPE_MODIFIER, " + "pg_description.description AS DESCRIPTION " + "FROM " + "pg_attribute " + @@ -71,8 +72,6 @@ "pg_depend on (pg_attribute.attrelid = pg_depend.refobjid AND pg_attribute.attnum = pg_depend.refobjsubid AND pg_depend.deptype = 'i') " + "LEFT JOIN " + "pg_type on (pg_type.oid = pg_attribute.atttypid) " + - "LEFT JOIN " + - "information_schema.columns on (table_catalog=current_database() and table_schema=pg_namespace.nspname and table_name=pg_class.relname and ordinal_position=pg_attribute.attnum) " + "WHERE " + "pg_attribute.attisdropped = false AND pg_attribute.attnum > 0 "; @@ -109,29 +108,39 @@ protected override DataTable ProcessResult(PgConnection connection, DataTable schema) { - DataTable dataTypes = connection.GetSchema("DataTypes"); + int typeModifier = 0; schema.BeginLoadData(); foreach (DataRow column in schema.Rows) { + typeModifier = column.IsNull("TYPE_MODIFIER") ? -1 : Convert.ToInt32(column["TYPE_MODIFIER"]); + switch (column["DATA_TYPE"].ToString()) { - case "text": - column["COLUMN_SIZE"] = column["CHARACTER_OCTET_LENGTH"]; - break; - case "char": case "varchar": - column["COLUMN_SIZE"] = column["CHARACTER_LENGTH"]; + if (typeModifier != -1) + { + column["COLUMN_SIZE"] = typeModifier - 4; + column["CHARACTER_LENGTH"] = typeModifier - 4; + } break; + case "decimal": + case "numeric": + if (typeModifier != -1) + { + column["COLUMN_SIZE"] = ((typeModifier - 4) & 0xFFFF0000) >> 16; + column["NUMERIC_PRECISION"] = ((typeModifier - 4) & 0xFFFF0000) >> 16; + column["NUMERIC_SCALE"] = (typeModifier - 4) & 0xFFFF; + } + break; + default: - dataTypes.DefaultView.RowFilter = String.Format("TypeName='{0}'", column["COLUMN_NAME"]); - - if (dataTypes.DefaultView.Count == 1) + if (PgDatabase.DataTypes.IndexOf(column["DATA_TYPE"].ToString()) != -1) { - column["COLUMN_SIZE"] = dataTypes.DefaultView[0]["ColumnSize"]; + column["COLUMN_SIZE"] = PgDatabase.DataTypes[column["DATA_TYPE"].ToString()].Size; } break; } @@ -139,6 +148,7 @@ schema.EndLoadData(); schema.AcceptChanges(); + schema.Columns.Remove("TYPE_MODIFIER"); return schema; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-04-12 18:12:59
|
Revision: 110 Author: carlosga_fb Date: 2006-04-12 11:12:39 -0700 (Wed, 12 Apr 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=110&view=rev Log Message: ----------- Modified Paths: -------------- trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/MetaData.xml trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgColumns.cs trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgFunctionParameters.cs trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgFunctions.cs trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgTables.cs trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgViewColumns.cs Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/MetaData.xml =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/MetaData.xml 2006-04-12 17:23:52 UTC (rev 109) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/MetaData.xml 2006-04-12 18:12:39 UTC (rev 110) @@ -839,7 +839,7 @@ <DbType>15</DbType> </DataTypes> <DataTypes> - <TypeName>character</TypeName> + <TypeName>char</TypeName> <ProviderDbType>5</ProviderDbType> <ColumnSize>2147483647</ColumnSize> <CreateFormat /> @@ -1089,7 +1089,7 @@ <DbType>6</DbType> </DataTypes> <DataTypes> - <TypeName>boolean</TypeName> + <TypeName>bool</TypeName> <ProviderDbType>2</ProviderDbType> <ColumnSize>1</ColumnSize> <CreateFormat /> Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgColumns.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgColumns.cs 2006-04-12 17:23:52 UTC (rev 109) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgColumns.cs 2006-04-12 18:12:39 UTC (rev 110) @@ -92,13 +92,13 @@ // TABLE_NAME if (restrictions.Length > 2 && restrictions[2] != null) { - sql += String.Format("pg_class.relname = '{0}'", restrictions[2]); + sql += String.Format(" and pg_class.relname = '{0}'", restrictions[2]); } // COLUMN_NAME if (restrictions.Length > 3 && restrictions[3] != null) { - sql += String.Format("pg_attribute.attname = '{0}'", restrictions[3]); + sql += String.Format(" and pg_attribute.attname = '{0}'", restrictions[3]); } } Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgFunctionParameters.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgFunctionParameters.cs 2006-04-12 17:23:52 UTC (rev 109) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgFunctionParameters.cs 2006-04-12 18:12:39 UTC (rev 110) @@ -64,8 +64,13 @@ } } - sql += "WHERE " + where + " ORDER BY pg_namespace.nspname, pg_proc.proname"; + if (where.Length > 0) + { + sql += "WHERE " + where; + } + sql += " ORDER BY pg_namespace.nspname, pg_proc.proname"; + return sql; } Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgFunctions.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgFunctions.cs 2006-04-12 17:23:52 UTC (rev 109) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgFunctions.cs 2006-04-12 18:12:39 UTC (rev 110) @@ -83,7 +83,7 @@ if (where.Length > 0) { - sql += "WHERE " + where; + sql += " WHERE " + where; } sql += " ORDER BY pg_namespace.nspname, pg_proc.proname"; Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgTables.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgTables.cs 2006-04-12 17:23:52 UTC (rev 109) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgTables.cs 2006-04-12 18:12:39 UTC (rev 110) @@ -49,8 +49,6 @@ "left join pg_tablespace ON pg_class.reltablespace = pg_tablespace.oid " + "left join pg_description ON pg_class.oid = pg_description.objoid "; - sql += "WHERE "; - if (restrictions != null && restrictions.Length > 0) { // TABLE_CATALOG @@ -111,8 +109,13 @@ where += " pg_class.relkind = 'r'"; } - sql += where + " ORDER BY pg_class.relkind, pg_namespace.nspname, pg_class.relname"; + if (where.Length > 0) + { + sql += " WHERE " + where; + } + sql += " ORDER BY pg_class.relkind, pg_namespace.nspname, pg_class.relname"; + return sql; } Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgViewColumns.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgViewColumns.cs 2006-04-12 17:23:52 UTC (rev 109) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgViewColumns.cs 2006-04-12 18:12:39 UTC (rev 110) @@ -93,13 +93,13 @@ // VIEW_NAME if (restrictions.Length > 2 && restrictions[2] != null) { - sql += String.Format("pg_class.relname = '{0}'", restrictions[2]); + sql += String.Format(" and pg_class.relname = '{0}'", restrictions[2]); } // COLUMN_NAME if (restrictions.Length > 3 && restrictions[3] != null) { - sql += String.Format("pg_attribute.attname = '{0}'", restrictions[3]); + sql += String.Format(" and pg_attribute.attname = '{0}'", restrictions[3]); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-04-12 17:24:06
|
Revision: 109 Author: carlosga_fb Date: 2006-04-12 10:23:52 -0700 (Wed, 12 Apr 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=109&view=rev Log Message: ----------- Fixes over latest commit Modified Paths: -------------- trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgColumns.cs trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgFunctions.cs trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgViewColumns.cs Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgColumns.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgColumns.cs 2006-04-12 17:22:52 UTC (rev 108) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgColumns.cs 2006-04-12 17:23:52 UTC (rev 109) @@ -38,11 +38,11 @@ "WHEN pg_type.typname = '_bpchar' THEN '_char' " + "ELSE pg_type.typname " + "END AS DATA_TYPE, " + - "pg_attribute.attlen AS COLUMN_SIZE, " + + "cast(pg_attribute.attlen AS Int4) AS COLUMN_SIZE, " + "information_schema.columns.character_octet_length AS CHARACTER_OCTET_LENGTH, " + "information_schema.columns.character_maximum_length AS CHARACTER_LENGTH, " + - "0 AS NUMERIC_PRECISION, " + - "0 AS NUMERIC_SCALE, " + + "cast (0 AS Int4) AS NUMERIC_PRECISION, " + + "cast (0 AS Int4) AS NUMERIC_SCALE, " + "CASE " + "WHEN pg_attribute.attndims > 0 THEN true " + "ELSE false " + Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgFunctions.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgFunctions.cs 2006-04-12 17:22:52 UTC (rev 108) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgFunctions.cs 2006-04-12 17:23:52 UTC (rev 109) @@ -81,8 +81,13 @@ } } - sql += "WHERE " + where + " ORDER BY pg_namespace.nspname, pg_proc.proname"; + if (where.Length > 0) + { + sql += "WHERE " + where; + } + sql += " ORDER BY pg_namespace.nspname, pg_proc.proname"; + return sql; } Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgViewColumns.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgViewColumns.cs 2006-04-12 17:22:52 UTC (rev 108) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgViewColumns.cs 2006-04-12 17:23:52 UTC (rev 109) @@ -16,28 +16,66 @@ */ using System; +using System.Data; +using PostgreSql.Data.PostgreSqlClient; namespace PostgreSql.Data.Schema { internal class PgViewColumns : PgSchema { - #region \xB7 Protected Methods \xB7 + #region \xB7 Methods \xB7 protected override string BuildSql(string[] restrictions) { string sql = - "SELECT " + + "SELECT " + "current_database() AS VIEW_CATALOG, " + "pg_namespace.nspname AS VIEW_SCHEMA, " + "pg_class.relname AS VIEW_NAME, " + "pg_attribute.attname AS COLUMN_NAME, " + - "pg_attribute.attnum AS ORDINAL_POSITION " + + "CASE " + + "WHEN pg_type.typname = 'bpchar' THEN 'char' " + + "WHEN pg_type.typname = '_bpchar' THEN '_char' " + + "ELSE pg_type.typname " + + "END AS DATA_TYPE, " + + "cast(pg_attribute.attlen AS Int4) AS COLUMN_SIZE, " + + "information_schema.columns.character_octet_length AS CHARACTER_OCTET_LENGTH, " + + "information_schema.columns.character_maximum_length AS CHARACTER_LENGTH, " + + "cast(0 AS Int4) AS NUMERIC_PRECISION, " + + "cast(0 AS Int4) AS NUMERIC_SCALE, " + + "CASE " + + "WHEN pg_attribute.attndims > 0 THEN true " + + "ELSE false " + + "END AS IS_ARRAY, " + + "pg_attribute.attndims AS COLUMN_DIMENSIONS, " + + "pg_attribute.attnum AS ORDINAL_POSITION, " + + "pg_attribute.atthasdef AS HAS_DEFAULT, " + + "pg_attrdef.adsrc AS COLUMN_DEFAULT, " + + "CASE pg_attribute.attnotnull " + + "when true then false " + + "when false then true " + + "END AS IS_NULLABLE, " + + "(pg_depend.objid is not null) AS IS_AUTOINCREMENT, " + + "pg_description.description AS DESCRIPTION " + "FROM " + - "pg_class " + - "left join pg_namespace ON pg_class.relnamespace = pg_namespace.oid " + - "left join pg_attribute ON pg_attribute.attrelid = pg_class.oid " + + "pg_attribute " + + "LEFT JOIN " + + "pg_class on (pg_attribute.attrelid = pg_class.oid)" + + "LEFT JOIN " + + "pg_namespace on pg_class.relnamespace = pg_namespace.oid " + + "LEFT JOIN " + + "pg_attrdef on (pg_class.oid = pg_attrdef.adrelid AND pg_attribute.attnum = pg_attrdef.adnum) " + + "LEFT JOIN " + + "pg_description on (pg_attribute.attrelid = pg_description.objoid AND pg_attribute.attnum = pg_description.objsubid) " + + "LEFT JOIN " + + "pg_depend on (pg_attribute.attrelid = pg_depend.refobjid AND pg_attribute.attnum = pg_depend.refobjsubid AND pg_depend.deptype = 'i') " + + "LEFT JOIN " + + "pg_type on (pg_type.oid = pg_attribute.atttypid) " + + "LEFT JOIN " + + "information_schema.columns on (table_catalog=current_database() and table_schema=pg_namespace.nspname and table_name=pg_class.relname and ordinal_position=pg_attribute.attnum) " + "WHERE " + - "pg_class.relkind = 'v' "; + "pg_class.relkind = 'v' AND " + + "pg_attribute.attisdropped = false AND pg_attribute.attnum > 0 "; if (restrictions != null && restrictions.Length > 0) { @@ -55,21 +93,57 @@ // VIEW_NAME if (restrictions.Length > 2 && restrictions[2] != null) { - sql += String.Format(" and pg_class.relname = '{0}'", restrictions[2]); + sql += String.Format("pg_class.relname = '{0}'", restrictions[2]); } // COLUMN_NAME if (restrictions.Length > 3 && restrictions[3] != null) { - sql += String.Format(" and pg_attribute.attname = '{0}'", restrictions[3]); + sql += String.Format("pg_attribute.attname = '{0}'", restrictions[3]); } } - sql += " ORDER BY pg_namespace.nspname, pg_class.relname"; + sql += " ORDER BY pg_namespace.nspname, pg_class.relname, pg_attribute.attnum"; return sql; } + protected override DataTable ProcessResult(PgConnection connection, DataTable schema) + { + DataTable dataTypes = connection.GetSchema("DataTypes"); + + schema.BeginLoadData(); + + foreach (DataRow column in schema.Rows) + { + switch (column["DATA_TYPE"].ToString()) + { + case "text": + column["COLUMN_SIZE"] = column["CHARACTER_OCTET_LENGTH"]; + break; + + case "char": + case "varchar": + column["COLUMN_SIZE"] = column["CHARACTER_LENGTH"]; + break; + + default: + dataTypes.DefaultView.RowFilter = String.Format("TypeName='{0}'", column["COLUMN_NAME"]); + + if (dataTypes.DefaultView.Count == 1) + { + column["COLUMN_SIZE"] = dataTypes.DefaultView[0]["ColumnSize"]; + } + break; + } + } + + schema.EndLoadData(); + schema.AcceptChanges(); + + return schema; + } + #endregion } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-04-12 17:23:00
|
Revision: 108 Author: carlosga_fb Date: 2006-04-12 10:22:52 -0700 (Wed, 12 Apr 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=108&view=rev Log Message: ----------- Fixes over latest commit Modified Paths: -------------- trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionStringBuilder.cs Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionStringBuilder.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionStringBuilder.cs 2006-04-12 17:22:05 UTC (rev 107) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionStringBuilder.cs 2006-04-12 17:22:52 UTC (rev 108) @@ -34,12 +34,11 @@ static Hashtable InitializeSynonyms() { - Hashtable synonyms = new Hashtable(); + Hashtable synonyms = new Hashtable(new CaseInsensitiveHashCodeProvider(), new CaseInsensitiveComparer()); synonyms.Add("data source", "data source"); synonyms.Add("server", "data source"); synonyms.Add("host", "data source"); - synonyms.Add("host", "data source"); synonyms.Add("database", "catalog"); synonyms.Add("catalog", "catalog"); synonyms.Add("user id", "user id"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-04-12 17:22:17
|
Revision: 107 Author: carlosga_fb Date: 2006-04-12 10:22:05 -0700 (Wed, 12 Apr 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=107&view=rev Log Message: ----------- Modified Paths: -------------- trunk/PostgreSqlClient/source/UnitTests/PgBaseTest.cs Modified: trunk/PostgreSqlClient/source/UnitTests/PgBaseTest.cs =================================================================== --- trunk/PostgreSqlClient/source/UnitTests/PgBaseTest.cs 2006-04-12 14:56:57 UTC (rev 106) +++ trunk/PostgreSqlClient/source/UnitTests/PgBaseTest.cs 2006-04-12 17:22:05 UTC (rev 107) @@ -62,11 +62,11 @@ // Build the connection string PgConnectionStringBuilder csb = new PgConnectionStringBuilder(); - csb.DataSource = ConfigurationManager.AppSettings["DataSource"]; + csb.DataSource = ConfigurationManager.AppSettings["Data Source"]; csb.Catalog = ConfigurationManager.AppSettings["Catalog"]; - csb.UserID = ConfigurationManager.AppSettings["User"]; + csb.UserID = ConfigurationManager.AppSettings["User ID"]; csb.Password = ConfigurationManager.AppSettings["Password"]; - csb.PortNumber = Convert.ToInt32(ConfigurationManager.AppSettings["PortNumber"]); + csb.PortNumber = Convert.ToInt32(ConfigurationManager.AppSettings["Port Number"]); csb.Ssl = Convert.ToBoolean(ConfigurationManager.AppSettings["SSL"]); csb.Pooling = false; @@ -93,11 +93,11 @@ { PgConnectionStringBuilder csb = new PgConnectionStringBuilder(); - csb.DataSource = ConfigurationManager.AppSettings["DataSource"]; + csb.DataSource = ConfigurationManager.AppSettings["Data Source"]; csb.Catalog = ""; - csb.UserID = ConfigurationManager.AppSettings["User"]; + csb.UserID = ConfigurationManager.AppSettings["User ID"]; csb.Password = ConfigurationManager.AppSettings["Password"]; - csb.PortNumber = Convert.ToInt32(ConfigurationManager.AppSettings["PortNumber"]); + csb.PortNumber = Convert.ToInt32(ConfigurationManager.AppSettings["Port Number"]); csb.Ssl = Convert.ToBoolean(ConfigurationManager.AppSettings["SSL"]); csb.Pooling = false; @@ -106,7 +106,7 @@ connection.UserCertificateValidation += new System.Net.Security.RemoteCertificateValidationCallback(connection_UserCertificateValidation); connection.Open(); - PgCommand createDatabase = new PgCommand(String.Format("CREATE DATABASE {0} WITH ENCODING='UTF8'", ConfigurationManager.AppSettings["Database"]), connection); + PgCommand createDatabase = new PgCommand(String.Format("CREATE DATABASE {0} WITH ENCODING='UTF8'", ConfigurationManager.AppSettings["Catalog"]), connection); createDatabase.ExecuteNonQuery(); createDatabase.Dispose(); @@ -117,11 +117,11 @@ { PgConnectionStringBuilder csb = new PgConnectionStringBuilder(); - csb.DataSource = ConfigurationManager.AppSettings["DataSource"]; + csb.DataSource = ConfigurationManager.AppSettings["Data Source"]; csb.Catalog = ""; - csb.UserID = ConfigurationManager.AppSettings["User"]; + csb.UserID = ConfigurationManager.AppSettings["User ID"]; csb.Password = ConfigurationManager.AppSettings["Password"]; - csb.PortNumber = Convert.ToInt32(ConfigurationManager.AppSettings["PortNumber"]); + csb.PortNumber = Convert.ToInt32(ConfigurationManager.AppSettings["Port Number"]); csb.Ssl = Convert.ToBoolean(ConfigurationManager.AppSettings["SSL"]); csb.Pooling = false; @@ -130,7 +130,7 @@ connection.UserCertificateValidation += new System.Net.Security.RemoteCertificateValidationCallback(connection_UserCertificateValidation); connection.Open(); - PgCommand dropDatabase = new PgCommand(String.Format("drop database {0}", ConfigurationManager.AppSettings["Database"]), connection); + PgCommand dropDatabase = new PgCommand(String.Format("drop database {0}", ConfigurationManager.AppSettings["Catalog"]), connection); try { dropDatabase.ExecuteNonQuery(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-04-12 14:57:14
|
Revision: 106 Author: carlosga_fb Date: 2006-04-12 07:56:57 -0700 (Wed, 12 Apr 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=106&view=rev Log Message: ----------- Modified Paths: -------------- trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj 2006-04-12 14:56:35 UTC (rev 105) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSql.Data.PostgreSqlClient.csproj 2006-04-12 14:56:57 UTC (rev 106) @@ -119,6 +119,7 @@ <Compile Include="PgTypes\PgTimeSpan.cs" /> <Compile Include="Schema\PgForeignKeyColumns.cs" /> <Compile Include="Schema\PgForeignKeys.cs" /> + <Compile Include="Schema\PgFunctionParameters.cs" /> <Compile Include="Schema\PgSequences.cs" /> <Compile Include="Schema\PgUniqueKeys.cs" /> <Compile Include="Schema\PgViewColumns.cs" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-04-12 14:56:45
|
Revision: 105 Author: carlosga_fb Date: 2006-04-12 07:56:35 -0700 (Wed, 12 Apr 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=105&view=rev Log Message: ----------- ?\194?\183 More changes on schema support NOT FINISHED !!! Added Paths: ----------- trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgFunctionParameters.cs Added: trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgFunctionParameters.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgFunctionParameters.cs (rev 0) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgFunctionParameters.cs 2006-04-12 14:56:35 UTC (rev 105) @@ -0,0 +1,74 @@ +/* + * PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ + * + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. + * + * Software distributed under the License is distributed on + * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * Copyright (c) 2003, 2006 Carlos Guzman Alvarez + * All Rights Reserved. + */ + +using System; + +namespace PostgreSql.Data.Schema +{ + internal class PgFunctionParameters : PgSchema + { + #region \xB7 Protected Methods \xB7 + + protected override string BuildSql(string[] restrictions) + { + string where = ""; + string sql = + "SELECT " + + "current_database() AS FUNCTION_CATALOG, " + + "pg_namespace.nspname AS FUNCTION_SCHEMA, " + + "pg_proc.proname AS FUNCTION_NAME, " + + "FROM " + + "pg_proc " + + "left join pg_namespace ON pg_proc.pronamespace = pg_namespace.oid " + + "left join pg_description ON pg_proc.oid = pg_description.objoid "; + + if (restrictions != null && restrictions.Length > 0) + { + // FUNCTION_CATALOG + if (restrictions.Length > 0 && restrictions[0] != null) + { + } + + // FUNCTION_SCHEMA + if (restrictions.Length > 1 && restrictions[1] != null) + { + if (where.Length > 0) + { + where += " and "; + } + where += String.Format("pg_namespace.nspname = '{0}'", restrictions[1]); + } + + // FUNCTION_NAME + if (restrictions.Length > 2 && restrictions[2] != null) + { + if (where.Length > 0) + { + where += " and "; + } + where += String.Format(" and pg_proc.proname = '{0}'", restrictions[2]); + } + } + + sql += "WHERE " + where + " ORDER BY pg_namespace.nspname, pg_proc.proname"; + + return sql; + } + + #endregion + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-04-12 14:56:18
|
Revision: 104 Author: carlosga_fb Date: 2006-04-12 07:55:36 -0700 (Wed, 12 Apr 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=104&view=rev Log Message: ----------- ?\194?\183 More changes on schema support NOT FINISHED !!! Modified Paths: -------------- trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/MetaData.xml trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgColumns.cs trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgForeignKeyColumns.cs trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgPrimaryKeys.cs trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgSchemaFactory.cs trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgUniqueKeys.cs Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/MetaData.xml =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/MetaData.xml 2006-04-12 13:41:56 UTC (rev 103) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/MetaData.xml 2006-04-12 14:55:36 UTC (rev 104) @@ -161,7 +161,13 @@ <NumberOfIdentifierParts>0</NumberOfIdentifierParts> <PopulationMechanism>PrepareCollection</PopulationMechanism> </MetaDataCollections> - <MetaDataCollections> + <MetaDataCollections> + <CollectionName>FunctionParameters</CollectionName> + <NumberOfRestrictions>3</NumberOfRestrictions> + <NumberOfIdentifierParts>0</NumberOfIdentifierParts> + <PopulationMechanism>PrepareCollection</PopulationMechanism> + </MetaDataCollections> + <MetaDataCollections> <CollectionName>Groups</CollectionName> <NumberOfRestrictions>0</NumberOfRestrictions> <NumberOfIdentifierParts>0</NumberOfIdentifierParts> @@ -392,6 +398,24 @@ <RestrictionNumber>3</RestrictionNumber> </Restrictions> <Restrictions> + <CollectionName>FunctionParameters</CollectionName> + <RestrictionName>Catalog</RestrictionName> + <RestrictionDefault>function_catalog</RestrictionDefault> + <RestrictionNumber>1</RestrictionNumber> + </Restrictions> + <Restrictions> + <CollectionName>FunctionParameters</CollectionName> + <RestrictionName>Schema</RestrictionName> + <RestrictionDefault>function_schema</RestrictionDefault> + <RestrictionNumber>2</RestrictionNumber> + </Restrictions> + <Restrictions> + <CollectionName>FunctionParameters</CollectionName> + <RestrictionName>Name</RestrictionName> + <RestrictionDefault>function_name</RestrictionDefault> + <RestrictionNumber>3</RestrictionNumber> + </Restrictions> + <Restrictions> <CollectionName>ForeignKeys</CollectionName> <RestrictionName>ConstraintCatalog</RestrictionName> <RestrictionDefault>constraint_catalog</RestrictionDefault> @@ -615,7 +639,7 @@ <SupportedJoinOperators>15</SupportedJoinOperators> </DataSourceInformation> <DataTypes> - <TypeName>smallint</TypeName> + <TypeName>int2</TypeName> <ProviderDbType>12</ProviderDbType> <ColumnSize>2</ColumnSize> <CreateFormat /> @@ -640,7 +664,7 @@ <DbType>10</DbType> </DataTypes> <DataTypes> - <TypeName>integer</TypeName> + <TypeName>int4</TypeName> <ProviderDbType>13</ProviderDbType> <ColumnSize>4</ColumnSize> <CreateFormat /> @@ -665,7 +689,7 @@ <DbType>11</DbType> </DataTypes> <DataTypes> - <TypeName>bigint</TypeName> + <TypeName>int8</TypeName> <ProviderDbType>14</ProviderDbType> <ColumnSize>8</ColumnSize> <CreateFormat /> @@ -740,7 +764,7 @@ <DbType>7</DbType> </DataTypes> <DataTypes> - <TypeName>real</TypeName> + <TypeName>float4</TypeName> <ProviderDbType>11</ProviderDbType> <ColumnSize>8</ColumnSize> <CreateFormat /> @@ -765,7 +789,7 @@ <DbType>15</DbType> </DataTypes> <DataTypes> - <TypeName>double precision</TypeName> + <TypeName>float8</TypeName> <ProviderDbType>10</ProviderDbType> <ColumnSize>8</ColumnSize> <CreateFormat /> @@ -790,7 +814,7 @@ <DbType>8</DbType> </DataTypes> <DataTypes> - <TypeName>money</TypeName> + <TypeName>currency</TypeName> <ProviderDbType>7</ProviderDbType> <ColumnSize>4</ColumnSize> <CreateFormat /> @@ -840,7 +864,7 @@ <DbType>16</DbType> </DataTypes> <DataTypes> - <TypeName>character varying</TypeName> + <TypeName>varchar</TypeName> <ProviderDbType>27</ProviderDbType> <ColumnSize>2147483647</ColumnSize> <CreateFormat /> @@ -940,7 +964,7 @@ <DbType>6</DbType> </DataTypes> <DataTypes> - <TypeName>timestamp without time zone</TypeName> + <TypeName>timestamp</TypeName> <ProviderDbType>23</ProviderDbType> <ColumnSize>8</ColumnSize> <CreateFormat /> @@ -965,7 +989,7 @@ <DbType>6</DbType> </DataTypes> <DataTypes> - <TypeName>time with time zone</TypeName> + <TypeName>timetz</TypeName> <ProviderDbType>24</ProviderDbType> <ColumnSize>12</ColumnSize> <CreateFormat /> @@ -990,7 +1014,7 @@ <DbType>6</DbType> </DataTypes> <DataTypes> - <TypeName>timestamp without time zone</TypeName> + <TypeName>timestamp</TypeName> <ProviderDbType>25</ProviderDbType> <ColumnSize>8</ColumnSize> <CreateFormat /> @@ -1015,7 +1039,7 @@ <DbType>6</DbType> </DataTypes> <DataTypes> - <TypeName>timestamp with time zone</TypeName> + <TypeName>timestamptz</TypeName> <ProviderDbType>26</ProviderDbType> <ColumnSize>8</ColumnSize> <CreateFormat /> Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgColumns.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgColumns.cs 2006-04-12 13:41:56 UTC (rev 103) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgColumns.cs 2006-04-12 14:55:36 UTC (rev 104) @@ -27,80 +27,82 @@ protected override string BuildSql(string[] restrictions) { - string where = ""; - string sql = - "SELECT " + - "table_catalog, " + - "table_schema, " + - "table_name, " + - "column_name, " + - "data_type, " + - "0 AS COLUMN_SIZE, " + - "numeric_precision, " + - "numeric_scale, " + - "ordinal_position, " + - "case is_nullable " + - "when 'NO' then false " + - "when 'YES' then true " + - "end AS is_nullable, " + - "column_default, " + - "character_maximum_length AS CHARACTER_LENGTH, " + - "character_octet_length, " + - "character_set_catalog, " + - "character_set_schema, " + - "character_set_name, " + - "collation_catalog, " + - "collation_schema, " + - "collation_name, " + - "domain_catalog, " + - "domain_schema, " + - "domain_name " + - "FROM information_schema.columns "; - + string sql = + "SELECT " + + "current_database() AS TABLE_CATALOG, " + + "pg_namespace.nspname AS TABLE_SCHEMA, " + + "pg_class.relname AS TABLE_NAME, " + + "pg_attribute.attname AS COLUMN_NAME, " + + "CASE " + + "WHEN pg_type.typname = 'bpchar' THEN 'char' " + + "WHEN pg_type.typname = '_bpchar' THEN '_char' " + + "ELSE pg_type.typname " + + "END AS DATA_TYPE, " + + "pg_attribute.attlen AS COLUMN_SIZE, " + + "information_schema.columns.character_octet_length AS CHARACTER_OCTET_LENGTH, " + + "information_schema.columns.character_maximum_length AS CHARACTER_LENGTH, " + + "0 AS NUMERIC_PRECISION, " + + "0 AS NUMERIC_SCALE, " + + "CASE " + + "WHEN pg_attribute.attndims > 0 THEN true " + + "ELSE false " + + "END AS IS_ARRAY, " + + "pg_attribute.attndims AS COLUMN_DIMENSIONS, " + + "pg_attribute.attnum AS ORDINAL_POSITION, " + + "pg_attribute.atthasdef AS HAS_DEFAULT, " + + "pg_attrdef.adsrc AS COLUMN_DEFAULT, " + + "CASE pg_attribute.attnotnull " + + "when true then false " + + "when false then true " + + "END AS IS_NULLABLE, " + + "(pg_depend.objid is not null) AS IS_AUTOINCREMENT, " + + "pg_description.description AS DESCRIPTION " + + "FROM " + + "pg_attribute " + + "LEFT JOIN " + + "pg_class on pg_attribute.attrelid = pg_class.oid " + + "LEFT JOIN " + + "pg_namespace on pg_class.relnamespace = pg_namespace.oid " + + "LEFT JOIN " + + "pg_attrdef on (pg_class.oid = pg_attrdef.adrelid AND pg_attribute.attnum = pg_attrdef.adnum) " + + "LEFT JOIN " + + "pg_description on (pg_attribute.attrelid = pg_description.objoid AND pg_attribute.attnum = pg_description.objsubid) " + + "LEFT JOIN " + + "pg_depend on (pg_attribute.attrelid = pg_depend.refobjid AND pg_attribute.attnum = pg_depend.refobjsubid AND pg_depend.deptype = 'i') " + + "LEFT JOIN " + + "pg_type on (pg_type.oid = pg_attribute.atttypid) " + + "LEFT JOIN " + + "information_schema.columns on (table_catalog=current_database() and table_schema=pg_namespace.nspname and table_name=pg_class.relname and ordinal_position=pg_attribute.attnum) " + + "WHERE " + + "pg_attribute.attisdropped = false AND pg_attribute.attnum > 0 "; + if (restrictions != null && restrictions.Length > 0) { // TABLE_CATALOG if (restrictions.Length > 0 && restrictions[0] != null) { - if (where.Length > 0) - { - where += " and "; - } - where += String.Format("table_catalog = '{0}'", restrictions[0]); } // TABLE_SCHEMA if (restrictions.Length > 1 && restrictions[1] != null) { - if (where.Length > 0) - { - where += " and "; - } - where += String.Format("table_schema = '{0}'", restrictions[1]); + sql += String.Format(" and pg_namespace.nspname = '{0}'", restrictions[1]); } // TABLE_NAME if (restrictions.Length > 2 && restrictions[2] != null) { - if (where.Length > 0) - { - where += " and "; - } - where += String.Format("table_name = '{0}'", restrictions[2]); + sql += String.Format("pg_class.relname = '{0}'", restrictions[2]); } // COLUMN_NAME if (restrictions.Length > 3 && restrictions[3] != null) { - if (where.Length > 0) - { - where += " and "; - } - where += String.Format("column_name = '{0}'", restrictions[3]); + sql += String.Format("pg_attribute.attname = '{0}'", restrictions[3]); } } - sql += "WHERE " + where + " ORDER BY table_catalog, table_schema, table_name, ordinal_position"; + sql += " ORDER BY pg_namespace.nspname, pg_class.relname, pg_attribute.attnum"; return sql; } @@ -109,6 +111,8 @@ { DataTable dataTypes = connection.GetSchema("DataTypes"); + schema.BeginLoadData(); + foreach (DataRow column in schema.Rows) { switch (column["DATA_TYPE"].ToString()) @@ -117,8 +121,8 @@ column["COLUMN_SIZE"] = column["CHARACTER_OCTET_LENGTH"]; break; - case "character": - case "character variying": + case "char": + case "varchar": column["COLUMN_SIZE"] = column["CHARACTER_LENGTH"]; break; @@ -133,6 +137,7 @@ } } + schema.EndLoadData(); schema.AcceptChanges(); return schema; Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgForeignKeyColumns.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgForeignKeyColumns.cs 2006-04-12 13:41:56 UTC (rev 103) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgForeignKeyColumns.cs 2006-04-12 14:55:36 UTC (rev 104) @@ -105,6 +105,8 @@ selectColumn.Prepare(); + foreignKeyColumns.BeginLoadData(); + foreach (DataRow row in schema.Rows) { Array tableColumns = (Array)row["CONSTRAINT_TABLE_COLUMNS"]; @@ -145,7 +147,9 @@ } } + foreignKeyColumns.EndLoadData(); foreignKeyColumns.AcceptChanges(); + foreignKeyColumns.Columns.Remove("CONSTRAINT_TABLE_COLUMNS"); foreignKeyColumns.Columns.Remove("REFERENCED_TABLE_COLUMNS"); Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgPrimaryKeys.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgPrimaryKeys.cs 2006-04-12 13:41:56 UTC (rev 103) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgPrimaryKeys.cs 2006-04-12 14:55:36 UTC (rev 104) @@ -89,6 +89,8 @@ try { + primaryKeyColumns.BeginLoadData(); + selectColumn.Prepare(); foreach (DataRow row in schema.Rows) @@ -126,7 +128,9 @@ // CleanUp selectColumn.Dispose(); + primaryKeyColumns.EndLoadData(); primaryKeyColumns.AcceptChanges(); + primaryKeyColumns.Columns.Remove("PK_COLUMNS"); } Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgSchemaFactory.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgSchemaFactory.cs 2006-04-12 13:41:56 UTC (rev 103) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgSchemaFactory.cs 2006-04-12 14:55:36 UTC (rev 104) @@ -114,6 +114,10 @@ schema = new PgFunctions(); break; + case "functionparameters": + schema = new PgFunctionParameters(); + break; + case "foreignkeys": schema = new PgForeignKeys(); break; Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgUniqueKeys.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgUniqueKeys.cs 2006-04-12 13:41:56 UTC (rev 103) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/Schema/PgUniqueKeys.cs 2006-04-12 14:55:36 UTC (rev 104) @@ -89,6 +89,8 @@ try { + uniqueKeyColumns.BeginLoadData(); + selectColumn.Prepare(); foreach (DataRow row in schema.Rows) @@ -126,7 +128,9 @@ // CleanUp selectColumn.Dispose(); + uniqueKeyColumns.EndLoadData(); uniqueKeyColumns.AcceptChanges(); + uniqueKeyColumns.Columns.Remove("UK_COLUMNS"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2006-04-12 13:42:10
|
Revision: 103 Author: carlosga_fb Date: 2006-04-12 06:41:56 -0700 (Wed, 12 Apr 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=103&view=rev Log Message: ----------- ?\194?\183 Changes on Connection String parameter handling Modified Paths: -------------- trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionStringBuilder.cs Modified: trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionStringBuilder.cs =================================================================== --- trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionStringBuilder.cs 2006-04-12 13:41:07 UTC (rev 102) +++ trunk/PostgreSqlClient/source/PostgreSql/Data/PostgreSqlClient/PgConnectionStringBuilder.cs 2006-04-12 13:41:56 UTC (rev 103) @@ -16,85 +16,124 @@ */ using System; +using System.Collections; using System.Data; using System.Data.Common; namespace PostgreSql.Data.PostgreSqlClient { public sealed class PgConnectionStringBuilder : DbConnectionStringBuilder - { + { + #region \xB7 Static Fields \xB7 + + static readonly Hashtable Synonyms = InitializeSynonyms(); + + #endregion + + #region \xB7 Static Methods \xB7 + + static Hashtable InitializeSynonyms() + { + Hashtable synonyms = new Hashtable(); + + synonyms.Add("data source", "data source"); + synonyms.Add("server", "data source"); + synonyms.Add("host", "data source"); + synonyms.Add("host", "data source"); + synonyms.Add("database", "catalog"); + synonyms.Add("catalog", "catalog"); + synonyms.Add("user id", "user id"); + synonyms.Add("user name", "user id"); + synonyms.Add("user", "user id"); + synonyms.Add("user password", "password"); + synonyms.Add("password", "password"); + synonyms.Add("port number", "port number"); + synonyms.Add("port", "port number"); + synonyms.Add("packet size", "packet size"); + synonyms.Add("connection timeout", "connection timeout"); + synonyms.Add("pooling", "pooling"); + synonyms.Add("connection lifetime", "connection lifetime"); + synonyms.Add("min pool size", "min pool size"); + synonyms.Add("max pool size", "max pool size"); + synonyms.Add("ssl", "ssl"); + + return synonyms; + } + + #endregion + #region \xB7 Properties \xB7 public string DataSource { get { return this.GetString("Data Source"); } - set { this["Data Source"] = value; } + set { this.SetValue("Data Source", value); } } public string Catalog { get { return this.GetString("Catalog"); } - set { this["Catalog"] = value; } + set { this.SetValue("Catalog", value); } } public string UserID { get { return this.GetString("User ID"); } - set { this["User ID"] = value; } + set { this.SetValue("User ID", value); } } public string Password { get { return this.GetString("Password"); } - set { this["Password"] = value; } + set { this.SetValue("Password", value); } } - public int Port + public int PortNumber { get { return this.GetInt32("Port Number"); } - set { this["Port Number"] = value; } + set { this.SetValue("Port Number", value); } } public int PacketSize { get { return this.GetInt32("Packet Size"); } - set { this["Packet Size"] = value; } + set { this.SetValue("Packet Size", value); } } public int ConnectionTimeout { get { return this.GetInt32("Connection Timeout"); } - set { this["Connection Timeout"] = value; } + set { this.SetValue("Connection Timeout", value); } } public bool Pooling { get { return this.GetBoolean("Pooling"); } - set { this["Pooling"] = value; } + set { this.SetValue("Pooling", value); } } public int ConnectionLifeTime { get { return this.GetInt32("Connection Lifetime"); } - set { this["Connection Lifetime"] = value; } + set { this.SetValue("Connection Lifetime", value); } } public int MinPoolSize { get { return this.GetInt32("Min Pool Size"); } - set { this["Min Pool Size"] = value; } + set { this.SetValue("Min Pool Size", value); } } public int MaxPoolSize { get { return this.GetInt32("Max Pool Size"); } - set { this["Max Pool Size"] = value; } + set { this.SetValue("Max Pool Size", value); } } public bool Ssl { - get { return this.GetBoolean("SSL"); } - set { this["SSL"] = value; } + get { return this.GetBoolean("Ssl"); } + set { this.SetValue("Ssl", value); } } #endregion @@ -116,19 +155,41 @@ private int GetInt32(string keyword) { - return Convert.ToInt32(this[keyword]); + return Convert.ToInt32(this.GetKey(keyword)); } private string GetString(string keyword) { - return Convert.ToString(this[keyword]); + return Convert.ToString(this.GetKey(keyword)); } private bool GetBoolean(string keyword) { - return Convert.ToBoolean(this[keyword]); + return Convert.ToBoolean(this.GetKey(keyword)); } + private void SetValue(string keyword, object value) + { + this[this.GetKey(keyword)] = value; + } + + private string GetKey(string keyword) + { + string synonymKey = (string)Synonyms[keyword]; + + // First check if there are yet a property for the requested keyword + foreach (string key in this.Keys) + { + if (Synonyms.ContainsKey(key) && (string)Synonyms[key] == synonymKey) + { + synonymKey = key; + break; + } + } + + return synonymKey; + } + #endregion } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |