[pgsqlclient-checkins] pgsqlclient/PostgreSql.Data.PGSqlClient/source PGCommand.cs,1.1.1.1,1.2
Status: Inactive
Brought to you by:
carlosga_fb
|
From: <car...@us...> - 2003-07-13 13:39:03
|
Update of /cvsroot/pgsqlclient/pgsqlclient/PostgreSql.Data.PGSqlClient/source
In directory sc8-pr-cvs1:/tmp/cvs-serv26079
Modified Files:
PGCommand.cs
Log Message:
Added better handling of exceptions and command parameters.
Index: PGCommand.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient/PostgreSql.Data.PGSqlClient/source/PGCommand.cs,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** PGCommand.cs 12 Jul 2003 08:11:20 -0000 1.1.1.1
--- PGCommand.cs 13 Jul 2003 13:39:00 -0000 1.2
***************
*** 306,318 ****
}
! try
! {
! InternalPrepare();
! InternalExecute();
! }
! catch (PGClientException ex)
! {
! throw new PGException(ex.Message, ex);
! }
return statement.RecordsAffected;
--- 306,311 ----
}
! InternalPrepare();
! InternalExecute();
return statement.RecordsAffected;
***************
*** 354,375 ****
}
! try
! {
! commandBehavior = behavior;
! InternalPrepare();
! if ((commandBehavior & System.Data.CommandBehavior.SequentialAccess) == System.Data.CommandBehavior.SequentialAccess ||
! (commandBehavior & System.Data.CommandBehavior.SingleResult) == System.Data.CommandBehavior.SingleResult ||
! (commandBehavior & System.Data.CommandBehavior.SingleRow) == System.Data.CommandBehavior.SingleRow ||
! (commandBehavior & System.Data.CommandBehavior.CloseConnection) == System.Data.CommandBehavior.CloseConnection ||
! commandBehavior == System.Data.CommandBehavior.Default)
! {
! InternalExecute();
! }
! }
! catch (PGClientException ex)
{
! throw new PGException(ex.Message, ex);
}
--- 347,361 ----
}
! commandBehavior = behavior;
! InternalPrepare();
! if ((commandBehavior & System.Data.CommandBehavior.SequentialAccess) == System.Data.CommandBehavior.SequentialAccess ||
! (commandBehavior & System.Data.CommandBehavior.SingleResult) == System.Data.CommandBehavior.SingleResult ||
! (commandBehavior & System.Data.CommandBehavior.SingleRow) == System.Data.CommandBehavior.SingleRow ||
! (commandBehavior & System.Data.CommandBehavior.CloseConnection) == System.Data.CommandBehavior.CloseConnection ||
! commandBehavior == System.Data.CommandBehavior.Default)
{
! InternalExecute();
}
***************
*** 399,415 ****
object returnValue = null;
! try
! {
! InternalPrepare();
! InternalExecute();
! if (statement.HasRows)
! {
! returnValue = ((object[])statement.Rows[0])[0];
! }
! }
! catch (PGClientException ex)
{
! throw new PGException(ex.Message, ex);
}
--- 385,394 ----
object returnValue = null;
! InternalPrepare();
! InternalExecute();
! if (statement.HasRows)
{
! returnValue = ((object[])statement.Rows[0])[0];
}
***************
*** 432,445 ****
}
! try
! {
! InternalPrepare();
!
! connection.ActiveCommands.Add(this);
! }
! catch (PGClientException ex)
! {
! throw new PGException(ex.Message, ex);
! }
}
--- 411,416 ----
}
! InternalPrepare();
! connection.ActiveCommands.Add(this);
}
***************
*** 447,459 ****
{
string plan;
! if (statement == null)
{
! statement = connection.DbConnection.DB.CreateStatement(commandText);
! plan = statement.GetPlan(verbose);
! statement = null;
}
! else
{
! plan = statement.GetPlan(verbose);
}
--- 418,438 ----
{
string plan;
!
! try
{
! if (statement == null)
! {
! statement = connection.DbConnection.DB.CreateStatement(commandText);
! plan = statement.GetPlan(verbose);
! statement = null;
! }
! else
! {
! plan = statement.GetPlan(verbose);
! }
}
! catch (PGClientException ex)
{
! throw new PGException(ex.Message, ex);
}
***************
*** 472,480 ****
statement.Status == PGStatementStatus.Error)
{
! /* Get named parameters in CommandText */
! namedParameters = search.Matches(CommandText);
!
! /* Subst parameterNames with $position */
! parseParameterNames();
string prepareName = "PS" + getStmtName();
--- 451,461 ----
statement.Status == PGStatementStatus.Error)
{
! if (parameters.Count != 0)
! {
! // Get named parameters in CommandText
! namedParameters = search.Matches(CommandText);
! // Subst parameterNames with $position
! parseParameterNames();
! }
string prepareName = "PS" + getStmtName();
***************
*** 497,501 ****
catch (PGClientException ex)
{
! throw ex;
}
}
--- 478,482 ----
catch (PGClientException ex)
{
! throw new PGException(ex.Message, ex);
}
}
***************
*** 505,510 ****
try
{
! // Set parameter values
! setParameterValues();
// Bind Statement
--- 486,494 ----
try
{
! if (parameters.Count != 0)
! {
! // Set parameter values
! setParameterValues();
! }
// Bind Statement
***************
*** 529,533 ****
catch (PGClientException ex)
{
! throw ex;
}
}
--- 513,517 ----
catch (PGClientException ex)
{
! throw new PGException(ex.Message, ex);
}
}
|