View Issue Details

IDProjectCategoryView StatusLast Update
0033863FPCPatchpublic2018-06-17 15:51
ReporterOndrej PokornyAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version3.1.1Product Build 
Target Version3.2.0Fixed in Version3.1.1 
Summary0033863: [fcl-db] Add CreateQuery virtual method to TSQLScript
DescriptionCurrently there is no way to change TSQLScript.FQuery parameters.

E.g. I need to set TSQLQuery.PacketRecords property to -1 in order to fix the "Error 20019 : Attempt to initiate a new Adaptive Server operation with results pending" (see http://wiki.freepascal.org/mssqlconn#Error_20019_:_Attempt_to_initiate_a_new_Adaptive_Server_operation_with_results_pending )

The attached patch adds a virtual method that allows to create a custom FQuery or set its parameters.
TagsNo tags attached.
Fixed in Revision39238
FPCOldBugId
FPCTarget
Attached Files
  • TSQLScript.CreateQuery-01.patch (1,110 bytes)
    Index: sqldb.pp
    ===================================================================
    --- sqldb.pp	(revision 39228)
    +++ sqldb.pp	(working copy)
    @@ -694,6 +694,7 @@
         Procedure SetDatabase (Value : TDatabase); virtual;
         Procedure SetTransaction(Value : TDBTransaction); virtual;
         Procedure CheckDatabase;
    +    function CreateQuery: TCustomSQLQuery; virtual;
       public
         constructor Create(AOwner : TComponent); override;
         destructor Destroy; override;
    @@ -3319,11 +3320,16 @@
         DatabaseError(SErrNoDatabaseAvailable,Self)
     end;
     
    +function TSQLScript.CreateQuery: TCustomSQLQuery;
    +begin
    +  Result := TCustomSQLQuery.Create(nil);
    +  Result.ParamCheck := false; // Do not parse for parameters; breaks use of e.g. select bla into :bla in Firebird procedures
    +end;
    +
     constructor TSQLScript.Create(AOwner: TComponent);
     begin
       inherited Create(AOwner);
    -  FQuery := TCustomSQLQuery.Create(nil);
    -  FQuery.ParamCheck := false; // Do not parse for parameters; breaks use of e.g. select bla into :bla in Firebird procedures
    +  FQuery := CreateQuery;
     end;
     
     destructor TSQLScript.Destroy;
    

Activities

Ondrej Pokorny

2018-06-15 07:34

developer  

TSQLScript.CreateQuery-01.patch (1,110 bytes)
Index: sqldb.pp
===================================================================
--- sqldb.pp	(revision 39228)
+++ sqldb.pp	(working copy)
@@ -694,6 +694,7 @@
     Procedure SetDatabase (Value : TDatabase); virtual;
     Procedure SetTransaction(Value : TDBTransaction); virtual;
     Procedure CheckDatabase;
+    function CreateQuery: TCustomSQLQuery; virtual;
   public
     constructor Create(AOwner : TComponent); override;
     destructor Destroy; override;
@@ -3319,11 +3320,16 @@
     DatabaseError(SErrNoDatabaseAvailable,Self)
 end;
 
+function TSQLScript.CreateQuery: TCustomSQLQuery;
+begin
+  Result := TCustomSQLQuery.Create(nil);
+  Result.ParamCheck := false; // Do not parse for parameters; breaks use of e.g. select bla into :bla in Firebird procedures
+end;
+
 constructor TSQLScript.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
-  FQuery := TCustomSQLQuery.Create(nil);
-  FQuery.ParamCheck := false; // Do not parse for parameters; breaks use of e.g. select bla into :bla in Firebird procedures
+  FQuery := CreateQuery;
 end;
 
 destructor TSQLScript.Destroy;

Michael Van Canneyt

2018-06-17 12:12

administrator   ~0108940

Applied, good idea, thank you very much !

Ondrej Pokorny

2018-06-17 15:51

developer   ~0108942

Thank you!

Issue History

Date Modified Username Field Change
2018-06-15 07:34 Ondrej Pokorny New Issue
2018-06-15 07:34 Ondrej Pokorny File Added: TSQLScript.CreateQuery-01.patch
2018-06-16 17:36 Michael Van Canneyt Assigned To => Michael Van Canneyt
2018-06-16 17:36 Michael Van Canneyt Status new => assigned
2018-06-17 12:12 Michael Van Canneyt Fixed in Revision => 39238
2018-06-17 12:12 Michael Van Canneyt Note Added: 0108940
2018-06-17 12:12 Michael Van Canneyt Status assigned => resolved
2018-06-17 12:12 Michael Van Canneyt Fixed in Version => 3.1.1
2018-06-17 12:12 Michael Van Canneyt Resolution open => fixed
2018-06-17 12:12 Michael Van Canneyt Target Version => 3.2.0
2018-06-17 15:51 Ondrej Pokorny Note Added: 0108942
2018-06-17 15:51 Ondrej Pokorny Status resolved => closed