* Moved some code to avoid problems while handling exceptions

git-svn-id: trunk@12512 -
This commit is contained in:
joost 2009-01-05 12:43:27 +00:00
parent 8922c3e310
commit d6903a4bb6

View File

@ -919,11 +919,17 @@ begin
if FSQLBuf = '' then
DatabaseError(SErrNoStatement);
SQLParser(FSQLBuf);
// There may no error occur between the allocation of the cursor and
// the preparation of the cursor. Because internalclose (which is called in
// case of an exception) assumes that allocated cursors are also prepared,
// and thus calls unprepare.
// A call to unprepare while the cursor is not prepared at all can lead to
// unpredictable results.
if not assigned(fcursor) then
FCursor := Db.AllocateCursorHandle;
SQLParser(FSQLBuf);
if ServerFiltered then
Db.PrepareStatement(Fcursor,sqltr,AddFilter(FSQLBuf),FParams)
else