View Issue Details

IDProjectCategoryView StatusLast Update
0026137FPCDatabasepublic2014-06-15 11:36
ReporterBigChimpAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformx64 (with x86 compiler)OSWindowsOS VersionWindows 7
Product Version2.7.1Product Build27739 
Target Version3.0.0Fixed in Version3.0.0 
Summary0026137: TSQLScript treats ; as ignoring entire rest of file; errors with -- comments
DescriptionWhen running a script with a single ; on a line by itself, TSQLScript ignores the rest of the script.

The value of CommentsInSQL has no effect on this

See attached test program which should create a firebird embedded database with triggers; instead, no triggers are created.

2. When running a script with starting comments --, sqldb query ExecSQL gives an error.

The value of CommentsInSQL has no effect on this (it seems to strip out /* */ comments, not -- comments).
Reproduce: the test program using separately uploaded (on 12 May) createobjects.sql
TagsNo tags attached.
Fixed in Revision27931
FPCOldBugId0
FPCTarget
Attached Files

Activities

Reinier Olislagers

2014-05-09 16:09

developer  

tsqlscriptbug.zip (4,611 bytes)

Reinier Olislagers

2014-05-12 11:13

developer  

createobjects.sql (18,646 bytes)

Reinier Olislagers

2014-05-12 13:47

developer   ~0074942

Last edited: 2014-05-12 14:00

View 3 revisions

Ad 2 - test program+notes: Firebird 2.5 returns unexpected end of command for a non existing column:
program fbminimal;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Classes, sysutils,
  sqldb,
  ibconnection;

{
No need for DDL just an existing db will do
}

var
  Conn: TibConnection; {*REPLACE WITH RELEVANT CONNECTION *}
  Tran: TSQLTransaction;
  Q: TSQLQuery;
begin
  Conn:=TIBConnection.create(nil); {*REPLACE WITH RELEVANT CONNECTION *}
  Tran:=TSQLTransaction.create(nil);
  Q:=TSQLQuery.Create(nil);
  try
    // *REMOVE IDENTIFYING INFO AND EDIT AS NEEDED*
    Conn.HostName:='';
    Conn.UserName:='';
    Conn.Password:='';
    Conn.DatabaseName:='test.fdb';
    // *END IDENTIFIYING INFO*
    Conn.Transaction:=Tran;
    Q.DataBase:=Conn;
    Conn.Open;
    Q.SQL.Text:='-- just some comments';
    {
    Q.Open;
    EIBDatabaseError: : PrepareStatement :
     -Dynamic SQL Error
     -SQL error code = -104
     -Unexpected end of command - line 0, column -560087
    }
    Q.ExecSQL;
    {
    Q.ExecSQL gives error in
    IBConnection TIBConnection.PrepareStatement line 684
    if isc_dsql_prepare(@Status[0], @tr, @Statement, 0, @Buf[1], Dialect, nil) <> 0 then
      CheckError('PrepareStatement', Status);

    An unhandled exception occurred at $004344B3:
    EIBDatabaseError: : PrepareStatement :
     -Dynamic SQL Error
     -SQL error code = -104
     -Unexpected end of command - line 1, column 46036009
    GDS error code 335544569
    }
    Q.Close;
    Conn.Close;
  finally
    Q.Free;
    Tran.Free;
    Conn.Free;
  end;
  writeln('Program complete. Press a key to continue.');
  readln;
end.

Turns out Firebird support comments but does require valid sql - no (de facto) empty commands are accepted (see http://tracker.firebirdsql.org/browse/CORE-1620)

E.g. this works in Firebird ISQL:
SQL> -- just some comments;
SQL> select 'real sql' from rdb$database;

CONSTANT
========
real sql

Michael Van Canneyt

2014-06-11 08:42

administrator   ~0075627

Fixed.
Empty statements are still not reported, though. Maybe later an option can be added to execute those nevertheless.

Issue History

Date Modified Username Field Change
2014-05-09 16:09 Reinier Olislagers New Issue
2014-05-09 16:09 Reinier Olislagers File Added: tsqlscriptbug.zip
2014-05-10 14:01 Reinier Olislagers Assigned To => Reinier Olislagers
2014-05-10 14:01 Reinier Olislagers Status new => assigned
2014-05-12 11:12 Reinier Olislagers Description Updated View Revisions
2014-05-12 11:13 Reinier Olislagers File Added: createobjects.sql
2014-05-12 11:13 Reinier Olislagers Summary TSQLScript treats ; as commenting entire rest of file instead perhaps one line => TSQLScript treats ; as ignoring entire rest of file; errors with -- comments
2014-05-12 13:47 Reinier Olislagers Note Added: 0074942
2014-05-12 13:57 Reinier Olislagers Note Edited: 0074942 View Revisions
2014-05-12 14:00 Reinier Olislagers Note Edited: 0074942 View Revisions
2014-06-11 08:42 Michael Van Canneyt Fixed in Revision => 27931
2014-06-11 08:42 Michael Van Canneyt Note Added: 0075627
2014-06-11 08:42 Michael Van Canneyt Status assigned => resolved
2014-06-11 08:42 Michael Van Canneyt Fixed in Version => 2.7.1
2014-06-11 08:42 Michael Van Canneyt Resolution open => fixed
2014-06-11 08:42 Michael Van Canneyt Assigned To Reinier Olislagers => Michael Van Canneyt
2014-06-11 08:42 Michael Van Canneyt Target Version => 2.8.0
2014-06-15 11:36 Reinier Olislagers Status resolved => closed