[pgsqlclient-checkins] pgsqlclient_10/PostgreSql.Data.PgSqlClient/source PgConnectionPool.cs,1.5,1.6
Status: Inactive
Brought to you by:
carlosga_fb
From: Carlos Guzm?n ?l. <car...@us...> - 2004-04-10 21:49:10
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25168 Modified Files: PgConnectionPool.cs PgDataAdapter.cs PgDataReader.cs PgError.cs PgErrorCollection.cs PgInfoMessageEventArgs.cs PgNotificationEventArgs.cs PgParameter.cs PgParameterCollection.cs PgTransaction.cs Log Message: 2004-04-10 Carlos Guzman Alvarez <car...@te...> * Started cleanup and unification of this keyword usage tasks. Index: PgInfoMessageEventArgs.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgInfoMessageEventArgs.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PgInfoMessageEventArgs.cs 9 Feb 2004 14:19:22 -0000 1.2 --- PgInfoMessageEventArgs.cs 10 Apr 2004 21:35:36 -0000 1.3 *************** *** 23,43 **** namespace PostgreSql.Data.PgSqlClient { public delegate void PgInfoMessageEventHandler(object sender, PgInfoMessageEventArgs e); public sealed class PgInfoMessageEventArgs : EventArgs { private PgErrorCollection errors = new PgErrorCollection(); private string message = String.Empty; public PgErrorCollection Errors { ! get { return errors; } } public string Message { ! get { return message; } } internal PgInfoMessageEventArgs(PgClientException ex) { --- 23,57 ---- namespace PostgreSql.Data.PgSqlClient { + #region Delegates + public delegate void PgInfoMessageEventHandler(object sender, PgInfoMessageEventArgs e); + #endregion + public sealed class PgInfoMessageEventArgs : EventArgs { + #region Fields + private PgErrorCollection errors = new PgErrorCollection(); private string message = String.Empty; + #endregion + + #region Properties + public PgErrorCollection Errors { ! get { return this.errors; } } public string Message { ! get { return this.message; } } + #endregion + + #region Constructors + internal PgInfoMessageEventArgs(PgClientException ex) { *************** *** 58,64 **** newError.Routine = error.Routine; ! errors.Add(newError); } } } } \ No newline at end of file --- 72,80 ---- newError.Routine = error.Routine; ! this.errors.Add(newError); } } + + #endregion } } \ No newline at end of file Index: PgConnectionPool.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgConnectionPool.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PgConnectionPool.cs 8 Mar 2004 15:12:26 -0000 1.5 --- PgConnectionPool.cs 10 Apr 2004 21:35:36 -0000 1.6 *************** *** 26,30 **** internal class PgConnectionPool : MarshalByRefObject { ! #region FIELDS private static ConnectionPool pool = null; --- 26,30 ---- internal class PgConnectionPool : MarshalByRefObject { ! #region Fields private static ConnectionPool pool = null; *************** *** 32,36 **** #endregion ! #region METHODS public static void Init() --- 32,36 ---- #endregion ! #region Methods public static void Init() *************** *** 59,63 **** internal class ConnectionPool { ! #region FIELDS private ArrayList locked; --- 59,63 ---- internal class ConnectionPool { ! #region Fields private ArrayList locked; *************** *** 67,86 **** #endregion ! #region CONSTRUCTORS public ConnectionPool() { ! 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) --- 67,86 ---- #endregion ! #region Constructors public ConnectionPool() { ! this.locked = ArrayList.Synchronized(new ArrayList()); ! this.unlocked = ArrayList.Synchronized(new ArrayList()); ! this.cleanUpThread = new Thread(new ThreadStart(RunCleanUp)); ! this.cleanUpThread.Name = "CleanUp Thread"; ! this.cleanUpThread.Start(); ! this.cleanUpThread.IsBackground = true; } #endregion ! #region Methods public PgDbConnection CheckOut(string connectionString) *************** *** 91,107 **** public PgDbConnection CheckOut(string connectionString, PgDbConnection instance) { ! 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) --- 91,107 ---- public PgDbConnection CheckOut(string connectionString, PgDbConnection instance) { ! PgDbConnection newConnection = null; long now = System.DateTime.Now.Ticks; lock (typeof(PgConnectionPool)) { ! if (this.unlocked.Count > 0) { ! PgDbConnection[] list = new PgDbConnection[this.unlocked.Count]; ! this.unlocked.CopyTo(0, list, 0, list.Length); foreach (PgDbConnection connection in list) { ! if (this.Validate(connection, connectionString)) { if (connection.Lifetime != 0) *************** *** 109,135 **** 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); } } --- 109,135 ---- if ((now - connection.Created) > connection.Lifetime) { ! this.unlocked.Remove(connection); ! this.Expire(connection); } else { ! this.unlocked.Remove(connection); ! this.locked.Add(connection); ! return connection; } } else { ! this.unlocked.Remove(connection); ! this.locked.Add(connection); ! return connection; } } else { ! this.unlocked.Remove(connection); ! this.Expire(connection); } } *************** *** 138,142 **** if (instance == null) { ! newConnection = Create(connectionString); } else --- 138,142 ---- if (instance == null) { ! newConnection = this.Create(connectionString); } else *************** *** 148,155 **** newConnection.Created = System.DateTime.Now.Ticks; ! locked.Add(newConnection); } ! return(newConnection); } --- 148,155 ---- newConnection.Created = System.DateTime.Now.Ticks; ! this.locked.Add(newConnection); } ! return newConnection; } *************** *** 160,165 **** connection.Created = System.DateTime.Now.Ticks; ! locked.Remove(connection); ! unlocked.Add(connection); } } --- 160,165 ---- connection.Created = System.DateTime.Now.Ticks; ! this.locked.Remove(connection); ! this.unlocked.Add(connection); } } *************** *** 171,175 **** while (true) { ! CleanUp(null); Thread.Sleep(interval); --- 171,175 ---- while (true) { ! this.CleanUp(null); Thread.Sleep(interval); *************** *** 197,201 **** { return (connection.ConnectionString == connectionString && ! connection.Verify()); } catch (Exception ex) --- 197,201 ---- { return (connection.ConnectionString == connectionString && ! connection.Verify()); } catch (Exception ex) *************** *** 224,234 **** 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) { --- 224,234 ---- long now = System.DateTime.Now.Ticks; ! lock (this.unlocked.SyncRoot) { ! if (this.unlocked.Count > 0) { ! PgDbConnection[] list = new PgDbConnection[this.unlocked.Count]; ! this.unlocked.CopyTo(0, list, 0, list.Length); ! foreach (PgDbConnection connection in list) { *************** *** 237,242 **** if ((now - connection.Created) >= connection.Lifetime) { ! unlocked.Remove(connection); ! Expire(connection); } } --- 237,242 ---- if ((now - connection.Created) >= connection.Lifetime) { ! this.unlocked.Remove(connection); ! this.Expire(connection); } } Index: PgError.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgError.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PgError.cs 9 Feb 2004 14:19:22 -0000 1.3 --- PgError.cs 10 Apr 2004 21:35:36 -0000 1.4 *************** *** 43,102 **** 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; } } --- 43,102 ---- public string Severity { ! get { return this.severity; } ! set { this.severity = value; } } public string Message { ! get { return this.message; } ! set { this.message = value; } } public string Code { ! get { return this.code; } ! set { this.code = value; } } public string Detail { ! get { return this.detail; } ! set { this.detail = value; } } public string Hint { ! get { return this.hint; } ! set { this.hint = value; } } public string Where { ! get { return this.where; } ! set { this.where = value; } } public string Position { ! get { return this.position; } ! set { this.position = value; } } public string File { ! get { return this.file; } ! set { this.file = value; } } public int Line { ! get { return this.line; } ! set { this.line = value; } } public string Routine { ! get { return this.routine; } ! set { this.routine = value; } } Index: PgDataReader.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgDataReader.cs,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** PgDataReader.cs 6 Apr 2004 14:18:15 -0000 1.21 --- PgDataReader.cs 10 Apr 2004 21:35:36 -0000 1.22 *************** *** 125,142 **** public bool IsClosed { ! get { return !open; } } public int RecordsAffected { ! get { return IsClosed ? recordsAffected : -1; } } public bool HasRows { ! get ! { ! return command.Statement.HasRows; ! } } --- 125,139 ---- public bool IsClosed { ! get { return !this.open; } } public int RecordsAffected { ! get { return this.IsClosed ? this.recordsAffected : -1; } } public bool HasRows { ! get { return this.command.Statement.HasRows; } } *************** *** 203,207 **** if ((this.behavior == CommandBehavior.SingleRow && ! this.position != STARTPOS) || !this.command.Statement.HasRows) { --- 200,204 ---- if ((this.behavior == CommandBehavior.SingleRow && ! this.position != STARTPOS) || !this.command.Statement.HasRows) { *************** *** 215,219 **** this.position++; ! row = command.Statement.FetchRow(); read = (this.row == null) ? false : true; --- 212,216 ---- this.position++; ! row = this.command.Statement.FetchRow(); read = (this.row == null) ? false : true; *************** *** 725,734 **** public IDataReader GetData(int i) { ! if (position == STARTPOS) ! { ! throw new InvalidOperationException("There are no data to read."); ! } ! ! return getData(i); } --- 722,726 ---- public IDataReader GetData(int i) { ! throw new NotSupportedException(); } *************** *** 770,778 **** } - private IDataReader getData(int i) - { - return null; - } - private int getOrdinal(string name) { --- 762,765 ---- *************** *** 812,851 **** private Type getFieldType(int i) { ! return command.Statement.RowDescriptor.Fields[i].DataType.SystemType; } private PgDbType getProviderType(int i) { ! return (PgDbType)command.Statement.RowDescriptor.Fields[i].DataType.DataType; } private string getDataTypeName(int i) { ! return command.Statement.RowDescriptor.Fields[i].DataType.Name; } private object getValue(int i) { ! return row[i]; } private bool isNumeric(int i) { ! if (i < 0 || i >= FieldCount) { throw new IndexOutOfRangeException("Could not find specified column in results."); } ! return command.Statement.RowDescriptor.Fields[i].DataType.IsNumeric(); } private bool isLong(int i) { ! if (i < 0 || i >= FieldCount) { throw new IndexOutOfRangeException("Could not find specified column in results."); } ! return command.Statement.RowDescriptor.Fields[i].DataType.IsLong(); } --- 799,838 ---- private Type getFieldType(int i) { ! return this.command.Statement.RowDescriptor.Fields[i].DataType.SystemType; } private PgDbType getProviderType(int i) { ! return (PgDbType)this.command.Statement.RowDescriptor.Fields[i].DataType.DataType; } private string getDataTypeName(int i) { ! return this.command.Statement.RowDescriptor.Fields[i].DataType.Name; } private object getValue(int i) { ! return this.row[i]; } private bool isNumeric(int i) { ! if (i < 0 || i >= this.FieldCount) { throw new IndexOutOfRangeException("Could not find specified column in results."); } ! return this.command.Statement.RowDescriptor.Fields[i].DataType.IsNumeric(); } private bool isLong(int i) { ! if (i < 0 || i >= this.FieldCount) { throw new IndexOutOfRangeException("Could not find specified column in results."); } ! return this.command.Statement.RowDescriptor.Fields[i].DataType.IsLong(); } *************** *** 854,858 **** bool returnValue = false; ! if (row[i] == System.DBNull.Value) { returnValue = true; --- 841,845 ---- bool returnValue = false; ! if (this.row[i] == System.DBNull.Value) { returnValue = true; *************** *** 872,877 **** bool returnValue = false; ! if (command.Statement.RowDescriptor.Fields[i].OidNumber == 0 && ! command.Statement.RowDescriptor.Fields[i].OidTable == 0) { returnValue = true; --- 859,864 ---- bool returnValue = false; ! if (this.command.Statement.RowDescriptor.Fields[i].OidNumber == 0 && ! this.command.Statement.RowDescriptor.Fields[i].OidTable == 0) { returnValue = true; *************** *** 915,920 **** if (this.command.RecordsAffected != -1) { ! this.recordsAffected = ! this.recordsAffected == -1 ? 0 : this.recordsAffected; this.recordsAffected += this.command.RecordsAffected; } --- 902,906 ---- if (this.command.RecordsAffected != -1) { ! this.recordsAffected = this.recordsAffected == -1 ? 0 : this.recordsAffected; this.recordsAffected += this.command.RecordsAffected; } Index: PgErrorCollection.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgErrorCollection.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PgErrorCollection.cs 6 Mar 2004 14:51:23 -0000 1.5 --- PgErrorCollection.cs 10 Apr 2004 21:35:36 -0000 1.6 *************** *** 38,73 **** 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(); } --- 38,73 ---- public PgError this[string errorMessage] { ! get { return (PgError)this.errors[errors.IndexOf(errorMessage)]; } ! set { this.errors[errors.IndexOf(errorMessage)] = (PgError)value; } } public PgError this[int errorIndex] { ! get { return (PgError)this.errors[errorIndex]; } ! set { this.errors[errorIndex] = (PgError)value; } } public int Count { ! get { return this.errors.Count; } } public bool IsSynchronized { ! get { return this.errors.IsSynchronized; } } public object SyncRoot { ! get { return this.errors.SyncRoot; } } #endregion ! #region Constructors internal PgErrorCollection() { ! this.errors = new ArrayList(); } *************** *** 83,92 **** public void CopyTo(Array array, int index) { ! errors.CopyTo(array, index); } internal PgError Add(PgError error) { ! errors.Add(error); return error; --- 83,92 ---- public void CopyTo(Array array, int index) { ! this.errors.CopyTo(array, index); } internal PgError Add(PgError error) { ! this.errors.Add(error); return error; *************** *** 97,101 **** PgError error = new PgError(severity, code, message); ! return Add(error); } --- 97,101 ---- PgError error = new PgError(severity, code, message); ! return this.Add(error); } Index: PgParameterCollection.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgParameterCollection.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PgParameterCollection.cs 6 Mar 2004 14:51:23 -0000 1.7 --- PgParameterCollection.cs 10 Apr 2004 21:35:36 -0000 1.8 *************** *** 53,58 **** object IList.this[int parameterIndex] { ! get { return (PgParameter)parameters[parameterIndex]; } ! set { parameters[parameterIndex] = (PgParameter)value; } } --- 53,58 ---- object IList.this[int parameterIndex] { ! get { return (PgParameter)this.parameters[parameterIndex]; } ! set { this.parameters[parameterIndex] = (PgParameter)value; } } *************** *** 61,66 **** public PgParameter this[int parameterIndex] { ! get { return (PgParameter)parameters[parameterIndex]; } ! set { parameters[parameterIndex] = (PgParameter)value; } } --- 61,66 ---- public PgParameter this[int parameterIndex] { ! get { return (PgParameter)this.parameters[parameterIndex]; } ! set { this.parameters[parameterIndex] = (PgParameter)value; } } *************** *** 75,93 **** #endregion ! #region ILIST_PROPERTIES bool IList.IsFixedSize { ! get { return parameters.IsFixedSize; } } bool IList.IsReadOnly { ! get { return parameters.IsReadOnly; } } #endregion ! #region ICOLLECTION_PROPERTIES [Browsable(false), --- 75,93 ---- #endregion ! #region IList Properties bool IList.IsFixedSize { ! get { return this.parameters.IsFixedSize; } } bool IList.IsReadOnly { ! get { return this.parameters.IsReadOnly; } } #endregion ! #region ICollection Properties [Browsable(false), *************** *** 95,136 **** public int Count { ! get { return parameters.Count; } } bool ICollection.IsSynchronized { ! get { return parameters.IsSynchronized; } } object ICollection.SyncRoot { ! get { return parameters.SyncRoot; } } #endregion ! #region ICOLLECTION_METHODS public void CopyTo(Array array, int index) { ! parameters.CopyTo(array, index); } #endregion ! #region ILIST_METHODS public void Clear() { ! parameters.Clear(); } #endregion ! #region IENUMERABLE_METHODS public IEnumerator GetEnumerator() { ! return parameters.GetEnumerator(); } --- 95,136 ---- public int Count { ! get { return this.parameters.Count; } } bool ICollection.IsSynchronized { ! get { return this.parameters.IsSynchronized; } } object ICollection.SyncRoot { ! get { return this.parameters.SyncRoot; } } #endregion ! #region ICollection Methods public void CopyTo(Array array, int index) { ! this.parameters.CopyTo(array, index); } #endregion ! #region IList Methods public void Clear() { ! this.parameters.Clear(); } #endregion ! #region IEnumerable Methods public IEnumerator GetEnumerator() { ! return this.parameters.GetEnumerator(); } *************** *** 141,155 **** public bool Contains(object value) { ! return parameters.Contains(value); } public bool Contains(string parameterName) { ! return(-1 != IndexOf(parameterName)); } public int IndexOf(object value) { ! return parameters.IndexOf(value); } --- 141,155 ---- public bool Contains(object value) { ! return this.parameters.Contains(value); } public bool Contains(string parameterName) { ! return (-1 != this.IndexOf(parameterName)); } public int IndexOf(object value) { ! return this.parameters.IndexOf(value); } *************** *** 160,167 **** foreach (PgParameter item in this.parameters) { ! if (cultureAwareCompare(item.ParameterName, parameterName)) { return index; } index++; } --- 160,168 ---- foreach (PgParameter item in this.parameters) { ! if (this.cultureAwareCompare(item.ParameterName, parameterName)) { return index; } + index++; } *************** *** 172,176 **** public void Insert(int index, object value) { ! parameters.Insert(index, value); } --- 173,177 ---- public void Insert(int index, object value) { ! this.parameters.Insert(index, value); } *************** *** 182,191 **** } ! if (!Contains(value)) { throw new SystemException("The parameter does not exist in the collection."); } ! parameters.Remove(value); } --- 183,192 ---- } ! if (!this.Contains(value)) { throw new SystemException("The parameter does not exist in the collection."); } ! this.parameters.Remove(value); } *************** *** 197,201 **** public void RemoveAt(string parameterName) { ! RemoveAt(IndexOf(parameterName)); } --- 198,202 ---- public void RemoveAt(string parameterName) { ! this.RemoveAt(IndexOf(parameterName)); } *************** *** 207,211 **** } ! return parameters.Add((PgParameter)value); } --- 208,212 ---- } ! return this.parameters.Add((PgParameter)value); } *************** *** 214,218 **** if (param.ParameterName != null) { ! parameters.Add(param); return param; --- 215,219 ---- if (param.ParameterName != null) { ! this.parameters.Add(param); return param; Index: PgNotificationEventArgs.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgNotificationEventArgs.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PgNotificationEventArgs.cs 9 Feb 2004 14:19:22 -0000 1.2 --- PgNotificationEventArgs.cs 10 Apr 2004 21:35:36 -0000 1.3 *************** *** 23,49 **** namespace PostgreSql.Data.PgSqlClient { public delegate void PgNotificationEventHandler(object sender, PgNotificationEventArgs e); public sealed class PgNotificationEventArgs : EventArgs { private int processID; private string condition; private string aditional; public int ProcessID { ! get { return processID; } } public string Condition { ! get { return condition; } } public string Aditional { ! get { return aditional; } } internal PgNotificationEventArgs(int processID, string condition, string addtional) { --- 23,63 ---- namespace PostgreSql.Data.PgSqlClient { + #region Delegates + public delegate void PgNotificationEventHandler(object sender, PgNotificationEventArgs e); + #endregion + public sealed class PgNotificationEventArgs : EventArgs { + #region Fields + private int processID; private string condition; private string aditional; + #endregion + + #region Properties + public int ProcessID { ! get { return this.processID; } } public string Condition { ! get { return this.condition; } } public string Aditional { ! get { return this.aditional; } } + #endregion + + #region Constructors + internal PgNotificationEventArgs(int processID, string condition, string addtional) { *************** *** 52,55 **** --- 66,71 ---- this.aditional = aditional; } + + #endregion } } Index: PgParameter.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgParameter.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** PgParameter.cs 9 Feb 2004 14:19:22 -0000 1.11 --- PgParameter.cs 10 Apr 2004 21:35:36 -0000 1.12 *************** *** 41,45 **** int size; PgDbType pgDbType; ! bool defaultCtor; #endregion --- 41,45 ---- int size; PgDbType pgDbType; ! bool inferType; #endregion *************** *** 49,54 **** string IDataParameter.ParameterName { ! get { return ParameterName; } ! set { ParameterName = value; } } --- 49,54 ---- string IDataParameter.ParameterName { ! get { return this.ParameterName; } ! set { this.ParameterName = value; } } *************** *** 56,61 **** public string ParameterName { ! get { return parameterName; } ! set { parameterName = value; } } --- 56,61 ---- public string ParameterName { ! get { return this.parameterName; } ! set { this.parameterName = value; } } *************** *** 63,68 **** public byte Precision { ! get { return precision; } ! set { precision = value; } } --- 63,68 ---- public byte Precision { ! get { return this.precision; } ! set { this.precision = value; } } *************** *** 70,75 **** public byte Scale { ! get { return scale; } ! set { scale = value; } } --- 70,75 ---- public byte Scale { ! get { return this.scale; } ! set { this.scale = value; } } *************** *** 77,82 **** public int Size { ! get { return size; } ! set { size = value; } } --- 77,82 ---- public int Size { ! get { return this.size; } ! set { this.size = value; } } *************** *** 87,92 **** public DbType DbType { ! get { return PgDbTypeToDbType(pgDbType); } ! set { pgDbType = dbTypeToPgType(value); } } --- 87,92 ---- public DbType DbType { ! get { return this.PgDbTypeToDbType(this.pgDbType); } ! set { this.pgDbType = this.dbTypeToPgType(value); } } *************** *** 96,101 **** public PgDbType PgDbType { ! get { return pgDbType; } ! set { pgDbType = value; } } --- 96,104 ---- public PgDbType PgDbType { ! get { return this.pgDbType; } ! set ! { ! this.pgDbType = value; ! } } *************** *** 103,108 **** public ParameterDirection Direction { ! get { return direction; } ! set { direction = value; } } --- 106,111 ---- public ParameterDirection Direction { ! get { return this.direction; } ! set { this.direction = value; } } *************** *** 113,118 **** public bool IsNullable { ! get { return isNullable; } ! set { isNullable = value; } } --- 116,121 ---- public bool IsNullable { ! get { return this.isNullable; } ! set { this.isNullable = value; } } *************** *** 120,125 **** public string SourceColumn { ! get { return sourceColumn; } ! set { sourceColumn = value; } } --- 123,128 ---- public string SourceColumn { ! get { return this.sourceColumn; } ! set { this.sourceColumn = value; } } *************** *** 127,132 **** public DataRowVersion SourceVersion { ! get { return sourceVersion; } ! set { sourceVersion = value; } } --- 130,135 ---- public DataRowVersion SourceVersion { ! get { return this.sourceVersion; } ! set { this.sourceVersion = value; } } *************** *** 144,150 **** } this.value = value; ! if (defaultCtor) { ! setPgTypeFromValue(this.value); } } --- 147,153 ---- } this.value = value; ! if (this.inferType) { ! this.setPgTypeFromValue(this.value); } } *************** *** 161,170 **** this.isNullable = false; this.pgDbType = PgDbType.VarChar; ! this.defaultCtor = true; } public PgParameter(string parameterName, object value) : this() { ! this.defaultCtor = false; this.parameterName = parameterName; this.value = value; --- 164,173 ---- this.isNullable = false; this.pgDbType = PgDbType.VarChar; ! this.inferType = true; } public PgParameter(string parameterName, object value) : this() { ! this.inferType = false; this.parameterName = parameterName; this.value = value; *************** *** 173,177 **** public PgParameter(string parameterName, PgDbType dbType) : this() { ! this.defaultCtor = false; this.parameterName = parameterName; this.pgDbType = dbType; --- 176,180 ---- public PgParameter(string parameterName, PgDbType dbType) : this() { ! this.inferType = false; this.parameterName = parameterName; this.pgDbType = dbType; *************** *** 180,184 **** public PgParameter(string parameterName, PgDbType dbType, int size) : this() { ! this.defaultCtor = false; this.parameterName = parameterName; this.pgDbType = dbType; --- 183,187 ---- public PgParameter(string parameterName, PgDbType dbType, int size) : this() { ! this.inferType = false; this.parameterName = parameterName; this.pgDbType = dbType; *************** *** 186,192 **** } ! public PgParameter(string parameterName, PgDbType dbType, int size, string sourceColumn) : this() { ! this.defaultCtor = false; this.parameterName = parameterName; this.pgDbType = dbType; --- 189,199 ---- } ! public PgParameter( ! string parameterName, ! PgDbType dbType, ! int size, ! string sourceColumn) : this() { ! this.inferType = false; this.parameterName = parameterName; this.pgDbType = dbType; *************** *** 196,211 **** [EditorBrowsable(EditorBrowsableState.Advanced)] ! public PgParameter(string parameterName, ! PgDbType dbType, ! int size, ! ParameterDirection direction, ! bool isNullable, ! byte precision, ! byte scale, ! string sourceColumn, ! DataRowVersion sourceVersion, ! object value) { ! this.defaultCtor = false; this.parameterName = parameterName; this.pgDbType = dbType; --- 203,219 ---- [EditorBrowsable(EditorBrowsableState.Advanced)] ! public PgParameter( ! string parameterName, ! PgDbType dbType, ! int size, ! ParameterDirection direction, ! bool isNullable, ! byte precision, ! byte scale, ! string sourceColumn, ! DataRowVersion sourceVersion, ! object value) { ! this.inferType = false; this.parameterName = parameterName; this.pgDbType = dbType; *************** *** 226,239 **** object ICloneable.Clone() { ! return new PgParameter(parameterName, ! PgDbType, ! size, ! direction, ! isNullable, ! precision, ! scale, ! sourceColumn, ! sourceVersion, ! value); } --- 234,248 ---- object ICloneable.Clone() { ! return new PgParameter( ! this.parameterName, ! this.PgDbType, ! this.size, ! this.direction, ! this.isNullable, ! this.precision, ! this.scale, ! this.sourceColumn, ! this.sourceVersion, ! this.value); } *************** *** 388,396 **** { case TypeCode.Byte: ! PgDbType = PgDbType.Byte; break; case TypeCode.Boolean: ! PgDbType = PgDbType.Boolean; break; --- 397,405 ---- { case TypeCode.Byte: ! this.pgDbType = PgDbType.Byte; break; case TypeCode.Boolean: ! this.pgDbType = PgDbType.Boolean; break; *************** *** 401,433 **** case TypeCode.String: case TypeCode.Char: ! PgDbType = PgDbType.Char; break; case TypeCode.Int16: ! PgDbType = PgDbType.Int2; break; case TypeCode.Int32: ! PgDbType = PgDbType.Int4; break; case TypeCode.Int64: ! PgDbType = PgDbType.Int8; break; case TypeCode.Single: ! PgDbType = PgDbType.Float; break; case TypeCode.Double: ! PgDbType = PgDbType.Double; break; case TypeCode.Decimal: ! PgDbType = PgDbType.Decimal; break; case TypeCode.DateTime: ! PgDbType = PgDbType.Timestamp; break; --- 410,442 ---- case TypeCode.String: case TypeCode.Char: ! this.pgDbType = PgDbType.Char; break; case TypeCode.Int16: ! this.pgDbType = PgDbType.Int2; break; case TypeCode.Int32: ! this.pgDbType = PgDbType.Int4; break; case TypeCode.Int64: ! this.pgDbType = PgDbType.Int8; break; case TypeCode.Single: ! this.pgDbType = PgDbType.Float; break; case TypeCode.Double: ! this.pgDbType = PgDbType.Double; break; case TypeCode.Decimal: ! this.pgDbType = PgDbType.Decimal; break; case TypeCode.DateTime: ! this.pgDbType = PgDbType.Timestamp; break; *************** *** 447,451 **** private DbType PgDbTypeToDbType(PgDbType PgDbType) { ! switch(PgDbType) { case PgDbType.Boolean: --- 456,460 ---- private DbType PgDbTypeToDbType(PgDbType PgDbType) { ! switch(this.pgDbType) { case PgDbType.Boolean: Index: PgDataAdapter.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgDataAdapter.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PgDataAdapter.cs 9 Feb 2004 14:19:22 -0000 1.6 --- PgDataAdapter.cs 10 Apr 2004 21:35:36 -0000 1.7 *************** *** 26,30 **** namespace PostgreSql.Data.PgSqlClient { ! #region DELEGATES public delegate void PgRowUpdatedEventHandler(object sender, PgRowUpdatedEventArgs e); --- 26,30 ---- namespace PostgreSql.Data.PgSqlClient { ! #region Delegates public delegate void PgRowUpdatedEventHandler(object sender, PgRowUpdatedEventArgs e); *************** *** 59,82 **** 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; } } --- 59,82 ---- IDbCommand IDbDataAdapter.SelectCommand { ! get { return this.selectCommand; } ! set { this.selectCommand = (PgCommand)value; } } IDbCommand IDbDataAdapter.InsertCommand { ! get { return this.insertCommand; } ! set { this.insertCommand = (PgCommand)value; } } IDbCommand IDbDataAdapter.UpdateCommand { ! get { return this.updateCommand; } ! set { this.updateCommand = (PgCommand)value; } } IDbCommand IDbDataAdapter.DeleteCommand { ! get { return this.deleteCommand; } ! set { this.deleteCommand = (PgCommand)value; } } *************** *** 84,89 **** public PgCommand SelectCommand { ! get { return selectCommand; } ! set { selectCommand = value; } } --- 84,89 ---- public PgCommand SelectCommand { ! get { return this.selectCommand; } ! set { this.selectCommand = value; } } *************** *** 91,96 **** public PgCommand InsertCommand { ! get { return insertCommand; } ! set { insertCommand = value; } } --- 91,96 ---- public PgCommand InsertCommand { ! get { return this.insertCommand; } ! set { this.insertCommand = value; } } *************** *** 98,103 **** public PgCommand UpdateCommand { ! get { return updateCommand; } ! set { updateCommand = value; } } --- 98,103 ---- public PgCommand UpdateCommand { ! get { return this.updateCommand; } ! set { this.updateCommand = value; } } *************** *** 105,110 **** public PgCommand DeleteCommand { ! get { return deleteCommand; } ! set { deleteCommand = value; } } --- 105,110 ---- public PgCommand DeleteCommand { ! get { return this.deleteCommand; } ! set { this.deleteCommand = value; } } *************** *** 145,159 **** if (disposing) { ! if (selectCommand != null) { ! selectCommand.Dispose(); } ! if (insertCommand != null) { ! insertCommand.Dispose(); } ! if (updateCommand != null) { ! updateCommand.Dispose(); } } --- 145,159 ---- if (disposing) { ! if (this.selectCommand != null) { ! this.selectCommand.Dispose(); } ! if (this.insertCommand != null) { ! this.insertCommand.Dispose(); } ! if (this.updateCommand != null) { ! this.updateCommand.Dispose(); } } Index: PgTransaction.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgTransaction.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PgTransaction.cs 9 Feb 2004 14:19:22 -0000 1.6 --- PgTransaction.cs 10 Apr 2004 21:35:36 -0000 1.7 *************** *** 40,44 **** IDbConnection IDbTransaction.Connection { ! get { return Connection; } } --- 40,44 ---- IDbConnection IDbTransaction.Connection { ! get { return this.Connection; } } *************** *** 60,78 **** public IsolationLevel IsolationLevel { ! get { return isolationLevel; } } internal bool IsUpdated { ! get { return isUpdated; } set { ! if (connection != null && ! value) { ! connection.ActiveTransaction = null; ! connection = null; } ! isUpdated = value; } } --- 60,77 ---- public IsolationLevel IsolationLevel { ! get { return this.isolationLevel; } } internal bool IsUpdated { ! get { return this.isUpdated; } set { ! if (this.connection != null && value) { ! this.connection.ActiveTransaction = null; ! this.connection = null; } ! this.isUpdated = value; } } *************** *** 84,88 **** private PgTransaction() { ! isolationLevel = IsolationLevel.ReadCommitted; } --- 83,87 ---- private PgTransaction() { ! this.isolationLevel = IsolationLevel.ReadCommitted; } *************** *** 118,122 **** private void Dispose(bool disposing) { ! if (!disposed) { if (disposing) --- 117,121 ---- private void Dispose(bool disposing) { ! if (!this.disposed) { if (disposing) *************** *** 124,128 **** try { ! if (connection != null && !isUpdated) { // Implicitly roll back if the transaction still valid. --- 123,127 ---- try { ! if (this.connection != null && !this.isUpdated) { // Implicitly roll back if the transaction still valid. *************** *** 132,142 **** finally { ! if (connection != null) { ! connection.ActiveTransaction = null; ! connection = null; } ! disposed = true; ! isUpdated = true; } } --- 131,141 ---- finally { ! if (this.connection != null) { ! this.connection.ActiveTransaction = null; ! this.connection = null; } ! this.disposed = true; ! this.isUpdated = true; } } *************** *** 150,158 **** public void Commit() { ! if (isUpdated) { throw new InvalidOperationException("This Transaction has completed; it is no longer usable."); } ! if (Connection.DataReader != null) { throw new InvalidOperationException("PgCommand is currently busy Open, Fetching."); --- 149,157 ---- public void Commit() { ! if (this.isUpdated) { throw new InvalidOperationException("This Transaction has completed; it is no longer usable."); } ! if (this.Connection.DataReader != null) { throw new InvalidOperationException("PgCommand is currently busy Open, Fetching."); *************** *** 161,167 **** try { ! connection.DbConnection.DB.CommitTransaction(); ! IsUpdated = true; } catch (PgClientException ex) --- 160,166 ---- try { ! this.connection.DbConnection.DB.CommitTransaction(); ! this.IsUpdated = true; } catch (PgClientException ex) *************** *** 173,181 **** public void Rollback() { ! if (isUpdated) { throw new InvalidOperationException("This Transaction has completed; it is no longer usable."); } ! if (Connection.DataReader != null) { throw new InvalidOperationException("PgCommand is currently busy Open, Fetching."); --- 172,180 ---- public void Rollback() { ! if (this.isUpdated) { throw new InvalidOperationException("This Transaction has completed; it is no longer usable."); } ! if (this.Connection.DataReader != null) { throw new InvalidOperationException("PgCommand is currently busy Open, Fetching."); *************** *** 184,190 **** try { ! connection.DbConnection.DB.RollbackTransction(); ! IsUpdated = true; } catch (PgClientException ex) --- 183,189 ---- try { ! this.connection.DbConnection.DB.RollbackTransction(); ! this.IsUpdated = true; } catch (PgClientException ex) *************** *** 198,204 **** try { ! connection.DbConnection.DB.BeginTransaction(isolationLevel); ! IsUpdated = false; } catch (PgClientException ex) --- 197,203 ---- try { ! this.connection.DbConnection.DB.BeginTransaction(isolationLevel); ! this.IsUpdated = false; } catch (PgClientException ex) |