View Issue Details

IDProjectCategoryView StatusLast Update
0038503FPCDatabasepublic2021-02-17 22:09
ReporterMattias Gaertner Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Fixed in Version3.3.1 
Summary0038503: patch for sqldb checking if tsqlquery has a cursor
DescriptionTSQLQuery crashes hard if FStatement.Execute does not create a Cursor (=nil).
Patch adds a check, so that a normal Exception is raised.
TagsNo tags attached.
Fixed in Revision48702
FPCOldBugId
FPCTarget3.2.2
Attached Files

Activities

Mattias Gaertner

2021-02-17 19:03

manager  

sqldb_cursornil.patch (520 bytes)   
Index: packages/fcl-db/src/sqldb/sqldb.pp
===================================================================
--- packages/fcl-db/src/sqldb/sqldb.pp	(revision 48700)
+++ packages/fcl-db/src/sqldb/sqldb.pp	(working copy)
@@ -3137,7 +3137,7 @@
       UpdateServerIndexDefs;
 
     FStatement.Execute;
-    if not Cursor.FSelectable then
+    if (Cursor=nil) or (not Cursor.FSelectable) then
       DatabaseError(SErrNoSelectStatement,Self);
 
     // InternalInitFieldDef is only called after a prepare. i.e. not twice if
sqldb_cursornil.patch (520 bytes)   

Michael Van Canneyt

2021-02-17 22:09

administrator   ~0128986

Applied, thank you.

Strangely enough, if I am correct, your code restores the code as it was originally written.
Someone removed the check for Cursor=Nil, thinking it would always be assigned.

Issue History

Date Modified Username Field Change
2021-02-17 19:03 Mattias Gaertner New Issue
2021-02-17 19:03 Mattias Gaertner File Added: sqldb_cursornil.patch
2021-02-17 22:09 Michael Van Canneyt Assigned To => Michael Van Canneyt
2021-02-17 22:09 Michael Van Canneyt Status new => resolved
2021-02-17 22:09 Michael Van Canneyt Resolution open => fixed
2021-02-17 22:09 Michael Van Canneyt Fixed in Version => 3.3.1
2021-02-17 22:09 Michael Van Canneyt Fixed in Revision => 48702
2021-02-17 22:09 Michael Van Canneyt FPCTarget => 3.2.2
2021-02-17 22:09 Michael Van Canneyt Note Added: 0128986