Cannot insert multiple commands into a prepared statement
Posted: Tue 27 Jul 2010 16:06
(4.95.146.0)
Hi, seems to me this used to work but it's been awhile since I last worked with this tool. Isn't the point of using the pgScript to have multiple commands? I've got other scripts that have multiple statements like below that run fine. What's special about this one? What am I doing wrong? Thanks.
pgConn.Open()
pgConn.BeginTransaction()
pgScript = New PgSqlScript(sqlText, pgConn)
pgScript.Execute()
pgConn.Commit()
sqlText =
-- Function iif_bool
CREATE OR REPLACE FUNCTION iif_bool(condition boolean, truecase boolean, falsecase boolean) RETURNS boolean AS ' BEGIN If Condition = True Then Return TrueCase; Else Return FalseCase; END IF; END;' LANGUAGE 'plpgsql' VOLATILE COST 10000; ALTER FUNCTION iif_bool(boolean, boolean, boolean) OWNER TO ddadmin;
-- Function iif_text
CREATE OR REPLACE FUNCTION iif_text(condition boolean, truecase text, falsecase text) RETURNS text AS ' BEGIN If Condition = True Then Return TrueCase; Else Return FalseCase; END IF; END;' LANGUAGE 'plpgsql' VOLATILE COST 10000; ALTER FUNCTION iif_text(boolean, text, text) OWNER TO ddadmin;
-- Function iif_int
CREATE OR REPLACE FUNCTION iif_int(condition boolean, truecase integer, falsecase integer) RETURNS integer AS ' BEGIN If Condition = True Then Return TrueCase; Else Return FalseCase; END IF; END;' LANGUAGE 'plpgsql' VOLATILE COST 10000; ALTER FUNCTION iif_int(boolean, integer, integer) OWNER TO ddadmin;
-- Function iif_date
CREATE OR REPLACE FUNCTION iif_date(condition boolean, truecase date, falsecase date) RETURNS date AS ' BEGIN If Condition = True Then Return TrueCase; Else Return FalseCase; END IF; END;' LANGUAGE 'plpgsql' VOLATILE COST 10000; ALTER FUNCTION iif_date(boolean, date, date) OWNER TO ddadmin;
-- Function iif_cur
CREATE OR REPLACE FUNCTION iif_cur(condition boolean, truecase numeric, falsecase numeric) RETURNS numeric AS ' BEGIN If Condition = True Then Return TrueCase; Else Return FalseCase; END IF; END;' LANGUAGE 'plpgsql' VOLATILE COST 10000; ALTER FUNCTION iif_cur(boolean, numeric, numeric) OWNER TO ddadmin;
Hi, seems to me this used to work but it's been awhile since I last worked with this tool. Isn't the point of using the pgScript to have multiple commands? I've got other scripts that have multiple statements like below that run fine. What's special about this one? What am I doing wrong? Thanks.
pgConn.Open()
pgConn.BeginTransaction()
pgScript = New PgSqlScript(sqlText, pgConn)
pgScript.Execute()
pgConn.Commit()
sqlText =
-- Function iif_bool
CREATE OR REPLACE FUNCTION iif_bool(condition boolean, truecase boolean, falsecase boolean) RETURNS boolean AS ' BEGIN If Condition = True Then Return TrueCase; Else Return FalseCase; END IF; END;' LANGUAGE 'plpgsql' VOLATILE COST 10000; ALTER FUNCTION iif_bool(boolean, boolean, boolean) OWNER TO ddadmin;
-- Function iif_text
CREATE OR REPLACE FUNCTION iif_text(condition boolean, truecase text, falsecase text) RETURNS text AS ' BEGIN If Condition = True Then Return TrueCase; Else Return FalseCase; END IF; END;' LANGUAGE 'plpgsql' VOLATILE COST 10000; ALTER FUNCTION iif_text(boolean, text, text) OWNER TO ddadmin;
-- Function iif_int
CREATE OR REPLACE FUNCTION iif_int(condition boolean, truecase integer, falsecase integer) RETURNS integer AS ' BEGIN If Condition = True Then Return TrueCase; Else Return FalseCase; END IF; END;' LANGUAGE 'plpgsql' VOLATILE COST 10000; ALTER FUNCTION iif_int(boolean, integer, integer) OWNER TO ddadmin;
-- Function iif_date
CREATE OR REPLACE FUNCTION iif_date(condition boolean, truecase date, falsecase date) RETURNS date AS ' BEGIN If Condition = True Then Return TrueCase; Else Return FalseCase; END IF; END;' LANGUAGE 'plpgsql' VOLATILE COST 10000; ALTER FUNCTION iif_date(boolean, date, date) OWNER TO ddadmin;
-- Function iif_cur
CREATE OR REPLACE FUNCTION iif_cur(condition boolean, truecase numeric, falsecase numeric) RETURNS numeric AS ' BEGIN If Condition = True Then Return TrueCase; Else Return FalseCase; END IF; END;' LANGUAGE 'plpgsql' VOLATILE COST 10000; ALTER FUNCTION iif_cur(boolean, numeric, numeric) OWNER TO ddadmin;