[pgsqlclient-checkins] pgsqlclient/PostgreSql.Data.PGSqlClient/source PGCommandBuilder.cs,1.4,1.5
Status: Inactive
Brought to you by:
carlosga_fb
From: <car...@us...> - 2003-07-30 17:36:12
|
Update of /cvsroot/pgsqlclient/pgsqlclient/PostgreSql.Data.PGSqlClient/source In directory sc8-pr-cvs1:/tmp/cvs-serv23205 Modified Files: PGCommandBuilder.cs Log Message: Added implementation for DereiveParameters method ( non tested yet ) Index: PGCommandBuilder.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient/PostgreSql.Data.PGSqlClient/source/PGCommandBuilder.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PGCommandBuilder.cs 16 Jul 2003 20:17:49 -0000 1.4 --- PGCommandBuilder.cs 30 Jul 2003 17:36:08 -0000 1.5 *************** *** 186,190 **** public static void DeriveParameters(PGCommand command) { ! /* TODO: Add implementation */ } --- 186,232 ---- public static void DeriveParameters(PGCommand command) { ! if (command.CommandType != CommandType.StoredProcedure) ! { ! throw new InvalidOperationException("The command text is not a valid stored procedure name."); ! } ! ! command.Parameters.Clear(); ! command.Prepare(); ! ! int index = 0; ! ! // Derive input parameters ! if (command.Statement.Parameters != null) ! { ! for (int i = 0; i < command.Statement.Parameters.Length; i++) ! { ! PGType type = command.Statement.Parameters[i].DataType; ! ! PGParameter parameter = new PGParameter(); ! parameter.ParameterName = "@ip" + i.ToString(); ! parameter.DbType = type.DbType; ! ! command.Parameters.Add(parameter); ! } ! ! index = command.Parameters.Count; ! } ! ! if (command.Statement.RowDescriptor != null) ! { ! // Derive output parameters ! for (int i = 0; i < command.Statement.RowDescriptor.Fields.Length; i++) ! { ! PGType type = command.Statement.RowDescriptor.Fields[i].DataType; ! ! PGParameter parameter = new PGParameter(); ! parameter.ParameterName = "@ip" + i.ToString(); ! parameter.DbType = type.DbType; ! ! command.Parameters.Add(parameter); ! ! index++; ! } ! } } |