[pgsqlclient-checkins] pgsqlclient_10/PostgreSql.Data.PgSqlClient/source PgCommand.cs,1.39,1.40 PgCo
Status: Inactive
Brought to you by:
carlosga_fb
From: Carlos G. Á. <car...@us...> - 2004-07-22 10:58:07
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20099 Modified Files: PgCommand.cs PgCommandBuilder.cs PgConnection.cs PgConnectionPool.cs PgDataReader.cs PgDbConnection.cs PgErrorCollection.cs PgException.cs Log Message: 2004-07-22 Carlos Guzman Alvarez <car...@te...> * USe PascalCase naming for private methods in all classes. Index: PgConnectionPool.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgConnectionPool.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PgConnectionPool.cs 10 Apr 2004 21:35:36 -0000 1.6 --- PgConnectionPool.cs 22 Jul 2004 10:57:53 -0000 1.7 *************** *** 165,169 **** } ! private void RunCleanUp() { TimeSpan interval = new TimeSpan(0, 0, 10); --- 165,173 ---- } ! #endregion ! ! #region Private methods ! ! private void RunCleanUp() { TimeSpan interval = new TimeSpan(0, 0, 10); Index: PgErrorCollection.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgErrorCollection.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PgErrorCollection.cs 10 Apr 2004 21:35:36 -0000 1.6 --- PgErrorCollection.cs 22 Jul 2004 10:57:53 -0000 1.7 *************** *** 98,104 **** return this.Add(error); ! } ! private bool cultureAwareCompare(string strA, string strB) { return CultureInfo.CurrentCulture.CompareInfo.Compare( --- 98,108 ---- return this.Add(error); ! } ! #endregion ! ! #region Private Methods ! ! private bool cultureAwareCompare(string strA, string strB) { return CultureInfo.CurrentCulture.CompareInfo.Compare( Index: PgDbConnection.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgDbConnection.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PgDbConnection.cs 10 Apr 2004 20:15:33 -0000 1.9 --- PgDbConnection.cs 22 Jul 2004 10:57:53 -0000 1.10 *************** *** 92,96 **** { this.connectionString = connectionString; ! this.parseConnectionString(); } --- 92,96 ---- { this.connectionString = connectionString; ! this.ParseConnectionString(); } *************** *** 122,128 **** throw new PgException(ex.Message, ex); } ! } ! private void parseConnectionString() { MatchCollection elements = search.Matches(this.connectionString); --- 122,153 ---- throw new PgException(ex.Message, ex); } ! } ! #endregion ! ! #region Internal Methods ! ! internal bool Verify() ! { ! bool isValid = true; ! ! try ! { ! // Try to send a Sync message to the PostgreSQL Server ! this.db.Sync(); ! } ! catch (Exception) ! { ! isValid = false; ! } ! ! return isValid; ! } ! ! #endregion ! ! #region Private Methods ! ! private void ParseConnectionString() { MatchCollection elements = search.Matches(this.connectionString); *************** *** 198,221 **** } } ! } ! ! internal bool Verify() ! { ! 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 --- 223,229 ---- } } ! } ! #endregion } } \ No newline at end of file Index: PgCommand.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgCommand.cs,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** PgCommand.cs 12 Jun 2004 14:26:10 -0000 1.39 --- PgCommand.cs 22 Jul 2004 10:57:53 -0000 1.40 *************** *** 346,352 **** public int ExecuteNonQuery() { ! this.checkCommand(); ! this.splitBatchCommands(false); this.InternalPrepare(); --- 346,352 ---- public int ExecuteNonQuery() { ! this.CheckCommand(); ! this.SplitBatchCommands(false); this.InternalPrepare(); *************** *** 375,383 **** public PgDataReader ExecuteReader(CommandBehavior behavior) { ! this.checkCommand(); this.commandBehavior = behavior; ! this.splitBatchCommands(true); this.InternalPrepare(); --- 375,383 ---- public PgDataReader ExecuteReader(CommandBehavior behavior) { ! this.CheckCommand(); this.commandBehavior = behavior; ! this.SplitBatchCommands(true); this.InternalPrepare(); *************** *** 397,405 **** public object ExecuteScalar() { ! this.checkCommand(); object returnValue = null; ! this.splitBatchCommands(false); this.InternalPrepare(); --- 397,405 ---- public object ExecuteScalar() { ! this.CheckCommand(); object returnValue = null; ! this.SplitBatchCommands(false); this.InternalPrepare(); *************** *** 416,422 **** public void Prepare() { ! this.checkCommand(); ! this.splitBatchCommands(false); this.InternalPrepare(); this.connection.ActiveCommands.Add(this); --- 416,422 ---- public void Prepare() { ! this.CheckCommand(); ! this.SplitBatchCommands(false); this.InternalPrepare(); this.connection.ActiveCommands.Add(this); *************** *** 427,431 **** string plan; ! this.checkCommand(); try --- 427,431 ---- string plan; ! this.CheckCommand(); try *************** *** 458,462 **** if (this.commands == null) { ! this.splitBatchCommands(false); } --- 458,462 ---- if (this.commands == null) { ! this.SplitBatchCommands(false); } *************** *** 469,482 **** if (this.commandType == CommandType.StoredProcedure) { ! this.commands[actualCommand] = this.buildStoredProcedureSql(); } ! ! string prepareName = "PS" + getStmtName(); ! string portalName = "PR" + getStmtName(); ! ! this.statement = this.connection.DbConnection.DB.CreateStatement( prepareName, portalName, ! this.parseParameterNames()); // Parse statement --- 469,482 ---- if (this.commandType == CommandType.StoredProcedure) { ! this.commands[actualCommand] = this.BuildStoredProcedureSql(); } ! ! string prepareName = "PS" + this.GetStmtName(); ! string portalName = "PR" + this.GetStmtName(); ! ! this.statement = this.connection.DbConnection.DB.CreateStatement( prepareName, portalName, ! this.ParseParameterNames()); // Parse statement *************** *** 505,509 **** { // Set parameter values ! this.setParameterValues(); } --- 505,509 ---- { // Set parameter values ! this.SetParameterValues(); } *************** *** 598,602 **** #region Private Methods ! private void checkCommand() { if (this.transaction != null && this.transaction.IsUpdated) --- 598,602 ---- #region Private Methods ! private void CheckCommand() { if (this.transaction != null && this.transaction.IsUpdated) *************** *** 628,632 **** } ! private string buildStoredProcedureSql() { string commandText = this.commands[actualCommand]; --- 628,632 ---- } ! private string BuildStoredProcedureSql() { string commandText = this.commands[actualCommand]; *************** *** 664,673 **** } ! private string getStmtName() { return GetHashCode().ToString() + this.connection.GetHashCode().ToString() + DateTime.Now.Ticks; } ! private string parseParameterNames() { string sql = this.commands[actualCommand]; --- 664,673 ---- } ! private string GetStmtName() { return GetHashCode().ToString() + this.connection.GetHashCode().ToString() + DateTime.Now.Ticks; } ! private string ParseParameterNames() { string sql = this.commands[actualCommand]; *************** *** 684,688 **** Regex r = new Regex(pattern, RegexOptions.ExplicitCapture); ! MatchEvaluator me = new MatchEvaluator(matchEvaluator); sql = r.Replace(sql, me); --- 684,688 ---- Regex r = new Regex(pattern, RegexOptions.ExplicitCapture); ! MatchEvaluator me = new MatchEvaluator(NamedParamsMatchEvaluator); sql = r.Replace(sql, me); *************** *** 694,698 **** } ! private string matchEvaluator(Match match) { string input = match.Value; --- 694,698 ---- } ! private string NamedParamsMatchEvaluator(Match match) { string input = match.Value; *************** *** 724,728 **** } ! private void setParameterValues() { if (this.parameters.Count != 0) --- 724,728 ---- } ! private void SetParameterValues() { if (this.parameters.Count != 0) *************** *** 753,757 **** } ! private void splitBatchCommands(bool batchAllowed) { if (this.commands == null) --- 753,757 ---- } ! private void SplitBatchCommands(bool batchAllowed) { if (this.commands == null) Index: PgException.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgException.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PgException.cs 10 Apr 2004 20:15:33 -0000 1.4 --- PgException.cs 22 Jul 2004 10:57:53 -0000 1.5 *************** *** 65,76 **** this.errors = new PgErrorCollection(); ! this.getPgExceptionErrors(ex); } #endregion ! #region Methods ! private void getPgExceptionErrors(PgClientException ex) { foreach (PgClientError error in ex.Errors) --- 65,76 ---- this.errors = new PgErrorCollection(); ! this.GetPgExceptionErrors(ex); } #endregion ! #region Private Methods ! private void GetPgExceptionErrors(PgClientException ex) { foreach (PgClientError error in ex.Errors) Index: PgDataReader.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgDataReader.cs,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** PgDataReader.cs 10 Apr 2004 21:35:36 -0000 1.22 --- PgDataReader.cs 22 Jul 2004 10:57:53 -0000 1.23 *************** *** 146,150 **** // This will update RecordsAffected property ! this.updateRecordsAffected(); if (this.command != null && !this.command.IsDisposed) --- 146,150 ---- // This will update RecordsAffected property ! this.UpdateRecordsAffected(); if (this.command != null && !this.command.IsDisposed) *************** *** 178,182 **** } ! this.updateRecordsAffected(); bool returnValue = this.command.NextResult(); --- 178,182 ---- } ! this.UpdateRecordsAffected(); bool returnValue = this.command.NextResult(); *************** *** 233,242 **** if (schemaTable == null) { ! schemaTable = getSchemaTableStructure(); schemaTable.BeginLoadData(); ! PgCommand cInfoCmd = getColumnInfoCmd(); ! PgCommand pKeyCmd = getPrimaryKeyInfoCmd(); for (int i = 0; i < command.Statement.RowDescriptor.Fields.Length; i++) --- 233,242 ---- if (schemaTable == null) { ! schemaTable = this.GetSchemaTableStructure(); schemaTable.BeginLoadData(); ! PgCommand cInfoCmd = this.GetColumnInfoCmd(); ! PgCommand pKeyCmd = this.GetPrimaryKeyInfoCmd(); for (int i = 0; i < command.Statement.RowDescriptor.Fields.Length; i++) *************** *** 275,285 **** DataRow schemaRow = schemaTable.NewRow(); ! schemaRow["ColumnName"] = getName(i); schemaRow["ColumnOrdinal"] = i; ! schemaRow["ColumnSize"] = getSize(i); ! if (isNumeric(i)) { ! schemaRow["NumericPrecision"] = getNumericPrecision(i); ! schemaRow["NumericScale"] = getNumericScale(i); } else --- 275,285 ---- DataRow schemaRow = schemaTable.NewRow(); ! schemaRow["ColumnName"] = this.GetName(i); schemaRow["ColumnOrdinal"] = i; ! schemaRow["ColumnSize"] = this.GetSize(i); ! if (this.IsNumeric(i)) { ! schemaRow["NumericPrecision"] = this.GetNumericPrecision(i); ! schemaRow["NumericScale"] = this.GetNumericScale(i); } else *************** *** 288,304 **** schemaRow["NumericScale"] = DBNull.Value; } ! schemaRow["DataType"] = getFieldType(i); ! schemaRow["ProviderType"] = getProviderType(i); ! schemaRow["IsLong"] = isLong(i); schemaRow["IsRowVersion"] = false; schemaRow["IsUnique"] = false; ! schemaRow["IsAliased"] = isAliased(i); ! schemaRow["IsExpression"] = isExpression(i); ! schemaRow["BaseCatalogName"] = System.DBNull.Value; if (columnInfo != null) { schemaRow["IsReadOnly"] = (bool)columnInfo[10]; schemaRow["IsAutoIncrement"] = (bool)columnInfo[10]; ! schemaRow["IsKey"] = isPrimaryKey(pKeyInfo, (short)columnInfo[6]); schemaRow["AllowDBNull"] = ((bool)columnInfo[9]) ? false : true; schemaRow["BaseSchemaName"] = columnInfo[0].ToString(); --- 288,304 ---- schemaRow["NumericScale"] = DBNull.Value; } ! schemaRow["DataType"] = this.GetFieldType(i); ! schemaRow["ProviderType"] = this.GetProviderType(i); ! schemaRow["IsLong"] = this.IsLong(i); schemaRow["IsRowVersion"] = false; schemaRow["IsUnique"] = false; ! schemaRow["IsAliased"] = this.IsAliased(i); ! schemaRow["IsExpression"] = this.IsExpression(i); ! schemaRow["BaseCatalogName"] = System.DBNull.Value; if (columnInfo != null) { schemaRow["IsReadOnly"] = (bool)columnInfo[10]; schemaRow["IsAutoIncrement"] = (bool)columnInfo[10]; ! schemaRow["IsKey"] = this.IsPrimaryKey(pKeyInfo, (short)columnInfo[6]); schemaRow["AllowDBNull"] = ((bool)columnInfo[9]) ? false : true; schemaRow["BaseSchemaName"] = columnInfo[0].ToString(); *************** *** 329,333 **** } ! private PgCommand getColumnInfoCmd() { PgDbSchema dbSchema = PgDbSchemaFactory.GetSchema(PgDbSchemaType.Columns); --- 329,333 ---- } ! private PgCommand GetColumnInfoCmd() { PgDbSchema dbSchema = PgDbSchemaFactory.GetSchema(PgDbSchemaType.Columns); *************** *** 344,348 **** } ! private PgCommand getPrimaryKeyInfoCmd() { PgDbSchema dbSchema = PgDbSchemaFactory.GetSchema(PgDbSchemaType.Primary_Keys); --- 344,348 ---- } ! private PgCommand GetPrimaryKeyInfoCmd() { PgDbSchema dbSchema = PgDbSchemaFactory.GetSchema(PgDbSchemaType.Primary_Keys); *************** *** 357,361 **** } ! private bool isPrimaryKey(System.Array pKeyInfo, short ordinal) { if (pKeyInfo != null) --- 357,361 ---- } ! private bool IsPrimaryKey(System.Array pKeyInfo, short ordinal) { if (pKeyInfo != null) *************** *** 398,432 **** public String GetName(int i) { ! this.checkIndex(i); ! return this.getName(i); ! } [EditorBrowsable(EditorBrowsableState.Never)] public String GetDataTypeName(int i) { ! this.checkIndex(i); ! return this.getDataTypeName(i); ! } public Type GetFieldType(int i) { ! this.checkIndex(i); ! return this.getFieldType(i); ! } public object GetValue(int i) { ! this.checkPosition(); ! this.checkIndex(i); ! return this.getValue(i); ! } public int GetValues(object[] values) { ! this.checkPosition(); for (int i = 0; i < FieldCount; i++) --- 398,432 ---- public String GetName(int i) { ! this.CheckIndex(i); ! return this.command.Statement.RowDescriptor.Fields[i].FieldName; ! } [EditorBrowsable(EditorBrowsableState.Never)] public String GetDataTypeName(int i) { ! this.CheckIndex(i); ! return this.command.Statement.RowDescriptor.Fields[i].DataType.Name; ! } public Type GetFieldType(int i) { ! this.CheckIndex(i); ! return this.command.Statement.RowDescriptor.Fields[i].DataType.SystemType; ! } public object GetValue(int i) { ! this.CheckPosition(); ! this.CheckIndex(i); ! return this.row[i]; ! } public int GetValues(object[] values) { ! this.CheckPosition(); for (int i = 0; i < FieldCount; i++) *************** *** 445,455 **** } ! return this.getOrdinal(name); ! } ! public bool GetBoolean(int i) { ! this.checkPosition(); ! this.checkIndex(i); return Convert.ToBoolean(this.GetValue(i)); --- 445,463 ---- } ! for (int i = 0; i < this.command.Statement.RowDescriptor.Fields.Length; i++) ! { ! if (this.CultureAwareCompare(command.Statement.RowDescriptor.Fields[i].FieldName, name)) ! { ! return i; ! } ! } ! return -1; ! } ! ! public bool GetBoolean(int i) { ! this.CheckPosition(); ! this.CheckIndex(i); return Convert.ToBoolean(this.GetValue(i)); *************** *** 458,463 **** public byte GetByte(int i) { ! this.checkPosition(); ! this.checkIndex(i); return Convert.ToByte(this.GetValue(i)); --- 466,471 ---- public byte GetByte(int i) { ! this.CheckPosition(); ! this.CheckIndex(i); return Convert.ToByte(this.GetValue(i)); *************** *** 512,517 **** public char GetChar(int i) { ! this.checkPosition(); ! this.checkIndex(i); return Convert.ToChar(this.GetValue(i)); --- 520,525 ---- public char GetChar(int i) { ! this.CheckPosition(); ! this.CheckIndex(i); return Convert.ToChar(this.GetValue(i)); *************** *** 525,530 **** int length) { ! this.checkPosition(); ! this.checkIndex(i); if (buffer == null) --- 533,538 ---- int length) { ! this.CheckPosition(); ! this.CheckIndex(i); if (buffer == null) *************** *** 574,579 **** public Int16 GetInt16(int i) { ! this.checkPosition(); ! this.checkIndex(i); return Convert.ToInt16(this.GetValue(i)); --- 582,587 ---- public Int16 GetInt16(int i) { ! this.CheckPosition(); ! this.CheckIndex(i); return Convert.ToInt16(this.GetValue(i)); *************** *** 582,587 **** public Int32 GetInt32(int i) { ! this.checkPosition(); ! this.checkIndex(i); return Convert.ToInt32(this.GetValue(i)); --- 590,595 ---- public Int32 GetInt32(int i) { ! this.CheckPosition(); ! this.CheckIndex(i); return Convert.ToInt32(this.GetValue(i)); *************** *** 590,595 **** public Int64 GetInt64(int i) { ! this.checkPosition(); ! this.checkIndex(i); return Convert.ToInt64(this.GetValue(i)); --- 598,603 ---- public Int64 GetInt64(int i) { ! this.CheckPosition(); ! this.CheckIndex(i); return Convert.ToInt64(this.GetValue(i)); *************** *** 598,603 **** public float GetFloat(int i) { ! this.checkPosition(); ! this.checkIndex(i); return Convert.ToSingle(this.GetValue(i)); --- 606,611 ---- public float GetFloat(int i) { ! this.CheckPosition(); ! this.CheckIndex(i); return Convert.ToSingle(this.GetValue(i)); *************** *** 606,611 **** public double GetDouble(int i) { ! this.checkPosition(); ! this.checkIndex(i); return Convert.ToDouble(this.GetValue(i)); --- 614,619 ---- public double GetDouble(int i) { ! this.CheckPosition(); ! this.CheckIndex(i); return Convert.ToDouble(this.GetValue(i)); *************** *** 614,619 **** public String GetString(int i) { ! this.checkPosition(); ! this.checkIndex(i); return Convert.ToString(this.GetValue(i)); --- 622,627 ---- public String GetString(int i) { ! this.CheckPosition(); ! this.CheckIndex(i); return Convert.ToString(this.GetValue(i)); *************** *** 622,627 **** public Decimal GetDecimal(int i) { ! this.checkPosition(); ! this.checkIndex(i); return Convert.ToDecimal(this.GetValue(i)); --- 630,635 ---- public Decimal GetDecimal(int i) { ! this.CheckPosition(); ! this.CheckIndex(i); return Convert.ToDecimal(this.GetValue(i)); *************** *** 630,635 **** public DateTime GetDateTime(int i) { ! this.checkPosition(); ! this.checkIndex(i); return Convert.ToDateTime(this.GetValue(i)); --- 638,643 ---- public DateTime GetDateTime(int i) { ! this.CheckPosition(); ! this.CheckIndex(i); return Convert.ToDateTime(this.GetValue(i)); *************** *** 638,643 **** public TimeSpan GetTimeSpan(int i) { ! this.checkPosition(); ! this.checkIndex(i); return (TimeSpan)GetValue(i); --- 646,651 ---- public TimeSpan GetTimeSpan(int i) { ! this.CheckPosition(); ! this.CheckIndex(i); return (TimeSpan)GetValue(i); *************** *** 646,651 **** public PgPoint GetPgPoint(int i) { ! this.checkPosition(); ! this.checkIndex(i); return (PgPoint)this.GetPgValue(i); --- 654,659 ---- public PgPoint GetPgPoint(int i) { ! this.CheckPosition(); ! this.CheckIndex(i); return (PgPoint)this.GetPgValue(i); *************** *** 654,659 **** public PgBox GetPgBox(int i) { ! this.checkPosition(); ! this.checkIndex(i); return (PgBox)this.GetPgValue(i); --- 662,667 ---- public PgBox GetPgBox(int i) { ! this.CheckPosition(); ! this.CheckIndex(i); return (PgBox)this.GetPgValue(i); *************** *** 662,667 **** public PgLSeg GetPgLSeg(int i) { ! this.checkPosition(); ! this.checkIndex(i); return (PgLSeg)this.GetPgValue(i); --- 670,675 ---- public PgLSeg GetPgLSeg(int i) { ! this.CheckPosition(); ! this.CheckIndex(i); return (PgLSeg)this.GetPgValue(i); *************** *** 670,675 **** public PgCircle GetPgCircle(int i) { ! this.checkPosition(); ! this.checkIndex(i); return (PgCircle)this.GetPgValue(i); --- 678,683 ---- public PgCircle GetPgCircle(int i) { ! this.CheckPosition(); ! this.CheckIndex(i); return (PgCircle)this.GetPgValue(i); *************** *** 678,683 **** public PgPath GetPgPath(int i) { ! this.checkPosition(); ! this.checkIndex(i); return (PgPath)this.GetPgValue(i); --- 686,691 ---- public PgPath GetPgPath(int i) { ! this.CheckPosition(); ! this.CheckIndex(i); return (PgPath)this.GetPgValue(i); *************** *** 686,691 **** public PgPolygon GetPgPolygon(int i) { ! this.checkPosition(); ! this.checkIndex(i); return (PgPolygon)this.GetPgValue(i); --- 694,699 ---- public PgPolygon GetPgPolygon(int i) { ! this.CheckPosition(); ! this.CheckIndex(i); return (PgPolygon)this.GetPgValue(i); *************** *** 694,699 **** public PgTimeSpan GetPgTimeSpan(int i) { ! this.checkPosition(); ! this.checkIndex(i); return new PgTimeSpan(this.GetTimeSpan(i)); --- 702,707 ---- public PgTimeSpan GetPgTimeSpan(int i) { ! this.CheckPosition(); ! this.CheckIndex(i); return new PgTimeSpan(this.GetTimeSpan(i)); *************** *** 702,709 **** public object GetPgValue(int i) { ! this.checkPosition(); ! this.checkIndex(i); ! switch (this.getProviderType(i)) { case PgDbType.Interval: --- 710,717 ---- public object GetPgValue(int i) { ! this.CheckPosition(); ! this.CheckIndex(i); ! switch (this.GetProviderType(i)) { case PgDbType.Interval: *************** *** 711,715 **** default: ! return this.getValue(i); } } --- 719,723 ---- default: ! return this.GetValue(i); } } *************** *** 727,735 **** public bool IsDBNull(int i) { ! this.checkPosition(); ! this.checkIndex(i); ! ! return this.isDBNull(i); ! } #endregion --- 735,750 ---- public bool IsDBNull(int i) { ! this.CheckPosition(); ! this.CheckIndex(i); ! ! bool returnValue = false; ! ! if (this.row[i] == System.DBNull.Value) ! { ! returnValue = true; ! } ! ! return returnValue; ! } #endregion *************** *** 746,750 **** #region Private Methods ! private void checkIndex(int i) { if (i < 0 || i >= this.fieldCount) --- 761,765 ---- #region Private Methods ! private void CheckIndex(int i) { if (i < 0 || i >= this.fieldCount) *************** *** 754,758 **** } ! private void checkPosition() { if (this.position == STARTPOS) --- 769,773 ---- } ! private void CheckPosition() { if (this.position == STARTPOS) *************** *** 762,789 **** } ! private int getOrdinal(string name) ! { ! for (int i = 0; i < this.command.Statement.RowDescriptor.Fields.Length; i++) ! { ! if (this.cultureAwareCompare(command.Statement.RowDescriptor.Fields[i].FieldName, name)) ! { ! return i; ! } ! } ! ! return -1; ! } ! ! private string getName(int i) ! { ! return this.command.Statement.RowDescriptor.Fields[i].FieldName; ! } ! ! private int getSize(int i) { return this.command.Statement.RowDescriptor.Fields[i].DataType.Size; } ! private int getNumericPrecision(int i) { #warning "Add implementation" --- 777,786 ---- } ! private int GetSize(int i) { return this.command.Statement.RowDescriptor.Fields[i].DataType.Size; } ! private int GetNumericPrecision(int i) { #warning "Add implementation" *************** *** 791,795 **** } ! private int getNumericScale(int i) { #warning "Add implementation" --- 788,792 ---- } ! private int GetNumericScale(int i) { #warning "Add implementation" *************** *** 797,821 **** } ! 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) --- 794,803 ---- } ! private PgDbType GetProviderType(int i) { return (PgDbType)this.command.Statement.RowDescriptor.Fields[i].DataType.DataType; } ! private bool IsNumeric(int i) { if (i < 0 || i >= this.FieldCount) *************** *** 827,831 **** } ! private bool isLong(int i) { if (i < 0 || i >= this.FieldCount) --- 809,813 ---- } ! private bool IsLong(int i) { if (i < 0 || i >= this.FieldCount) *************** *** 837,853 **** } ! private bool isDBNull(int i) ! { ! bool returnValue = false; ! ! if (this.row[i] == System.DBNull.Value) ! { ! returnValue = true; ! } ! ! return returnValue; ! } ! ! private bool isAliased(int i) { /* TODO: Add implementation */ --- 819,823 ---- } ! private bool IsAliased(int i) { /* TODO: Add implementation */ *************** *** 855,859 **** } ! private bool isExpression(int i) { bool returnValue = false; --- 825,829 ---- } ! private bool IsExpression(int i) { bool returnValue = false; *************** *** 868,872 **** } ! private DataTable getSchemaTableStructure() { DataTable schema = new DataTable("Schema"); --- 838,842 ---- } ! private DataTable GetSchemaTableStructure() { DataTable schema = new DataTable("Schema"); *************** *** 896,900 **** } ! private void updateRecordsAffected() { if (this.command != null && !this.command.IsDisposed) --- 866,870 ---- } ! private void UpdateRecordsAffected() { if (this.command != null && !this.command.IsDisposed) *************** *** 908,912 **** } ! private bool cultureAwareCompare(string strA, string strB) { return CultureInfo.CurrentCulture.CompareInfo.Compare( --- 878,882 ---- } ! private bool CultureAwareCompare(string strA, string strB) { return CultureInfo.CurrentCulture.CompareInfo.Compare( Index: PgConnection.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgConnection.cs,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** PgConnection.cs 31 May 2004 17:18:57 -0000 1.18 --- PgConnection.cs 22 Jul 2004 10:57:53 -0000 1.19 *************** *** 248,252 **** #endregion ! #region ICloneable MEthods object ICloneable.Clone() --- 248,252 ---- #endregion ! #region ICloneable Methods object ICloneable.Clone() Index: PgCommandBuilder.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgCommandBuilder.cs,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** PgCommandBuilder.cs 10 Apr 2004 20:15:33 -0000 1.21 --- PgCommandBuilder.cs 22 Jul 2004 10:57:53 -0000 1.22 *************** *** 68,72 **** if (this.dataAdapter != null) { ! this.adapterHandler = new PgRowUpdatingEventHandler(this.rowUpdatingHandler); this.dataAdapter.RowUpdating += this.adapterHandler; } --- 68,72 ---- if (this.dataAdapter != null) { ! this.adapterHandler = new PgRowUpdatingEventHandler(this.RowUpdatingHandler); this.dataAdapter.RowUpdating += this.adapterHandler; } *************** *** 244,248 **** if (this.insertCommand == null) { ! this.buildInsertCommand(null, null); } --- 244,248 ---- if (this.insertCommand == null) { ! this.BuildInsertCommand(null, null); } *************** *** 254,258 **** if (this.updateCommand == null) { ! this.buildUpdateCommand(null, null); } --- 254,258 ---- if (this.updateCommand == null) { ! this.BuildUpdateCommand(null, null); } *************** *** 264,268 **** if (this.deleteCommand == null) { ! this.buildDeleteCommand(null, null); } --- 264,268 ---- if (this.deleteCommand == null) { ! this.BuildDeleteCommand(null, null); } *************** *** 315,319 **** #region Build Command Methods ! private PgCommand buildInsertCommand( DataRow row, DataTableMapping tableMapping) --- 315,319 ---- #region Build Command Methods ! private PgCommand BuildInsertCommand( DataRow row, DataTableMapping tableMapping) *************** *** 323,335 **** StringBuilder values = new StringBuilder(); ! this.buildSchemaTable(); // Create a new command ! this.createCommand(ref this.insertCommand); int i = 1; foreach (DataRow schemaRow in schemaTable.Rows) { ! if (this.isUpdatable(schemaRow, row, tableMapping)) { if (fields.Length > 0) --- 323,335 ---- StringBuilder values = new StringBuilder(); ! this.BuildSchemaTable(); // Create a new command ! this.CreateCommand(ref this.insertCommand); int i = 1; foreach (DataRow schemaRow in schemaTable.Rows) { ! if (this.IsUpdatable(schemaRow, row, tableMapping)) { if (fields.Length > 0) *************** *** 342,346 **** } ! PgParameter parameter = this.createParameter( schemaRow, i, --- 342,346 ---- } ! PgParameter parameter = this.CreateParameter( schemaRow, i, *************** *** 349,353 **** if (row != null && tableMapping != null) { ! DataColumn column = this.getDataColumn( schemaRow["BaseColumnName"].ToString(), tableMapping, --- 349,353 ---- if (row != null && tableMapping != null) { ! DataColumn column = this.GetDataColumn( schemaRow["BaseColumnName"].ToString(), tableMapping, *************** *** 363,367 **** // Build Field name and append it to the string ! fields.Append(this.getQuotedIdentifier(schemaRow["BaseColumnName"])); // Build value name and append it to the string --- 363,367 ---- // Build Field name and append it to the string ! fields.Append(this.GetQuotedIdentifier(schemaRow["BaseColumnName"])); // Build value name and append it to the string *************** *** 374,378 **** sql.AppendFormat( this.sqlInsert, ! this.getQuotedIdentifier(tableName), fields.ToString(), values.ToString()); --- 374,378 ---- sql.AppendFormat( this.sqlInsert, ! this.GetQuotedIdentifier(tableName), fields.ToString(), values.ToString()); *************** *** 383,387 **** } ! private PgCommand buildUpdateCommand(DataRow row, DataTableMapping tableMapping) { StringBuilder sql = new StringBuilder(); --- 383,387 ---- } ! private PgCommand BuildUpdateCommand(DataRow row, DataTableMapping tableMapping) { StringBuilder sql = new StringBuilder(); *************** *** 389,393 **** StringBuilder where = new StringBuilder(); ! this.buildSchemaTable(); if (!this.hasPrimaryKey && !this.hasUniqueKey) --- 389,393 ---- StringBuilder where = new StringBuilder(); ! this.BuildSchemaTable(); if (!this.hasPrimaryKey && !this.hasUniqueKey) *************** *** 397,406 **** // Create a new command ! this.createCommand(ref this.updateCommand); int i = 1; foreach (DataRow schemaRow in schemaTable.Rows) { ! if (this.isUpdatable(schemaRow, row, tableMapping)) { if (sets.Length > 0) --- 397,406 ---- // Create a new command ! this.CreateCommand(ref this.updateCommand); int i = 1; foreach (DataRow schemaRow in schemaTable.Rows) { ! if (this.IsUpdatable(schemaRow, row, tableMapping)) { if (sets.Length > 0) *************** *** 409,423 **** } ! 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) { ! DataColumn column = this.getDataColumn( schemaRow["BaseColumnName"].ToString(), tableMapping, --- 409,423 ---- } ! 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) { ! DataColumn column = this.GetDataColumn( schemaRow["BaseColumnName"].ToString(), tableMapping, *************** *** 439,443 **** foreach (DataRow schemaRow in schemaTable.Rows) { ! if (this.includedInWhereClause(schemaRow)) { if (where.Length > 0) --- 439,443 ---- foreach (DataRow schemaRow in schemaTable.Rows) { ! if (this.IncludedInWhereClause(schemaRow)) { if (where.Length > 0) *************** *** 446,452 **** } ! string quotedId = this.getQuotedIdentifier(schemaRow["BaseColumnName"]); ! PgParameter parameter = this.createParameter(schemaRow, i, true); where.AppendFormat( --- 446,452 ---- } ! string quotedId = this.GetQuotedIdentifier(schemaRow["BaseColumnName"]); ! PgParameter parameter = this.CreateParameter(schemaRow, i, true); where.AppendFormat( *************** *** 457,461 **** if (row != null && tableMapping != null) { ! DataColumn column = this.getDataColumn( schemaRow["BaseColumnName"].ToString(), tableMapping, --- 457,461 ---- if (row != null && tableMapping != null) { ! DataColumn column = this.GetDataColumn( schemaRow["BaseColumnName"].ToString(), tableMapping, *************** *** 476,480 **** sql.AppendFormat( this.sqlUpdate, ! this.getQuotedIdentifier(tableName), sets.ToString(), where.ToString()); --- 476,480 ---- sql.AppendFormat( this.sqlUpdate, ! this.GetQuotedIdentifier(tableName), sets.ToString(), where.ToString()); *************** *** 485,489 **** } ! private PgCommand buildDeleteCommand(DataRow row, DataTableMapping tableMapping) { StringBuilder sql = new StringBuilder(); --- 485,489 ---- } ! private PgCommand BuildDeleteCommand(DataRow row, DataTableMapping tableMapping) { StringBuilder sql = new StringBuilder(); *************** *** 491,495 **** string dsColumnName = String.Empty; ! this.buildSchemaTable(); if (!this.hasPrimaryKey && !this.hasUniqueKey) --- 491,495 ---- string dsColumnName = String.Empty; ! this.BuildSchemaTable(); if (!this.hasPrimaryKey && !this.hasUniqueKey) *************** *** 499,503 **** // Create a new command ! this.createCommand(ref this.deleteCommand); // Build where clausule --- 499,503 ---- // Create a new command ! this.CreateCommand(ref this.deleteCommand); // Build where clausule *************** *** 505,509 **** foreach (DataRow schemaRow in schemaTable.Rows) { ! if (this.includedInWhereClause(schemaRow)) { if (where.Length > 0) --- 505,509 ---- foreach (DataRow schemaRow in schemaTable.Rows) { ! if (this.IncludedInWhereClause(schemaRow)) { if (where.Length > 0) *************** *** 512,518 **** } ! string quotedId = this.getQuotedIdentifier(schemaRow["BaseColumnName"]); ! PgParameter parameter = this.createParameter(schemaRow, i, true); where.AppendFormat( --- 512,518 ---- } ! string quotedId = this.GetQuotedIdentifier(schemaRow["BaseColumnName"]); ! PgParameter parameter = this.CreateParameter(schemaRow, i, true); where.AppendFormat( *************** *** 523,527 **** if (row != null && tableMapping != null) { ! DataColumn column = this.getDataColumn( schemaRow["BaseColumnName"].ToString(), tableMapping, --- 523,527 ---- if (row != null && tableMapping != null) { ! DataColumn column = this.GetDataColumn( schemaRow["BaseColumnName"].ToString(), tableMapping, *************** *** 542,546 **** sql.AppendFormat( this.sqlDelete, ! this.getQuotedIdentifier(tableName), where.ToString()); --- 542,546 ---- sql.AppendFormat( this.sqlDelete, ! this.GetQuotedIdentifier(tableName), where.ToString()); *************** *** 550,554 **** } ! private PgParameter createParameter( DataRow schemaRow, int index, --- 550,554 ---- } ! private PgParameter CreateParameter( DataRow schemaRow, int index, *************** *** 580,584 **** } ! private bool isUpdatable( DataRow schemaRow, DataRow row, --- 580,584 ---- } ! private bool IsUpdatable( DataRow schemaRow, DataRow row, *************** *** 587,591 **** if (row != null && tableMapping != null) { ! DataColumn column = this.getDataColumn( schemaRow["BaseColumnName"].ToString(), tableMapping, --- 587,591 ---- if (row != null && tableMapping != null) { ! DataColumn column = this.GetDataColumn( schemaRow["BaseColumnName"].ToString(), tableMapping, *************** *** 629,633 **** } ! private bool includedInWhereClause(DataRow schemaRow) { PgDbType pgDbType = (PgDbType)schemaRow["ProviderType"]; --- 629,633 ---- } ! private bool IncludedInWhereClause(DataRow schemaRow) { PgDbType pgDbType = (PgDbType)schemaRow["ProviderType"]; *************** *** 651,655 **** } ! private void buildSchemaTable() { bool mustClose = false; --- 651,655 ---- } ! private void BuildSchemaTable() { bool mustClose = false; *************** *** 678,682 **** reader.Close(); ! this.checkSchemaTable(); } catch --- 678,682 ---- reader.Close(); ! this.CheckSchemaTable(); } catch *************** *** 694,698 **** } ! private void checkSchemaTable() { tableName = String.Empty; --- 694,698 ---- } ! private void CheckSchemaTable() { tableName = String.Empty; *************** *** 722,731 **** } ! private string getQuotedIdentifier(object identifier) { return quotePrefix + identifier.ToString() + quoteSuffix; } ! private void createCommand(ref PgCommand command) { if (command == null) --- 722,731 ---- } ! private string GetQuotedIdentifier(object identifier) { return quotePrefix + identifier.ToString() + quoteSuffix; } ! private void CreateCommand(ref PgCommand command) { if (command == null) *************** *** 741,745 **** } ! private DataColumn getDataColumn( string columnName, DataTableMapping tableMapping, --- 741,745 ---- } ! private DataColumn GetDataColumn( string columnName, DataTableMapping tableMapping, *************** *** 770,774 **** #region Event Handler Methods ! private void rowUpdatingHandler(object sender, PgRowUpdatingEventArgs e) { if (e.Status != UpdateStatus.Continue) --- 770,774 ---- #region Event Handler Methods ! private void RowUpdatingHandler(object sender, PgRowUpdatingEventArgs e) { if (e.Status != UpdateStatus.Continue) *************** *** 811,823 **** { case StatementType.Insert: ! e.Command = this.buildInsertCommand(e.Row, e.TableMapping); break; case StatementType.Update: ! e.Command = this.buildUpdateCommand(e.Row, e.TableMapping); break; case StatementType.Delete: ! e.Command = this.buildDeleteCommand(e.Row, e.TableMapping); break; } --- 811,823 ---- { case StatementType.Insert: ! e.Command = this.BuildInsertCommand(e.Row, e.TableMapping); break; case StatementType.Update: ! e.Command = this.BuildUpdateCommand(e.Row, e.TableMapping); break; case StatementType.Delete: ! e.Command = this.BuildDeleteCommand(e.Row, e.TableMapping); break; } |