[pgsqlclient-checkins] pgsqlclient_10/PostgreSql.Data.PgSqlClient/source PgCommand.cs,1.32,1.33 PgCo
Status: Inactive
Brought to you by:
carlosga_fb
From: Carlos Guzm?n ?l. <car...@us...> - 2004-04-01 16:53:39
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22247 Modified Files: PgCommand.cs PgCommandBuilder.cs PgDataReader.cs Log Message: 2004-04-1 Carlos Guzman Alvarez <car...@te...> * PostgreSql.Data.PgSqlClient/PgCommandBuilder.cs: * PostgreSql.Data.PgSqlClient/PgDataReader.cs: * PostgreSql.Data.PgSqlClient/PgCommand.cs: - Improved implementations of Command, Command builder and Data reader classes. Index: PgCommand.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgCommand.cs,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** PgCommand.cs 23 Mar 2004 15:53:41 -0000 1.32 --- PgCommand.cs 1 Apr 2004 16:41:29 -0000 1.33 *************** *** 382,386 **** this.checkCommand(); ! commandBehavior = behavior; this.splitBatchCommands(true); --- 382,386 ---- this.checkCommand(); ! this.commandBehavior = behavior; this.splitBatchCommands(true); *************** *** 468,474 **** internal void InternalPrepare() { ! if (commands == null) { ! splitBatchCommands(false); } --- 468,474 ---- internal void InternalPrepare() { ! if (this.commands == null) { ! this.splitBatchCommands(false); } *************** *** 479,485 **** this.statement.Status == PgStatementStatus.Error) { ! if (commandType == CommandType.StoredProcedure) { ! commands[actualCommand] = parseSPCommandText(); } --- 479,485 ---- this.statement.Status == PgStatementStatus.Error) { ! if (this.commandType == CommandType.StoredProcedure) { ! this.commands[actualCommand] = parseSPCommandText(); } *************** *** 514,521 **** try { ! if (parameters.Count != 0) { // Set parameter values ! setParameterValues(); } --- 514,521 ---- try { ! if (this.parameters.Count != 0) { // Set parameter values ! this.setParameterValues(); } Index: PgDataReader.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgDataReader.cs,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** PgDataReader.cs 9 Mar 2004 12:39:36 -0000 1.19 --- PgDataReader.cs 1 Apr 2004 16:41:29 -0000 1.20 *************** *** 61,67 **** internal PgDataReader(PgCommand command, PgConnection connection) : this() { ! this.command = command; ! this.behavior = this.command.CommandBehavior; ! this.connection = connection; } --- 61,69 ---- internal PgDataReader(PgCommand command, PgConnection connection) : this() { ! this.command = command; ! this.behavior = this.command.CommandBehavior; ! this.connection = connection; ! this.connection.DataReader = this; ! this.fieldCount = this.command.Statement.RowDescriptor.Fields.Length; } *************** *** 380,389 **** public object this[int i] { ! get { return GetValue(i); } } public object this[string name] { ! get { return GetValue(GetOrdinal(name)); } } --- 382,391 ---- public object this[int i] { ! get { return this.GetValue(i); } } public object this[string name] { ! get { return this.GetValue(this.GetOrdinal(name)); } } *************** *** 399,403 **** public String GetName(int i) { - this.checkPosition(); this.checkIndex(i); --- 401,404 ---- *************** *** 408,412 **** public String GetDataTypeName(int i) { - this.checkPosition(); this.checkIndex(i); --- 409,412 ---- *************** *** 416,420 **** public Type GetFieldType(int i) { - this.checkPosition(); this.checkIndex(i); --- 416,419 ---- *************** *** 444,450 **** public int GetOrdinal(string name) { ! this.checkPosition(); ! return getOrdinal(name); } --- 443,452 ---- public int GetOrdinal(string name) { ! if (this.IsClosed) ! { ! throw new InvalidOperationException("Reader closed"); ! } ! return this.getOrdinal(name); } *************** *** 454,458 **** this.checkIndex(i); ! return Convert.ToBoolean(GetValue(i)); } --- 456,460 ---- this.checkIndex(i); ! return Convert.ToBoolean(this.GetValue(i)); } *************** *** 462,466 **** this.checkIndex(i); ! return Convert.ToByte(GetValue(i)); } --- 464,468 ---- this.checkIndex(i); ! return Convert.ToByte(this.GetValue(i)); } *************** *** 516,520 **** this.checkIndex(i); ! return Convert.ToChar(GetValue(i)); } --- 518,522 ---- this.checkIndex(i); ! return Convert.ToChar(this.GetValue(i)); } *************** *** 578,582 **** this.checkIndex(i); ! return Convert.ToInt16(GetValue(i)); } --- 580,584 ---- this.checkIndex(i); ! return Convert.ToInt16(this.GetValue(i)); } *************** *** 586,590 **** this.checkIndex(i); ! return Convert.ToInt32(GetValue(i)); } --- 588,592 ---- this.checkIndex(i); ! return Convert.ToInt32(this.GetValue(i)); } *************** *** 594,598 **** this.checkIndex(i); ! return Convert.ToInt64(GetValue(i)); } --- 596,600 ---- this.checkIndex(i); ! return Convert.ToInt64(this.GetValue(i)); } *************** *** 602,606 **** this.checkIndex(i); ! return Convert.ToSingle(GetValue(i)); } --- 604,608 ---- this.checkIndex(i); ! return Convert.ToSingle(this.GetValue(i)); } *************** *** 610,614 **** this.checkIndex(i); ! return Convert.ToDouble(GetValue(i)); } --- 612,616 ---- this.checkIndex(i); ! return Convert.ToDouble(this.GetValue(i)); } *************** *** 618,622 **** this.checkIndex(i); ! return Convert.ToString(GetValue(i)); } --- 620,624 ---- this.checkIndex(i); ! return Convert.ToString(this.GetValue(i)); } *************** *** 626,630 **** this.checkIndex(i); ! return Convert.ToDecimal(GetValue(i)); } --- 628,632 ---- this.checkIndex(i); ! return Convert.ToDecimal(this.GetValue(i)); } *************** *** 634,638 **** this.checkIndex(i); ! return Convert.ToDateTime(GetValue(i)); } --- 636,640 ---- this.checkIndex(i); ! return Convert.ToDateTime(this.GetValue(i)); } Index: PgCommandBuilder.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgCommandBuilder.cs,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** PgCommandBuilder.cs 23 Mar 2004 15:05:47 -0000 1.19 --- PgCommandBuilder.cs 1 Apr 2004 16:41:29 -0000 1.20 *************** *** 137,145 **** this.sqlDelete = "DELETE FROM {0} WHERE ( {1} )"; this.whereClausule1 = "(({0} IS NULL AND ${1} = NULL) OR ({0} = ${2}))"; ! this.whereClausule2 = "({0} = ${1})"; ! this.setClausule = "{0} = ${1}"; this.separator = ", "; ! this.quotePrefix = String.Empty; ! this.quoteSuffix = String.Empty; GC.SuppressFinalize(this); --- 137,147 ---- this.sqlDelete = "DELETE FROM {0} WHERE ( {1} )"; this.whereClausule1 = "(({0} IS NULL AND ${1} = NULL) OR ({0} = ${2}))"; ! // this.whereClausule2 = "({0} = ${1})"; ! // this.setClausule = "{0} = ${1}"; ! this.whereClausule2 = "({0} = {1})"; ! this.setClausule = "{0} = {1}"; this.separator = ", "; ! this.quotePrefix = String.Empty; ! this.quoteSuffix = String.Empty; GC.SuppressFinalize(this); *************** *** 165,171 **** --- 167,179 ---- this.RefreshSchema(); + if (this.adapterHandler != null) + { + this.dataAdapter.RowUpdating -= this.adapterHandler; + } + this.sqlInsert = null; this.sqlUpdate = null; this.sqlDelete = null; + this.whereClausule1 = null; this.whereClausule2 = null; this.setClausule = null; *************** *** 318,322 **** // Create a new command ! this.createCommand(ref this.deleteCommand); int i = 1; --- 326,330 ---- // Create a new command ! this.createCommand(ref this.insertCommand); int i = 1; *************** *** 401,412 **** } // Build Field name and append it to the string sets.AppendFormat( this.setClausule, this.getQuotedIdentifier(schemaRow["BaseColumnName"]), ! i); ! ! PgParameter parameter = this.createParameter(schemaRow, i, false); ! if (row != null && tableMapping != null) { --- 409,420 ---- } + PgParameter parameter = this.createParameter(schemaRow, i, false); + // Build Field name and append it to the string sets.AppendFormat( this.setClausule, this.getQuotedIdentifier(schemaRow["BaseColumnName"]), ! parameter.ParameterName); ! if (row != null && tableMapping != null) { *************** *** 442,446 **** PgParameter parameter = this.createParameter(schemaRow, i, true); ! where.AppendFormat(this.whereClausule2, quotedId, i); if (row != null && tableMapping != null) --- 450,457 ---- PgParameter parameter = this.createParameter(schemaRow, i, true); ! where.AppendFormat( ! this.whereClausule2, ! quotedId, ! parameter.ParameterName); if (row != null && tableMapping != null) *************** *** 505,509 **** PgParameter parameter = this.createParameter(schemaRow, i, true); ! where.AppendFormat(this.whereClausule2, quotedId, i); if (row != null && tableMapping != null) --- 516,523 ---- PgParameter parameter = this.createParameter(schemaRow, i, true); ! where.AppendFormat( ! this.whereClausule2, ! quotedId, ! parameter.ParameterName); if (row != null && tableMapping != null) *************** *** 717,726 **** if (command == null) { ! command = new PgCommand( ! String.Empty, ! this.SelectCommand.Connection, ! this.SelectCommand.Transaction); } command.CommandType = CommandType.Text; // None is the Default value for automatically generated commands --- 731,738 ---- if (command == null) { ! command = this.SelectCommand.Connection.CreateCommand(); } + command.Transaction = this.SelectCommand.Transaction; command.CommandType = CommandType.Text; // None is the Default value for automatically generated commands |