Я пытаюсь выполнить следующее
public void ExecuteNonQuery(string script) {
try {
int returnCode;
var builder = new DB2ConnectionStringBuilder {
UserID = Context.Parameters["USERID"],
Password =Context.Parameters["PASSWORD"],
Database = Context.Parameters["DATABASE"],
CurrentSchema = Context.Parameters["CURRENTSCHEMA"]
};
using (var connection = new DB2Connection(builder.ConnectionString)) {
using (var command = new DB2Command(script, connection)
) {
command.CommandType = CommandType.Text;
connection.Open();
returnCode = command.ExecuteNonQuery();
File.WriteAllText(Context.Parameters["LOGFILE"], "Return Code -1 Successful : " + returnCode);
}
}
}
catch (Exception ex) {
Trace.WriteLine(ex.StackTrace);
throw ex;
}
}
Я вызываю скрипт с несколькими операторами, оканчивающимися на; и в конце файла он содержит символ @ В командной строке db2 я мог использовать db2 -td @ -f. Я хотел бы знать, как определить символ @ как терминатор оператора, чтобы я мог выполнить скрипт из csharp.
Вот пример файла sql:
DROP PROCEDURE fred@
CREATE PROCEDURE fred ( IN name, IN id )
specific fred
language sql
b1: begin
update thetable
set thename = name
where table_id = id;
end: b1
@
grant execute on procedure inst.fred to user dbuser@