[pgsqlclient-checkins] pgsqlclient_10/PostgreSql.Data.PgSqlClient/source AssemblyInfo.cs,1.1.1.1,1.2
Status: Inactive
Brought to you by:
carlosga_fb
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13324 Modified Files: AssemblyInfo.cs PgCommand.cs PgCommandBuilder.cs PgConnection.cs PgConnectionPool.cs PgDataAdapter.cs PgDataReader.cs PgDbConnection.cs PgDbSchemaType.cs PgDbType.cs PgError.cs PgErrorCollection.cs PgException.cs PgInfoMessageEventArgs.cs PgNotificationEventArgs.cs PgParameter.cs PgParameterCollection.cs PgRowUpdatedEventArgs.cs PgRowUpdatingEventArgs.cs PgTransaction.cs Log Message: Updated license headers Index: AssemblyInfo.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/AssemblyInfo.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** AssemblyInfo.cs 2 Aug 2003 19:42:59 -0000 1.1.1.1 --- AssemblyInfo.cs 9 Feb 2004 14:19:22 -0000 1.2 *************** *** 1,4 **** /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ ! * Copyright (C) 2003 Carlos Guzmán Álvarez * * This library is free software; you can redistribute it and/or --- 1,4 ---- /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ ! * Copyright (c) 2003-2004 Carlos Guzman Alvarez * * This library is free software; you can redistribute it and/or Index: PgCommand.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgCommand.cs,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** PgCommand.cs 3 Jan 2004 15:41:38 -0000 1.25 --- PgCommand.cs 9 Feb 2004 14:19:22 -0000 1.26 *************** *** 1,851 **** ! /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ ! * Copyright (C) 2003 Carlos Guzmán Álvarez ! * ! * This library is free software; you can redistribute it and/or ! * modify it under the terms of the GNU Lesser General Public ! * License as published by the Free Software Foundation; either ! * version 2.1 of the License, or (at your option) any later version. ! * ! * This library is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of [...1675 lines suppressed...] ! for (int i = 0; i < matches.Count; i++) ! { ! if (matches[i].Value.Trim() != String.Empty) ! { ! this.commands[count] = matches[i].Value.Trim(); ! count++; ! } ! } ! } ! else ! { ! this.commands = new string[]{this.commandText}; ! } ! } ! } ! ! #endregion ! } } \ No newline at end of file Index: PgCommandBuilder.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgCommandBuilder.cs,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** PgCommandBuilder.cs 18 Dec 2003 10:27:32 -0000 1.15 --- PgCommandBuilder.cs 9 Feb 2004 14:19:22 -0000 1.16 *************** *** 1,781 **** ! /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ ! * Copyright (C) 2003 Carlos Guzmán Álvarez ! * ! * This library is free software; you can redistribute it and/or ! * modify it under the terms of the GNU Lesser General Public ! * License as published by the Free Software Foundation; either ! * version 2.1 of the License, or (at your option) any later version. ! * ! * This library is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of [...1533 lines suppressed...] ! e.Status = UpdateStatus.Continue; ! } ! } ! catch (Exception exception) ! { ! e.Errors = exception; ! e.Status = UpdateStatus.ErrorsOccurred; ! } ! finally ! { ! if (mustClose) ! { ! dataAdapter.SelectCommand.Connection.Close(); ! } ! } ! } ! ! #endregion ! } ! } Index: PgConnection.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgConnection.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** PgConnection.cs 18 Dec 2003 10:27:32 -0000 1.11 --- PgConnection.cs 9 Feb 2004 14:19:22 -0000 1.12 *************** *** 1,659 **** ! /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ ! * Copyright (C) 2003 Carlos Guzmán Álvarez ! * ! * This library is free software; you can redistribute it and/or ! * modify it under the terms of the GNU Lesser General Public ! * License as published by the Free Software Foundation; either ! * version 2.1 of the License, or (at your option) any later version. ! * ! * This library is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of [...1289 lines suppressed...] ! X509CertificateCollection clientCertificates, ! X509Certificate serverCertificate, ! string targetHost, ! X509CertificateCollection serverRequestedCertificates) ! { ! if (this.ClientCertSelection != null) ! { ! return this.ClientCertSelection( ! clientCertificates, ! serverCertificate, ! targetHost, ! serverRequestedCertificates); ! } ! ! return null; ! } ! ! #endregion ! } ! } Index: PgConnectionPool.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgConnectionPool.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PgConnectionPool.cs 19 Dec 2003 11:51:23 -0000 1.3 --- PgConnectionPool.cs 9 Feb 2004 14:19:22 -0000 1.4 *************** *** 1,238 **** ! /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ ! * Copyright (C) 2003 Carlos Guzmán Álvarez ! * ! * This library is free software; you can redistribute it and/or ! * modify it under the terms of the GNU Lesser General Public ! * License as published by the Free Software Foundation; either ! * version 2.1 of the License, or (at your option) any later version. ! * ! * This library is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! * Lesser General Public License for more details. ! * ! * You should have received a copy of the GNU Lesser General Public ! * License along with this library; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! ! using System; ! using System.Data; ! using System.Collections; ! using System.Threading; ! using PostgreSql.Data.NPgClient; ! ! namespace PostgreSql.Data.PgSqlClient ! { ! internal class PgConnectionPool : MarshalByRefObject ! { ! #region Fields ! ! private static PgPoolManager pool = null; ! ! #endregion ! ! #region Methods ! ! public static void Initialize() ! { ! if (pool == null) ! { ! pool = new PgPoolManager(); ! } ! } ! ! public static PgDbConnection GetConnection(string connectionString) ! { ! Initialize(); ! ! return ((PgDbConnection)pool.CheckOut(connectionString)); ! } ! ! public static void FreeConnection(PgDbConnection c) ! { ! pool.CheckIn(c); ! } ! ! #endregion ! } ! ! internal class PgPoolManager ! { ! #region Fields ! ! private ArrayList locked; ! private ArrayList unlocked; ! private Thread cleanUpThread; ! ! #endregion ! ! #region Constructors ! ! public PgPoolManager() ! { ! locked = ArrayList.Synchronized(new ArrayList()); ! unlocked = ArrayList.Synchronized(new ArrayList()); ! ! cleanUpThread = new Thread(new ThreadStart(RunCleanUp)); ! cleanUpThread.Name = "CleanUp Thread"; ! cleanUpThread.Start(); ! cleanUpThread.IsBackground = true; ! } ! ! #endregion ! ! #region Methods ! ! public PgDbConnection CheckOut(string connectionString) ! { ! PgDbConnection newConnection = null; ! long now = System.DateTime.Now.Ticks; ! ! lock (typeof(PgConnectionPool)) ! { ! if (unlocked.Count > 0) ! { ! PgDbConnection[] list = new PgDbConnection[unlocked.Count]; ! unlocked.CopyTo(0, list, 0, list.Length); ! ! foreach(PgDbConnection connection in list) ! { ! if (Validate(connection, connectionString)) ! { ! if (connection.Lifetime != 0) ! { ! if ((now - connection.Created) > connection.Lifetime) ! { ! unlocked.Remove(connection); ! Expire(connection); ! } ! else ! { ! unlocked.Remove(connection); ! locked.Add(connection); ! ! return(connection); ! } ! } ! else ! { ! unlocked.Remove(connection); ! locked.Add(connection); ! ! return(connection); ! } ! } ! else ! { ! unlocked.Remove(connection); ! Expire(connection); ! } ! } ! } ! ! newConnection = Create(connectionString); ! newConnection.Created = System.DateTime.Now.Ticks; ! ! locked.Add(newConnection); ! } ! ! return(newConnection); ! } ! ! public void CheckIn(PgDbConnection connection) ! { ! lock (typeof(PgDbConnection)) ! { ! connection.Created = System.DateTime.Now.Ticks; ! ! locked.Remove(connection); ! unlocked.Add(connection); ! } ! } ! ! private void RunCleanUp() ! { ! TimeSpan interval = new TimeSpan(0, 0, 10); ! ! while (true) ! { ! CleanUp(null); ! ! Thread.Sleep(interval); ! } ! } ! ! private PgDbConnection Create(string connectionString) ! { ! try ! { ! PgDbConnection connection = new PgDbConnection(connectionString); ! connection.Connect(); ! connection.Pooled = true; ! ! return connection; ! } ! catch (PgClientException ex) ! { ! throw ex; ! } ! } ! ! private bool Validate(PgDbConnection connection, string connectionString) ! { ! try ! { ! return (connection.ConnectionString == connectionString && ! connection.VerifyConnection()); ! } ! catch (Exception ex) ! { ! throw ex; ! } ! } ! ! private void Expire(PgDbConnection connection) ! { ! try ! { ! if (connection.VerifyConnection()) ! { ! connection.Disconnect(); ! } ! } ! catch (Exception) ! { ! throw new PgException("Error closing database connection."); ! } ! } ! ! private void CleanUp(object State) ! { ! long now = System.DateTime.Now.Ticks; ! ! lock (unlocked.SyncRoot) ! { ! if (unlocked.Count > 0) ! { ! PgDbConnection[] list = new PgDbConnection[unlocked.Count]; ! ! unlocked.CopyTo(0, list, 0, list.Length); ! foreach (PgDbConnection connection in list) ! { ! if (connection.Lifetime != 0) ! { ! if ((now - connection.Created) >= connection.Lifetime) ! { ! unlocked.Remove(connection); ! Expire(connection); ! } ! } ! } ! } ! } ! } ! ! #endregion ! } ! } --- 1,238 ---- ! /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ ! * Copyright (c) 2003-2004 Carlos Guzman Alvarez ! * ! * This library is free software; you can redistribute it and/or ! * modify it under the terms of the GNU Lesser General Public ! * License as published by the Free Software Foundation; either ! * version 2.1 of the License, or (at your option) any later version. ! * ! * This library is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! * Lesser General Public License for more details. ! * ! * You should have received a copy of the GNU Lesser General Public ! * License along with this library; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! ! using System; ! using System.Data; ! using System.Collections; ! using System.Threading; ! using PostgreSql.Data.NPgClient; ! ! namespace PostgreSql.Data.PgSqlClient ! { ! internal class PgConnectionPool : MarshalByRefObject ! { ! #region Fields ! ! private static PgPoolManager pool = null; ! ! #endregion ! ! #region Methods ! ! public static void Initialize() ! { ! if (pool == null) ! { ! pool = new PgPoolManager(); ! } ! } ! ! public static PgDbConnection GetConnection(string connectionString) ! { ! Initialize(); ! ! return ((PgDbConnection)pool.CheckOut(connectionString)); ! } ! ! public static void FreeConnection(PgDbConnection c) ! { ! pool.CheckIn(c); ! } ! ! #endregion ! } ! ! internal class PgPoolManager ! { ! #region Fields ! ! private ArrayList locked; ! private ArrayList unlocked; ! private Thread cleanUpThread; ! ! #endregion ! ! #region Constructors ! ! public PgPoolManager() ! { ! locked = ArrayList.Synchronized(new ArrayList()); ! unlocked = ArrayList.Synchronized(new ArrayList()); ! ! cleanUpThread = new Thread(new ThreadStart(RunCleanUp)); ! cleanUpThread.Name = "CleanUp Thread"; ! cleanUpThread.Start(); ! cleanUpThread.IsBackground = true; ! } ! ! #endregion ! ! #region Methods ! ! public PgDbConnection CheckOut(string connectionString) ! { ! PgDbConnection newConnection = null; ! long now = System.DateTime.Now.Ticks; ! ! lock (typeof(PgConnectionPool)) ! { ! if (unlocked.Count > 0) ! { ! PgDbConnection[] list = new PgDbConnection[unlocked.Count]; ! unlocked.CopyTo(0, list, 0, list.Length); ! ! foreach(PgDbConnection connection in list) ! { ! if (Validate(connection, connectionString)) ! { ! if (connection.Lifetime != 0) ! { ! if ((now - connection.Created) > connection.Lifetime) ! { ! unlocked.Remove(connection); ! Expire(connection); ! } ! else ! { ! unlocked.Remove(connection); ! locked.Add(connection); ! ! return(connection); ! } ! } ! else ! { ! unlocked.Remove(connection); ! locked.Add(connection); ! ! return(connection); ! } ! } ! else ! { ! unlocked.Remove(connection); ! Expire(connection); ! } ! } ! } ! ! newConnection = Create(connectionString); ! newConnection.Created = System.DateTime.Now.Ticks; ! ! locked.Add(newConnection); ! } ! ! return(newConnection); ! } ! ! public void CheckIn(PgDbConnection connection) ! { ! lock (typeof(PgDbConnection)) ! { ! connection.Created = System.DateTime.Now.Ticks; ! ! locked.Remove(connection); ! unlocked.Add(connection); ! } ! } ! ! private void RunCleanUp() ! { ! TimeSpan interval = new TimeSpan(0, 0, 10); ! ! while (true) ! { ! CleanUp(null); ! ! Thread.Sleep(interval); ! } ! } ! ! private PgDbConnection Create(string connectionString) ! { ! try ! { ! PgDbConnection connection = new PgDbConnection(connectionString); ! connection.Connect(); ! connection.Pooled = true; ! ! return connection; ! } ! catch (PgClientException ex) ! { ! throw ex; ! } ! } ! ! private bool Validate(PgDbConnection connection, string connectionString) ! { ! try ! { ! return (connection.ConnectionString == connectionString && ! connection.VerifyConnection()); ! } ! catch (Exception ex) ! { ! throw ex; ! } ! } ! ! private void Expire(PgDbConnection connection) ! { ! try ! { ! if (connection.VerifyConnection()) ! { ! connection.Disconnect(); ! } ! } ! catch (Exception) ! { ! throw new PgException("Error closing database connection."); ! } ! } ! ! private void CleanUp(object State) ! { ! long now = System.DateTime.Now.Ticks; ! ! lock (unlocked.SyncRoot) ! { ! if (unlocked.Count > 0) ! { ! PgDbConnection[] list = new PgDbConnection[unlocked.Count]; ! ! unlocked.CopyTo(0, list, 0, list.Length); ! foreach (PgDbConnection connection in list) ! { ! if (connection.Lifetime != 0) ! { ! if ((now - connection.Created) >= connection.Lifetime) ! { ! unlocked.Remove(connection); ! Expire(connection); ! } ! } ! } ! } ! } ! } ! ! #endregion ! } ! } Index: PgDataAdapter.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgDataAdapter.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PgDataAdapter.cs 18 Dec 2003 10:27:32 -0000 1.5 --- PgDataAdapter.cs 9 Feb 2004 14:19:22 -0000 1.6 *************** *** 1,223 **** ! /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ ! * Copyright (C) 2003 Carlos Guzmán Álvarez ! * ! * This library is free software; you can redistribute it and/or ! * modify it under the terms of the GNU Lesser General Public ! * License as published by the Free Software Foundation; either ! * version 2.1 of the License, or (at your option) any later version. ! * ! * This library is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! * Lesser General Public License for more details. ! * ! * You should have received a copy of the GNU Lesser General Public ! * License along with this library; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! ! using System; ! using System.Data; ! using System.Drawing; ! using System.Data.Common; ! using System.ComponentModel; ! using System.ComponentModel.Design; ! ! namespace PostgreSql.Data.PgSqlClient ! { ! #region DELEGATES ! ! public delegate void PgRowUpdatedEventHandler(object sender, PgRowUpdatedEventArgs e); ! public delegate void PgRowUpdatingEventHandler(object sender, PgRowUpdatingEventArgs e); ! ! #endregion ! ! [ToolboxItem(true), ! ToolboxBitmap(typeof(PgDataAdapter), "Resources.ToolBox.PgDataAdapter.bmp"), ! DefaultEvent("RowUpdated")] ! public sealed class PgDataAdapter : DbDataAdapter, IDbDataAdapter ! { ! #region Events ! ! private static readonly object EventRowUpdated = new object(); ! private static readonly object EventRowUpdating = new object(); ! ! #endregion ! ! #region Fields ! ! private PgCommand selectCommand; ! private PgCommand insertCommand; ! private PgCommand updateCommand; ! private PgCommand deleteCommand; ! private bool disposed; ! ! #endregion ! ! #region Properties ! ! IDbCommand IDbDataAdapter.SelectCommand ! { ! get { return selectCommand; } ! set { selectCommand = (PgCommand)value; } ! } ! ! IDbCommand IDbDataAdapter.InsertCommand ! { ! get { return insertCommand; } ! set { insertCommand = (PgCommand)value; } ! } ! ! IDbCommand IDbDataAdapter.UpdateCommand ! { ! get { return updateCommand; } ! set { updateCommand = (PgCommand)value; } ! } ! ! IDbCommand IDbDataAdapter.DeleteCommand ! { ! get { return deleteCommand; } ! set { deleteCommand = (PgCommand)value; } ! } ! ! [Category("DataCategory_Update"), DefaultValue(null)] ! public PgCommand SelectCommand ! { ! get { return selectCommand; } ! set { selectCommand = value; } ! } ! ! [Category("DataCategory_Update"), DefaultValue(null)] ! public PgCommand InsertCommand ! { ! get { return insertCommand; } ! set { insertCommand = value; } ! } ! ! [Category("DataCategory_Fill"), DefaultValue(null)] ! public PgCommand UpdateCommand ! { ! get { return updateCommand; } ! set { updateCommand = value; } ! } ! ! [Category("DataCategory_Update"), DefaultValue(null)] ! public PgCommand DeleteCommand ! { ! get { return deleteCommand; } ! set { deleteCommand = value; } ! } ! ! #endregion ! ! #region Constructors ! ! public PgDataAdapter() : base() ! { ! GC.SuppressFinalize(this); ! } ! ! public PgDataAdapter(PgCommand selectCommand) : this() ! { ! this.selectCommand = selectCommand; ! } ! ! public PgDataAdapter(string commandText, PgConnection connection) : this() ! { ! this.selectCommand = new PgCommand(commandText, connection); ! } ! ! public PgDataAdapter(string commandText, string connectionString) : this() ! { ! this.selectCommand = new PgCommand(commandText, new PgConnection(connectionString)); ! } ! ! #endregion ! ! #region IDisposable Methods ! ! protected override void Dispose(bool disposing) ! { ! if (!disposed) ! { ! try ! { ! if (disposing) ! { ! if (selectCommand != null) ! { ! selectCommand.Dispose(); ! } ! if (insertCommand != null) ! { ! insertCommand.Dispose(); ! } ! if (updateCommand != null) ! { ! updateCommand.Dispose(); ! } ! } ! ! // release any unmanaged resources ! ! disposed = true; ! } ! finally ! { ! base.Dispose(disposing); ! } ! } ! } ! ! #endregion ! ! #region Methods ! ! public event PgRowUpdatedEventHandler RowUpdated ! { ! add { Events.AddHandler(EventRowUpdated, value); } ! remove { Events.RemoveHandler(EventRowUpdated, value); } ! } ! ! [Category("DataCategory_Update")] ! public event PgRowUpdatingEventHandler RowUpdating ! { ! add { Events.AddHandler(EventRowUpdating, value); } ! remove { Events.RemoveHandler(EventRowUpdating, value); } ! } ! ! #endregion ! ! #region Protected Methods ! ! protected override RowUpdatedEventArgs CreateRowUpdatedEvent(DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) ! { ! return new PgRowUpdatedEventArgs(dataRow, command, statementType, tableMapping); ! } ! ! protected override void OnRowUpdated(RowUpdatedEventArgs value) ! { ! PgRowUpdatedEventHandler handler = (PgRowUpdatedEventHandler) Events[EventRowUpdated]; ! if ((null != handler) && (value is PgRowUpdatedEventArgs)) ! { ! handler(this, (PgRowUpdatedEventArgs) value); ! } ! } ! ! protected override RowUpdatingEventArgs CreateRowUpdatingEvent(DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) ! { ! return new PgRowUpdatingEventArgs(dataRow, command, statementType, tableMapping); ! } ! ! protected override void OnRowUpdating(RowUpdatingEventArgs value) ! { ! PgRowUpdatingEventHandler handler = (PgRowUpdatingEventHandler) Events[EventRowUpdating]; ! if ((null != handler) && (value is PgRowUpdatingEventArgs)) ! { ! handler(this, (PgRowUpdatingEventArgs) value); ! } ! } ! ! #endregion ! } ! } --- 1,223 ---- ! /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ ! * Copyright (c) 2003-2004 Carlos Guzman Alvarez ! * ! * This library is free software; you can redistribute it and/or ! * modify it under the terms of the GNU Lesser General Public ! * License as published by the Free Software Foundation; either ! * version 2.1 of the License, or (at your option) any later version. ! * ! * This library is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! * Lesser General Public License for more details. ! * ! * You should have received a copy of the GNU Lesser General Public ! * License along with this library; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! ! using System; ! using System.Data; ! using System.Drawing; ! using System.Data.Common; ! using System.ComponentModel; ! using System.ComponentModel.Design; ! ! namespace PostgreSql.Data.PgSqlClient ! { ! #region DELEGATES ! ! public delegate void PgRowUpdatedEventHandler(object sender, PgRowUpdatedEventArgs e); ! public delegate void PgRowUpdatingEventHandler(object sender, PgRowUpdatingEventArgs e); ! ! #endregion ! ! [ToolboxItem(true), ! ToolboxBitmap(typeof(PgDataAdapter), "Resources.ToolBox.PgDataAdapter.bmp"), ! DefaultEvent("RowUpdated")] ! public sealed class PgDataAdapter : DbDataAdapter, IDbDataAdapter ! { ! #region Events ! ! private static readonly object EventRowUpdated = new object(); ! private static readonly object EventRowUpdating = new object(); ! ! #endregion ! ! #region Fields ! ! private PgCommand selectCommand; ! private PgCommand insertCommand; ! private PgCommand updateCommand; ! private PgCommand deleteCommand; ! private bool disposed; ! ! #endregion ! ! #region Properties ! ! IDbCommand IDbDataAdapter.SelectCommand ! { ! get { return selectCommand; } ! set { selectCommand = (PgCommand)value; } ! } ! ! IDbCommand IDbDataAdapter.InsertCommand ! { ! get { return insertCommand; } ! set { insertCommand = (PgCommand)value; } ! } ! ! IDbCommand IDbDataAdapter.UpdateCommand ! { ! get { return updateCommand; } ! set { updateCommand = (PgCommand)value; } ! } ! ! IDbCommand IDbDataAdapter.DeleteCommand ! { ! get { return deleteCommand; } ! set { deleteCommand = (PgCommand)value; } ! } ! ! [Category("DataCategory_Update"), DefaultValue(null)] ! public PgCommand SelectCommand ! { ! get { return selectCommand; } ! set { selectCommand = value; } ! } ! ! [Category("DataCategory_Update"), DefaultValue(null)] ! public PgCommand InsertCommand ! { ! get { return insertCommand; } ! set { insertCommand = value; } ! } ! ! [Category("DataCategory_Fill"), DefaultValue(null)] ! public PgCommand UpdateCommand ! { ! get { return updateCommand; } ! set { updateCommand = value; } ! } ! ! [Category("DataCategory_Update"), DefaultValue(null)] ! public PgCommand DeleteCommand ! { ! get { return deleteCommand; } ! set { deleteCommand = value; } ! } ! ! #endregion ! ! #region Constructors ! ! public PgDataAdapter() : base() ! { ! GC.SuppressFinalize(this); ! } ! ! public PgDataAdapter(PgCommand selectCommand) : this() ! { ! this.selectCommand = selectCommand; ! } ! ! public PgDataAdapter(string commandText, PgConnection connection) : this() ! { ! this.selectCommand = new PgCommand(commandText, connection); ! } ! ! public PgDataAdapter(string commandText, string connectionString) : this() ! { ! this.selectCommand = new PgCommand(commandText, new PgConnection(connectionString)); ! } ! ! #endregion ! ! #region IDisposable Methods ! ! protected override void Dispose(bool disposing) ! { ! if (!disposed) ! { ! try ! { ! if (disposing) ! { ! if (selectCommand != null) ! { ! selectCommand.Dispose(); ! } ! if (insertCommand != null) ! { ! insertCommand.Dispose(); ! } ! if (updateCommand != null) ! { ! updateCommand.Dispose(); ! } ! } ! ! // release any unmanaged resources ! ! disposed = true; ! } ! finally ! { ! base.Dispose(disposing); ! } ! } ! } ! ! #endregion ! ! #region Methods ! ! public event PgRowUpdatedEventHandler RowUpdated ! { ! add { Events.AddHandler(EventRowUpdated, value); } ! remove { Events.RemoveHandler(EventRowUpdated, value); } ! } ! ! [Category("DataCategory_Update")] ! public event PgRowUpdatingEventHandler RowUpdating ! { ! add { Events.AddHandler(EventRowUpdating, value); } ! remove { Events.RemoveHandler(EventRowUpdating, value); } ! } ! ! #endregion ! ! #region Protected Methods ! ! protected override RowUpdatedEventArgs CreateRowUpdatedEvent(DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) ! { ! return new PgRowUpdatedEventArgs(dataRow, command, statementType, tableMapping); ! } ! ! protected override void OnRowUpdated(RowUpdatedEventArgs value) ! { ! PgRowUpdatedEventHandler handler = (PgRowUpdatedEventHandler) Events[EventRowUpdated]; ! if ((null != handler) && (value is PgRowUpdatedEventArgs)) ! { ! handler(this, (PgRowUpdatedEventArgs) value); ! } ! } ! ! protected override RowUpdatingEventArgs CreateRowUpdatingEvent(DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) ! { ! return new PgRowUpdatingEventArgs(dataRow, command, statementType, tableMapping); ! } ! ! protected override void OnRowUpdating(RowUpdatingEventArgs value) ! { ! PgRowUpdatingEventHandler handler = (PgRowUpdatingEventHandler) Events[EventRowUpdating]; ! if ((null != handler) && (value is PgRowUpdatingEventArgs)) ! { ! handler(this, (PgRowUpdatingEventArgs) value); ! } ! } ! ! #endregion ! } ! } Index: PgDataReader.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgDataReader.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** PgDataReader.cs 18 Dec 2003 10:27:32 -0000 1.16 --- PgDataReader.cs 9 Feb 2004 14:19:22 -0000 1.17 *************** *** 1,843 **** ! /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ ! * Copyright (C) 2003 Carlos Guzmán Álvarez ! * ! * This library is free software; you can redistribute it and/or ! * modify it under the terms of the GNU Lesser General Public ! * License as published by the Free Software Foundation; either ! * version 2.1 of the License, or (at your option) any later version. ! * ! * This library is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of [...1659 lines suppressed...] ! } ! } ! } ! ! private bool cultureAwareCompare(string strA, string strB) ! { ! try ! { ! return CultureInfo.CurrentCulture.CompareInfo.Compare(strA, strB, CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth | CompareOptions.IgnoreCase) == 0 ? true : false; ! } ! catch (Exception) ! { ! return strA.ToUpper() == strB.ToUpper() ? true : false; ! } ! } ! ! #endregion ! } } \ No newline at end of file Index: PgDbConnection.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgDbConnection.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PgDbConnection.cs 19 Dec 2003 11:51:23 -0000 1.5 --- PgDbConnection.cs 9 Feb 2004 14:19:22 -0000 1.6 *************** *** 1,220 **** ! /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ ! * Copyright (C) 2003 Carlos Guzmán Álvarez ! * ! * This library is free software; you can redistribute it and/or ! * modify it under the terms of the GNU Lesser General Public ! * License as published by the Free Software Foundation; either ! * version 2.1 of the License, or (at your option) any later version. ! * ! * This library is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! * Lesser General Public License for more details. ! * ! * You should have received a copy of the GNU Lesser General Public ! * License along with this library; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! ! using System; ! using System.Text; ! using System.Collections; ! using System.Text.RegularExpressions; ! ! using PostgreSql.Data.NPgClient; ! ! namespace PostgreSql.Data.PgSqlClient ! { ! internal sealed class PgDbConnection : MarshalByRefObject ! { ! #region Fields ! ! private PgDbClient db; ! private string connectionString; ! private PgConnectionParams settings; ! private long created; ! private long lifetime; ! private bool pooled; ! private Regex search; ! ! #endregion ! ! #region Properties ! ! public PgDbClient DB ! { ! get { return db; } ! } ! ! public string ConnectionString ! { ! get { return connectionString; } ! } ! ! public long Lifetime ! { ! get { return lifetime; } ! } ! public long Created ! { ! get { return created; } ! set { created = value; } ! } ! ! public bool Pooled ! { ! get { return pooled; } ! set { pooled = value; } ! } ! ! public PgConnectionParams Settings ! { ! get { return settings; } ! } ! ! #endregion ! ! #region Constructors ! ! private PgDbConnection() ! { ! settings = new PgConnectionParams(); ! search = new Regex(@"([\w\s\d]*)\s*=\s*([^;]*)"); ! ! connectionString = String.Empty; ! lifetime = 0; ! created = 0; ! pooled = true; ! } ! ! public PgDbConnection(string connectionString) : this() ! { ! this.connectionString = connectionString; ! parseConnectionString(); ! } ! ! #endregion ! ! #region Methods ! ! public void Connect() ! { ! try ! { ! db = new PgDbClient(settings); ! db.Connect(); ! } ! catch (PgClientException ex) ! { ! throw new PgException(ex.Message, ex); ! } ! } ! ! public void Disconnect() ! { ! try ! { ! db.Disconnect(); ! } ! catch (PgClientException ex) ! { ! throw new PgException(ex.Message, ex); ! } ! } ! ! private void parseConnectionString() ! { ! MatchCollection elements = search.Matches(connectionString); ! ! foreach (Match element in elements) ! { ! if (element.Groups[2].Value.Trim().Length > 0) ! { ! switch (element.Groups[1].Value.Trim().ToLower()) ! { ! case "datasource": ! case "server": ! case "host": ! settings.ServerName = element.Groups[2].Value.Trim(); ! break; ! ! case "database": ! settings.Database = element.Groups[2].Value.Trim(); ! break; ! ! case "user name": ! case "user": ! settings.UserName = element.Groups[2].Value.Trim(); ! break; ! ! case "user password": ! case "password": ! settings.UserPassword = element.Groups[2].Value.Trim(); ! break; ! ! case "port": ! settings.ServerPort = Int32.Parse(element.Groups[2].Value.Trim()); ! break; ! ! case "connection lifetime": ! lifetime = Int32.Parse(element.Groups[2].Value.Trim()); ! lifetime *= TimeSpan.TicksPerSecond; ! break; ! ! case "timeout": ! case "connection timeout": ! settings.Timeout = Int32.Parse(element.Groups[2].Value.Trim()); ! break; ! ! case "packet size": ! settings.PacketSize = Int32.Parse(element.Groups[2].Value.Trim()); ! break; ! ! case "pooling": ! settings.Pooling = Boolean.Parse(element.Groups[2].Value.Trim()); ! break; ! ! case "ssl": ! settings.SSL = Boolean.Parse(element.Groups[2].Value.Trim()); ! break; ! } ! } ! } ! ! if (settings.UserName == String.Empty || settings.ServerName == String.Empty || settings.ServerPort == 0) ! { ! throw new ArgumentException("An invalid connection string argument has been supplied or a required connection string argument has not been supplied."); ! } ! else ! { ! if (settings.PacketSize < 512 || settings.PacketSize > 32767) ! { ! StringBuilder msg = new StringBuilder(); ! ! msg.AppendFormat("'Packet Size' value of {0} is not valid.\r\nThe value should be an integer >= 512 and <= 32767.", settings.PacketSize); ! ! throw new ArgumentException(msg.ToString()); ! } ! } ! } ! ! internal bool VerifyConnection() ! { ! bool isValid = true; ! ! try ! { ! // Try to send a Sync message to the PostgreSQL Server ! this.db.Sync(); ! } ! catch (Exception) ! { ! isValid = false; ! } ! ! return isValid; ! } ! ! #endregion ! } } \ No newline at end of file --- 1,220 ---- ! /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ ! * Copyright (c) 2003-2004 Carlos Guzman Alvarez ! * ! * This library is free software; you can redistribute it and/or ! * modify it under the terms of the GNU Lesser General Public ! * License as published by the Free Software Foundation; either ! * version 2.1 of the License, or (at your option) any later version. ! * ! * This library is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! * Lesser General Public License for more details. ! * ! * You should have received a copy of the GNU Lesser General Public ! * License along with this library; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! ! using System; ! using System.Text; ! using System.Collections; ! using System.Text.RegularExpressions; ! ! using PostgreSql.Data.NPgClient; ! ! namespace PostgreSql.Data.PgSqlClient ! { ! internal sealed class PgDbConnection : MarshalByRefObject ! { ! #region Fields ! ! private PgDbClient db; ! private string connectionString; ! private PgConnectionParams settings; ! private long created; ! private long lifetime; ! private bool pooled; ! private Regex search; ! ! #endregion ! ! #region Properties ! ! public PgDbClient DB ! { ! get { return db; } ! } ! ! public string ConnectionString ! { ! get { return connectionString; } ! } ! ! public long Lifetime ! { ! get { return lifetime; } ! } ! public long Created ! { ! get { return created; } ! set { created = value; } ! } ! ! public bool Pooled ! { ! get { return pooled; } ! set { pooled = value; } ! } ! ! public PgConnectionParams Settings ! { ! get { return settings; } ! } ! ! #endregion ! ! #region Constructors ! ! private PgDbConnection() ! { ! settings = new PgConnectionParams(); ! search = new Regex(@"([\w\s\d]*)\s*=\s*([^;]*)"); ! ! connectionString = String.Empty; ! lifetime = 0; ! created = 0; ! pooled = true; ! } ! ! public PgDbConnection(string connectionString) : this() ! { ! this.connectionString = connectionString; ! parseConnectionString(); ! } ! ! #endregion ! ! #region Methods ! ! public void Connect() ! { ! try ! { ! db = new PgDbClient(settings); ! db.Connect(); ! } ! catch (PgClientException ex) ! { ! throw new PgException(ex.Message, ex); ! } ! } ! ! public void Disconnect() ! { ! try ! { ! db.Disconnect(); ! } ! catch (PgClientException ex) ! { ! throw new PgException(ex.Message, ex); ! } ! } ! ! private void parseConnectionString() ! { ! MatchCollection elements = search.Matches(connectionString); ! ! foreach (Match element in elements) ! { ! if (element.Groups[2].Value.Trim().Length > 0) ! { ! switch (element.Groups[1].Value.Trim().ToLower()) ! { ! case "datasource": ! case "server": ! case "host": ! settings.ServerName = element.Groups[2].Value.Trim(); ! break; ! ! case "database": ! settings.Database = element.Groups[2].Value.Trim(); ! break; ! ! case "user name": ! case "user": ! settings.UserName = element.Groups[2].Value.Trim(); ! break; ! ! case "user password": ! case "password": ! settings.UserPassword = element.Groups[2].Value.Trim(); ! break; ! ! case "port": ! settings.ServerPort = Int32.Parse(element.Groups[2].Value.Trim()); ! break; ! ! case "connection lifetime": ! lifetime = Int32.Parse(element.Groups[2].Value.Trim()); ! lifetime *= TimeSpan.TicksPerSecond; ! break; ! ! case "timeout": ! case "connection timeout": ! settings.Timeout = Int32.Parse(element.Groups[2].Value.Trim()); ! break; ! ! case "packet size": ! settings.PacketSize = Int32.Parse(element.Groups[2].Value.Trim()); ! break; ! ! case "pooling": ! settings.Pooling = Boolean.Parse(element.Groups[2].Value.Trim()); ! break; ! ! case "ssl": ! settings.SSL = Boolean.Parse(element.Groups[2].Value.Trim()); ! break; ! } ! } ! } ! ! if (settings.UserName == String.Empty || settings.ServerName == String.Empty || settings.ServerPort == 0) ! { ! throw new ArgumentException("An invalid connection string argument has been supplied or a required connection string argument has not been supplied."); ! } ! else ! { ! if (settings.PacketSize < 512 || settings.PacketSize > 32767) ! { ! StringBuilder msg = new StringBuilder(); ! ! msg.AppendFormat("'Packet Size' value of {0} is not valid.\r\nThe value should be an integer >= 512 and <= 32767.", settings.PacketSize); ! ! throw new ArgumentException(msg.ToString()); ! } ! } ! } ! ! internal bool VerifyConnection() ! { ! bool isValid = true; ! ! try ! { ! // Try to send a Sync message to the PostgreSQL Server ! this.db.Sync(); ! } ! catch (Exception) ! { ! isValid = false; ! } ! ! return isValid; ! } ! ! #endregion ! } } \ No newline at end of file Index: PgDbSchemaType.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgDbSchemaType.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PgDbSchemaType.cs 2 Aug 2003 19:43:01 -0000 1.1.1.1 --- PgDbSchemaType.cs 9 Feb 2004 14:19:22 -0000 1.2 *************** *** 1,4 **** /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ ! * Copyright (C) 2003 Carlos Guzmán Álvarez * * This library is free software; you can redistribute it and/or --- 1,4 ---- /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ ! * Copyright (c) 2003-2004 Carlos Guzman Alvarez * * This library is free software; you can redistribute it and/or Index: PgDbType.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgDbType.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PgDbType.cs 26 Oct 2003 11:31:59 -0000 1.5 --- PgDbType.cs 9 Feb 2004 14:19:22 -0000 1.6 *************** *** 1,4 **** /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ ! * Copyright (C) 2003 Carlos Guzmán Álvarez * * This library is free software; you can redistribute it and/or --- 1,4 ---- /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ ! * Copyright (c) 2003-2004 Carlos Guzman Alvarez * * This library is free software; you can redistribute it and/or Index: PgError.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgError.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PgError.cs 14 Dec 2003 15:06:50 -0000 1.2 --- PgError.cs 9 Feb 2004 14:19:22 -0000 1.3 *************** *** 1,125 **** ! /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ ! * Copyright (C) 2003 Carlos Guzmán Álvarez ! * ! * This library is free software; you can redistribute it and/or ! * modify it under the terms of the GNU Lesser General Public ! * License as published by the Free Software Foundation; either ! * version 2.1 of the License, or (at your option) any later version. ! * ! * This library is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! * Lesser General Public License for more details. ! * ! * You should have received a copy of the GNU Lesser General Public ! * License along with this library; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! ! using System; ! ! namespace PostgreSql.Data.PgSqlClient ! { ! [Serializable] ! public sealed class PgError ! { ! #region Fields ! ! private string severity; ! private string code; ! private string message; ! private string detail; ! private string hint; ! private string where; ! private string position; ! private string file; ! private int line; ! private string routine; ! ! #endregion ! ! #region Properties ! ! public string Severity ! { ! get { return severity; } ! set { severity = value; } ! } ! ! public string Message ! { ! get { return message; } ! set { message = value; } ! } ! ! public string Code ! { ! get { return code; } ! set { code = value; } ! } ! ! public string Detail ! { ! get { return detail; } ! set { detail = value; } ! } ! ! public string Hint ! { ! get { return hint; } ! set { hint = value; } ! } ! ! public string Where ! { ! get { return where; } ! set { where = value; } ! } ! ! public string Position ! { ! get { return position; } ! set { position = value; } ! } ! ! public string File ! { ! get { return file; } ! set { file = value; } ! } ! ! public int Line ! { ! get { return line; } ! set { line = value; } ! } ! ! public string Routine ! { ! get { return routine; } ! set { routine = value; } ! } ! ! #endregion ! ! #region Constructors ! ! internal PgError() ! { ! } ! ! internal PgError(string message) ! { ! this.message = message; ! } ! ! internal PgError(string severity, string code, string message) ! { ! this.severity = severity; ! this.code = code; ! this.message = message; ! } ! ! #endregion ! } ! } --- 1,125 ---- ! /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ ! * Copyright (c) 2003-2004 Carlos Guzman Alvarez ! * ! * This library is free software; you can redistribute it and/or ! * modify it under the terms of the GNU Lesser General Public ! * License as published by the Free Software Foundation; either ! * version 2.1 of the License, or (at your option) any later version. ! * ! * This library is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! * Lesser General Public License for more details. ! * ! * You should have received a copy of the GNU Lesser General Public ! * License along with this library; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! ! using System; ! ! namespace PostgreSql.Data.PgSqlClient ! { ! [Serializable] ! public sealed class PgError ! { ! #region Fields ! ! private string severity; ! private string code; ! private string message; ! private string detail; ! private string hint; ! private string where; ! private string position; ! private string file; ! private int line; ! private string routine; ! ! #endregion ! ! #region Properties ! ! public string Severity ! { ! get { return severity; } ! set { severity = value; } ! } ! ! public string Message ! { ! get { return message; } ! set { message = value; } ! } ! ! public string Code ! { ! get { return code; } ! set { code = value; } ! } ! ! public string Detail ! { ! get { return detail; } ! set { detail = value; } ! } ! ! public string Hint ! { ! get { return hint; } ! set { hint = value; } ! } ! ! public string Where ! { ! get { return where; } ! set { where = value; } ! } ! ! public string Position ! { ! get { return position; } ! set { position = value; } ! } ! ! public string File ! { ! get { return file; } ! set { file = value; } ! } ! ! public int Line ! { ! get { return line; } ! set { line = value; } ! } ! ! public string Routine ! { ! get { return routine; } ! set { routine = value; } ! } ! ! #endregion ! ! #region Constructors ! ! internal PgError() ! { ! } ! ! internal PgError(string message) ! { ! this.message = message; ! } ! ! internal PgError(string severity, string code, string message) ! { ! this.severity = severity; ! this.code = code; ! this.message = message; ! } ! ! #endregion ! } ! } Index: PgErrorCollection.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgErrorCollection.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PgErrorCollection.cs 14 Dec 2003 15:06:50 -0000 1.3 --- PgErrorCollection.cs 9 Feb 2004 14:19:22 -0000 1.4 *************** *** 1,116 **** ! /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ ! * Copyright (C) 2003 Carlos Guzmán Álvarez ! * ! * This library is free software; you can redistribute it and/or ! * modify it under the terms of the GNU Lesser General Public ! * License as published by the Free Software Foundation; either ! * version 2.1 of the License, or (at your option) any later version. ! * ! * This library is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! * Lesser General Public License for more details. ! * ! * You should have received a copy of the GNU Lesser General Public ! * License along with this library; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! ! using System; ! using System.Collections; ! using System.ComponentModel; ! using System.Globalization; ! ! namespace PostgreSql.Data.PgSqlClient ! { ! [Serializable, ! ListBindable(false)] ! public sealed class PgErrorCollection : ICollection, IEnumerable ! { ! #region Fields ! ! private ArrayList errors; ! ! #endregion ! ! #region Properties ! ! public PgError this[string errorMessage] ! { ! get { return (PgError)errors[errors.IndexOf(errorMessage)]; } ! set { errors[errors.IndexOf(errorMessage)] = (PgError)value; } ! } ! ! public PgError this[int errorIndex] ! { ! get { return (PgError)errors[errorIndex]; } ! set { errors[errorIndex] = (PgError)value; } ! } ! ! public int Count ! { ! get { return errors.Count; } ! } ! ! public bool IsSynchronized ! { ! get { return errors.IsSynchronized; } ! } ! ! public object SyncRoot ! { ! get { return errors.SyncRoot; } ! } ! ! #endregion ! ! #region constructors ! ! internal PgErrorCollection() ! { ! errors = new ArrayList(); ! } ! ! #endregion ! ! #region Methods ! ! public IEnumerator GetEnumerator() ! { ! return errors.GetEnumerator(); ! } ! ! public void CopyTo(Array array, int index) ! { ! errors.CopyTo(array, index); ! } ! ! internal PgError Add(PgError error) ! { ! errors.Add(error); ! ! return error; ! } ! ! internal PgError Add(string severity, string message, string code) ! { ! PgError error = new PgError(severity, code, message); ! ! return Add(error); ! } ! ! private bool cultureAwareCompare(string strA, string strB) ! { ! try ! { ! return CultureInfo.CurrentCulture.CompareInfo.Compare(strA, strB, CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth | CompareOptions.IgnoreCase) == 0 ? true : false; ! } ! catch (Exception) ! { ! return strA.ToUpper() == strB.ToUpper() ? true : false; ! } ! } ! ! #endregion ! } ! } --- 1,116 ---- ! /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ ! * Copyright (c) 2003-2004 Carlos Guzman Alvarez ! * ! * This library is free software; you can redistribute it and/or ! * modify it under the terms of the GNU Lesser General Public ! * License as published by the Free Software Foundation; either ! * version 2.1 of the License, or (at your option) any later version. ! * ! * This library is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! * Lesser General Public License for more details. ! * ! * You should have received a copy of the GNU Lesser General Public ! * License along with this library; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! ! using System; ! using System.Collections; ! using System.ComponentModel; ! using System.Globalization; ! ! namespace PostgreSql.Data.PgSqlClient ! { ! [Serializable, ! ListBindable(false)] ! public sealed class PgErrorCollection : ICollection, IEnumerable ! { ! #region Fields ! ! private ArrayList errors; ! ! #endregion ! ! #region Properties ! ! public PgError this[string errorMessage] ! { ! get { return (PgError)errors[errors.IndexOf(errorMessage)]; } ! set { errors[errors.IndexOf(errorMessage)] = (PgError)value; } ! } ! ! public PgError this[int errorIndex] ! { ! get { return (PgError)errors[errorIndex]; } ! set { errors[errorIndex] = (PgError)value; } ! } ! ! public int Count ! { ! get { return errors.Count; } ! } ! ! public bool IsSynchronized ! { ! get { return errors.IsSynchronized; } ! } ! ! public object SyncRoot ! { ! get { return errors.SyncRoot; } ! } ! ! #endregion ! ! #region constructors ! ! internal PgErrorCollection() ! { ! errors = new ArrayList(); ! } ! ! #endregion ! ! #region Methods ! ! public IEnumerator GetEnumerator() ! { ! return errors.GetEnumerator(); ! } ! ! public void CopyTo(Array array, int index) ! { ! errors.CopyTo(array, index); ! } ! ! internal PgError Add(PgError error) ! { ! errors.Add(error); ! ! return error; ! } ! ! internal PgError Add(string severity, string message, string code) ! { ! PgError error = new PgError(severity, code, message); ! ! return Add(error); ! } ! ! private bool cultureAwareCompare(string strA, string strB) ! { ! try ! { ! return CultureInfo.CurrentCulture.CompareInfo.Compare(strA, strB, CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth | CompareOptions.IgnoreCase) == 0 ? true : false; ! } ! catch (Exception) ! { ! return strA.ToUpper() == strB.ToUpper() ? true : false; ! } ! } ! ! #endregion ! } ! } Index: PgException.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgException.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PgException.cs 14 Dec 2003 15:06:50 -0000 1.2 --- PgException.cs 9 Feb 2004 14:19:22 -0000 1.3 *************** *** 1,97 **** ! /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ ! * Copyright (C) 2003 Carlos Guzmán Álvarez ! * ! * This library is free software; you can redistribute it and/or ! * modify it under the terms of the GNU Lesser General Public ! * License as published by the Free Software Foundation; either ! * version 2.1 of the License, or (at your option) any later version. ! * ! * This library is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! * Lesser General Public License for more details. ! * ! * You should have received a copy of the GNU Lesser General Public ! * License along with this library; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! ! using System; ! using System.Text; ! using System.ComponentModel; ! using System.Runtime.Serialization; ! using PostgreSql.Data.NPgClient; ! ! namespace PostgreSql.Data.PgSqlClient ! { ! [Serializable] ! public class PgException : Exception ! { ! #region Fields ! ! private PgErrorCollection errors; ! ! #endregion ! ! #region Properties ! ! [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] ! public PgErrorCollection Errors ! { ! get { return errors; } ! } ! ! #endregion ! ! #region Constructors ! ! internal PgException() : base() ! { ! errors = new PgErrorCollection(); ! } ! ! internal PgException(string message) : base(message) ! { ! errors = new PgErrorCollection(); ! } ! ! internal PgException(SerializationInfo info, StreamingContext context) : base(info, context) ! { ! errors = new PgErrorCollection(); ! } ! ! internal PgException(string message, PgClientException ex) : base(message, ex) ! { ! errors = new PgErrorCollection(); ! Source = ex.Source; ! ! getPgExceptionErrors(ex); ! } ! ! #endregion ! ! #region Methods ! ! private void getPgExceptionErrors(PgClientException ex) ! { ! foreach (PgClientError error in ex.Errors) ! { ! PgError newError = new PgError(); ! ! newError.Severity = error.Severity; ! newError.Code = error.Code; ! newError.Message = error.Message; ! newError.Detail = error.Detail; ! newError.Hint = error.Hint; ! newError.Line = error.Line; ! newError.Where = error.Where; ! newError.Position = error.Position; ! newError.Routine = error.Routine; ! ! errors.Add(newError); ! } ! } ! ! #endregion ! } } \ No newline at end of file --- 1,97 ---- ! /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ ! * Copyright (c) 2003-2004 Carlos Guzman Alvarez ! * ! * This library is free software; you can redistribute it and/or ! * modify it under the terms of the GNU Lesser General Public ! * License as published by the Free Software Foundation; either ! * version 2.1 of the License, or (at your option) any later version. ! * ! * This library is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! * Lesser General Public License for more details. ! * ! * You should have received a copy of the GNU Lesser General Public ! * License along with this library; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! ! using System; ! using System.Text; ! using System.ComponentModel; ! using System.Runtime.Serialization; ! using PostgreSql.Data.NPgClient; ! ! namespace PostgreSql.Data.PgSqlClient ! { ! [Serializable] ! public class PgException : Exception ! { ! #region Fields ! ! private PgErrorCollection errors; ! ! #endregion ! ! #region Properties ! ! [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] ! public PgErrorCollection Errors ! { ! get { return errors; } ! } ! ! #endregion ! ! #region Constructors ! ! internal PgException() : base() ! { ! errors = new PgErrorCollection(); ! } ! ! internal PgException(string message) : base(message) ! { ! errors = new PgErrorCollection(); ! } ! ! internal PgException(SerializationInfo info, StreamingContext context) : base(info, context) ! { ! errors = new PgErrorCollection(); ! } ! ! internal PgException(string message, PgClientException ex) : base(message, ex) ! { ! ... [truncated message content] |