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;

SQL_Terminate(SQLConnection);

pragma(enable warning LiteralStringUsed);

No comments:

Post a Comment

There was an error in this gadget