Access violation when using TZStoredProc
Posted: 30.09.2005, 02:20
I'm using Firebird embedded 1.5.2.4731 and I can't seem to use TZStoredProc - I always get an exception in the destructor of the TZConnection if I try to use them. I don't have any problem with TZQuery.
Code is as follows...
[syntax="c"]
std::auto_ptr<TZStoredProc> qryEditRule(new TZStoredProc(NULL));
//std::auto_ptr<TZReadOnlyQuery> qryEditRule(new TZReadOnlyQuery(NULL));
qryEditRule->Connection = frmData->Database;
qryEditRule->StoredProcName = "CHANGE_FTP_RULE_SP";
/*qryEditRule->SQL->Add("UPDATE FTP SET \"NAME\" = :NAME,");
qryEditRule->SQL->Add("\"ENABLED\" = :ENABLED, \"TYPE\" = :TYPE,");
qryEditRule->SQL->Add("\"SERVER\" = :SERVER, \"FILES\" = :FILES,");
qryEditRule->SQL->Add("\"REMOTEPATH\" = :REMOTEPATH,");
qryEditRule->SQL->Add("\"DELETEFILES\" = :DELETEFILES,");
qryEditRule->SQL->Add("\"SAVEFILES\" = :SAVEFILES, \"SAVEPATHS\" = :SAVEPATHS,");
qryEditRule->SQL->Add("\"ZIPFILES\" = :ZIPFILES,");
qryEditRule->SQL->Add("\"ZIPFILENAME\" = :ZIPFILENAME,");
qryEditRule->SQL->Add("\"INTERVAL\" = :INTERVAL,");
qryEditRule->SQL->Add("\"CHECKTIMES\" = :CHECKTIMES,");
qryEditRule->SQL->Add("\"TRAVERSEDIRS\" = :TRAVERSEDIRS,");
qryEditRule->SQL->Add("\"SHOWALERT\" = :SHOWALERT");
qryEditRule->SQL->Add("WHERE \"ID\" = :ID");*/
qryEditRule->ParamByName("NAME")->AsString = GetName();
qryEditRule->ParamByName("ENABLED")->AsBoolean = GetEnabled();
qryEditRule->ParamByName("TYPE")->AsInteger = (int)GetType();
qryEditRule->ParamByName("SERVER")->AsInteger = GetServer();
qryEditRule->ParamByName("FILES")->AsString = Files->CommaText;
qryEditRule->ParamByName("DELETEFILES")->AsBoolean = GetDeleteFiles();
qryEditRule->ParamByName("REMOTEPATH")->AsString = GetRemotePath();
qryEditRule->ParamByName("SAVEFILES")->AsBoolean = GetSaveFiles();
qryEditRule->ParamByName("SAVEPATHS")->AsString = SavePaths->CommaText;
qryEditRule->ParamByName("ZIPFILES")->AsBoolean = GetZipFiles();
qryEditRule->ParamByName("ZIPFILENAME")->AsString = GetZipFileName();
qryEditRule->ParamByName("INTERVAL")->AsInteger = GetInterval();
qryEditRule->ParamByName("CHECKTIMES")->AsString = CheckTimes->CommaText;
qryEditRule->ParamByName("TRAVERSEDIRS")->AsBoolean = GetTraverseDirs();
qryEditRule->ParamByName("SHOWALERT")->AsBoolean = GetShowAlert();
qryEditRule->ParamByName("ID")->AsInteger = GetID();
try {
//qryEditRule->ExecSQL();
qryEditRule->ExecProc();
qryEditRule->Connection->Commit();
} catch (Exception &E) {
ShowMessage(E.Message);
qryEditRule->Connection->Rollback();
return;
}
[/syntax]
If this code is ran using TZStoredProc then when I closed the program and the TZConnection is destroyed I get an access violation in fbclient.dll. I've attached a stack trace of the exception.
I though it might be becuase I was instantiating it programatically but even if I drop the component onto a form and use that, the same thing happens. And using TZQuery doesn't create the same problem. Using normal pointers doesn't make a difference either.
Any ideas what could be going wrong?
I'm using BCB 6 update 4 and ZeosLib 6.5.1 alpha.
TIA
EDIT:
I also get an invalid staement handle exception, although it doesn't always happen. Stack trace for that is attached as well
Code is as follows...
[syntax="c"]
std::auto_ptr<TZStoredProc> qryEditRule(new TZStoredProc(NULL));
//std::auto_ptr<TZReadOnlyQuery> qryEditRule(new TZReadOnlyQuery(NULL));
qryEditRule->Connection = frmData->Database;
qryEditRule->StoredProcName = "CHANGE_FTP_RULE_SP";
/*qryEditRule->SQL->Add("UPDATE FTP SET \"NAME\" = :NAME,");
qryEditRule->SQL->Add("\"ENABLED\" = :ENABLED, \"TYPE\" = :TYPE,");
qryEditRule->SQL->Add("\"SERVER\" = :SERVER, \"FILES\" = :FILES,");
qryEditRule->SQL->Add("\"REMOTEPATH\" = :REMOTEPATH,");
qryEditRule->SQL->Add("\"DELETEFILES\" = :DELETEFILES,");
qryEditRule->SQL->Add("\"SAVEFILES\" = :SAVEFILES, \"SAVEPATHS\" = :SAVEPATHS,");
qryEditRule->SQL->Add("\"ZIPFILES\" = :ZIPFILES,");
qryEditRule->SQL->Add("\"ZIPFILENAME\" = :ZIPFILENAME,");
qryEditRule->SQL->Add("\"INTERVAL\" = :INTERVAL,");
qryEditRule->SQL->Add("\"CHECKTIMES\" = :CHECKTIMES,");
qryEditRule->SQL->Add("\"TRAVERSEDIRS\" = :TRAVERSEDIRS,");
qryEditRule->SQL->Add("\"SHOWALERT\" = :SHOWALERT");
qryEditRule->SQL->Add("WHERE \"ID\" = :ID");*/
qryEditRule->ParamByName("NAME")->AsString = GetName();
qryEditRule->ParamByName("ENABLED")->AsBoolean = GetEnabled();
qryEditRule->ParamByName("TYPE")->AsInteger = (int)GetType();
qryEditRule->ParamByName("SERVER")->AsInteger = GetServer();
qryEditRule->ParamByName("FILES")->AsString = Files->CommaText;
qryEditRule->ParamByName("DELETEFILES")->AsBoolean = GetDeleteFiles();
qryEditRule->ParamByName("REMOTEPATH")->AsString = GetRemotePath();
qryEditRule->ParamByName("SAVEFILES")->AsBoolean = GetSaveFiles();
qryEditRule->ParamByName("SAVEPATHS")->AsString = SavePaths->CommaText;
qryEditRule->ParamByName("ZIPFILES")->AsBoolean = GetZipFiles();
qryEditRule->ParamByName("ZIPFILENAME")->AsString = GetZipFileName();
qryEditRule->ParamByName("INTERVAL")->AsInteger = GetInterval();
qryEditRule->ParamByName("CHECKTIMES")->AsString = CheckTimes->CommaText;
qryEditRule->ParamByName("TRAVERSEDIRS")->AsBoolean = GetTraverseDirs();
qryEditRule->ParamByName("SHOWALERT")->AsBoolean = GetShowAlert();
qryEditRule->ParamByName("ID")->AsInteger = GetID();
try {
//qryEditRule->ExecSQL();
qryEditRule->ExecProc();
qryEditRule->Connection->Commit();
} catch (Exception &E) {
ShowMessage(E.Message);
qryEditRule->Connection->Rollback();
return;
}
[/syntax]
If this code is ran using TZStoredProc then when I closed the program and the TZConnection is destroyed I get an access violation in fbclient.dll. I've attached a stack trace of the exception.
I though it might be becuase I was instantiating it programatically but even if I drop the component onto a form and use that, the same thing happens. And using TZQuery doesn't create the same problem. Using normal pointers doesn't make a difference either.
Any ideas what could be going wrong?
I'm using BCB 6 update 4 and ZeosLib 6.5.1 alpha.
TIA
EDIT:
I also get an invalid staement handle exception, although it doesn't always happen. Stack trace for that is attached as well