Tuesday, March 24, 2015

Dexterity - ExecuteNonQuery passthrough SQL template

Clean Code approach to passthrough SQL
inout text SQL;

pragma(disable warning LiteralStringUsed);
local long SQLConnection;

debug SQL;

if SQL_Connect(SQLConnection) <> OKAY  then
throw SQL_EXCEPTION, 0, "Connection to SQL has not been established.";
end if;

if SQL_Execute(SQLConnection, SQL) <> OKAY then
call SQLErrorHandler, SQLConnection;
end if;


pragma(enable warning LiteralStringUsed);

No comments:

Post a Comment