[pgsqlclient-checkins] pgsqlclient_10/PostgreSql.Data.PgSqlClient/source PgCommand.cs,1.12,1.13
Status: Inactive
Brought to you by:
carlosga_fb
From: <car...@us...> - 2003-11-17 09:13:24
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source In directory sc8-pr-cvs1:/tmp/cvs-serv19050 Modified Files: PgCommand.cs Log Message: 2003-11-17 Carlos Guzmán Álvarez <car...@te...> * source/PgCommand.cs: - Restricted batch command execution to ExecuteReader calls . Prepare, ExecuteNonquery and ExecuteScalar calls will handle the command text as a single SQL command. Index: PgCommand.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgCommand.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PgCommand.cs 10 Nov 2003 12:11:25 -0000 1.12 --- PgCommand.cs 17 Nov 2003 09:12:43 -0000 1.13 *************** *** 72,76 **** this.commandText = value; this.actualCommand = 0; ! this.splitBatchCommands(); } } --- 72,76 ---- this.commandText = value; this.actualCommand = 0; ! this.commands = null; } } *************** *** 317,320 **** --- 317,321 ---- this.checkCommand(); + this.splitBatchCommands(false); this.InternalPrepare(); this.InternalExecute(); *************** *** 346,349 **** --- 347,351 ---- commandBehavior = behavior; + this.splitBatchCommands(true); this.InternalPrepare(); *************** *** 366,369 **** --- 368,372 ---- object returnValue = null; + this.splitBatchCommands(false); this.InternalPrepare(); this.InternalExecute(); *************** *** 381,384 **** --- 384,388 ---- this.checkCommand(); + this.splitBatchCommands(false); this.InternalPrepare(); this.connection.ActiveCommands.Add(this); *************** *** 692,709 **** } ! private void splitBatchCommands() { ! MatchCollection matches = Regex.Matches( ! this.commandText, ! "([^';]+('[^']*'))*[^';]*(?=;*)"); ! ! commands = new string[matches.Count/2]; ! int count = 0; ! for (int i = 0; i < matches.Count; i++) { ! if (matches[i].Value.Trim() != String.Empty) { ! this.commands[count] = matches[i].Value.Trim(); ! count++; } } --- 696,723 ---- } ! private void splitBatchCommands(bool batchAllowed) { ! if (this.commands == null) { ! if (batchAllowed) { ! MatchCollection matches = Regex.Matches( ! this.commandText, ! "([^';]+('[^']*'))*[^';]*(?=;*)"); ! ! this.commands = new string[matches.Count/2]; ! int count = 0; ! for (int i = 0; i < matches.Count; i++) ! { ! if (matches[i].Value.Trim() != String.Empty) ! { ! this.commands[count] = matches[i].Value.Trim(); ! count++; ! } ! } ! } ! else ! { ! this.commands = new string[]{this.commandText}; } } |