mORMot and Open Source friends
Check-in [1429e698cf]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:{2109} enhanced parenthesis support in TSQLRestStorageExternal.AdaptSQLForEngineList
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1429e698cfab2fff9245d1193c03ea359f6c5364
User & Date: ab 2015-11-30 07:23:19
Context
2015-11-30
07:52
{2110} enhanced process loggging in TSQLRestStorageExternal.AdaptSQLForEngineList check-in: df75385aab user: ab tags: trunk
07:23
{2109} enhanced parenthesis support in TSQLRestStorageExternal.AdaptSQLForEngineList check-in: 1429e698cf user: ab tags: trunk
2015-11-29
20:19
{2108} fixed small compilation regression with newest versions of the compiler check-in: 96a6d26ee7 user: ab tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to SQLite3/mORMotDB.pas.

954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
      if n=0 then begin
        if limit.Position=posWhere then begin
          W.AddShort(' where ');
          W.AddString(limitSQL);
        end;
      end else begin
        dec(n);
        if (n>0) and Stmt.Where[1].JoinedOR then
          for f := 2 to n do
          if not Stmt.Where[f].JoinedOR then begin
            InternalLog('%.AdaptSQLForEngineList: Unhandled mixed AND/OR for "%"',
              [self,SQL],sllDebug);
            exit;
          end;
        W.AddShort(' where ');
        if limit.Position=posWhere then begin
          W.AddString(limitSQL);
          W.AddShort(' and ');
        end;
        for f := 0 to n do
        with Stmt.Where[f] do begin






<
<
<
<
<
<
<







954
955
956
957
958
959
960







961
962
963
964
965
966
967
      if n=0 then begin
        if limit.Position=posWhere then begin
          W.AddShort(' where ');
          W.AddString(limitSQL);
        end;
      end else begin
        dec(n);







        W.AddShort(' where ');
        if limit.Position=posWhere then begin
          W.AddString(limitSQL);
          W.AddShort(' and ');
        end;
        for f := 0 to n do
        with Stmt.Where[f] do begin

Changes to SynSelfTests.pas.

9644
9645
9646
9647
9648
9649
9650


9651
9652
9653
9654
9655
9656
9657
        'select id,firstname from SampleRecord where id=2 or lastname=:(''toto''):');
  Test2('select rowid,firstname from PeopleExt where rowid=2 and not lastname like ?',
        'select id,firstname from SampleRecord where id=2 and not lastname like ?');
  Test2('select rowid,firstname from PeopleExt where rowid=2 and not (lastname like ?)',
        'select id,firstname from SampleRecord where id=2 and not (lastname like ?)');
  Test2('select rowid,firstname from PeopleExt where (rowid=2 and lastname="toto") or lastname like ?',
        'select id,firstname from SampleRecord where (id=2 and lastname="toto") or lastname like ?');


  Test2('select rowid,firstname from PeopleExt where (rowid=2) and (lastname="toto" or lastname like ?)',
        'select id,firstname from SampleRecord where (id=2) and (lastname="toto" or lastname like ?)');
  Test2('select rowid,firstname from PeopleExt where (rowid=2) and (lastname=:("toto"): or (lastname like ?))',
        'select id,firstname from SampleRecord where (id=2) and (lastname=:("toto"): or (lastname like ?))');
  Test2('select rowid,firstname from PeopleExt where rowid=2 order by RowID',
        'select id,firstname from SampleRecord where id=2 order by ID');
  Test2('select rowid,firstname from PeopleExt where rowid=2 order by RowID DeSC',






>
>







9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
        'select id,firstname from SampleRecord where id=2 or lastname=:(''toto''):');
  Test2('select rowid,firstname from PeopleExt where rowid=2 and not lastname like ?',
        'select id,firstname from SampleRecord where id=2 and not lastname like ?');
  Test2('select rowid,firstname from PeopleExt where rowid=2 and not (lastname like ?)',
        'select id,firstname from SampleRecord where id=2 and not (lastname like ?)');
  Test2('select rowid,firstname from PeopleExt where (rowid=2 and lastname="toto") or lastname like ?',
        'select id,firstname from SampleRecord where (id=2 and lastname="toto") or lastname like ?');
  Test2('select rowid,firstname from PeopleExt where (rowid=2 or lastname=:("toto"):) and lastname like ?',
        'select id,firstname from SampleRecord where (id=2 or lastname=:("toto"):) and lastname like ?');
  Test2('select rowid,firstname from PeopleExt where (rowid=2) and (lastname="toto" or lastname like ?)',
        'select id,firstname from SampleRecord where (id=2) and (lastname="toto" or lastname like ?)');
  Test2('select rowid,firstname from PeopleExt where (rowid=2) and (lastname=:("toto"): or (lastname like ?))',
        'select id,firstname from SampleRecord where (id=2) and (lastname=:("toto"): or (lastname like ?))');
  Test2('select rowid,firstname from PeopleExt where rowid=2 order by RowID',
        'select id,firstname from SampleRecord where id=2 order by ID');
  Test2('select rowid,firstname from PeopleExt where rowid=2 order by RowID DeSC',

Changes to SynopseCommit.inc.

1
'1.18.2108'
|
1
'1.18.2109'