/ Check-in [54aa0fb2]
Login

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

Overview
Comment:Allow quoted trigger names. Ticket #468. (CVS 1109)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:54aa0fb236d17b53b194a667d68c71007c8e7687
User & Date: drh 2003-10-03 00:13:39
Context
2003-10-10
02:09
Update to the date functions. (CVS 1110) check-in: 06d4e883 user: drh tags: trunk
2003-10-03
00:13
Allow quoted trigger names. Ticket #468. (CVS 1109) check-in: 54aa0fb2 user: drh tags: trunk
2003-09-30
01:54
All LIKE and GLOB operators to use function notation. "A LIKE B" can be expressed as "LIKE(B,A)". (CVS 1108) check-in: 95b27ebd user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/trigger.c.

79
80
81
82
83
84
85

86
87
88
89
90
91
92
  if( iDb>=2 && !pParse->initFlag ){
    sqliteErrorMsg(pParse, "triggers may not be added to auxiliary "
       "database %s", db->aDb[tab->iDb].zName);
    goto trigger_cleanup;
  }

  zName = sqliteStrNDup(pName->z, pName->n);

  if( sqliteHashFind(&(db->aDb[iDb].trigHash), zName,pName->n+1) ){
    sqliteErrorMsg(pParse, "trigger %T already exists", pName);
    goto trigger_cleanup;
  }
  if( sqliteStrNICmp(tab->zName, "sqlite_", 7)==0 ){
    sqliteErrorMsg(pParse, "cannot create trigger on system table");
    pParse->nErr++;







>







79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
  if( iDb>=2 && !pParse->initFlag ){
    sqliteErrorMsg(pParse, "triggers may not be added to auxiliary "
       "database %s", db->aDb[tab->iDb].zName);
    goto trigger_cleanup;
  }

  zName = sqliteStrNDup(pName->z, pName->n);
  sqliteDequote(zName);
  if( sqliteHashFind(&(db->aDb[iDb].trigHash), zName,pName->n+1) ){
    sqliteErrorMsg(pParse, "trigger %T already exists", pName);
    goto trigger_cleanup;
  }
  if( sqliteStrNICmp(tab->zName, "sqlite_", 7)==0 ){
    sqliteErrorMsg(pParse, "cannot create trigger on system table");
    pParse->nErr++;

Changes to test/trigger1.test.

346
347
348
349
350
351
352
353
354








































355
} {3 4 7 8}
do_test trigger-6.8 {
  db close
  sqlite db test.db
  execsql {SELECT * FROM t2}
} {3 4 7 8}

integrity_check trigger-7.1    









































finish_test







|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
} {3 4 7 8}
do_test trigger-6.8 {
  db close
  sqlite db test.db
  execsql {SELECT * FROM t2}
} {3 4 7 8}

integrity_check trigger-7.1

# Check to make sure the name of a trigger can be quoted so that keywords
# can be used as trigger names.  Ticket #468
#
do_test trigger-8.1 {
  execsql {
    CREATE TRIGGER 'trigger' AFTER INSERT ON t2 BEGIN SELECT 1; END;
    SELECT name FROM sqlite_master WHERE type='trigger';
  }
} {trigger}
do_test trigger-8.2 {
  execsql {
    DROP TRIGGER 'trigger';
    SELECT name FROM sqlite_master WHERE type='trigger';
  }
} {}
do_test trigger-8.3 {
  execsql {
    CREATE TRIGGER "trigger" AFTER INSERT ON t2 BEGIN SELECT 1; END;
    SELECT name FROM sqlite_master WHERE type='trigger';
  }
} {trigger}
do_test trigger-8.4 {
  execsql {
    DROP TRIGGER "trigger";
    SELECT name FROM sqlite_master WHERE type='trigger';
  }
} {}
do_test trigger-8.5 {
  execsql {
    CREATE TRIGGER [trigger] AFTER INSERT ON t2 BEGIN SELECT 1; END;
    SELECT name FROM sqlite_master WHERE type='trigger';
  }
} {trigger}
do_test trigger-8.6 {
  execsql {
    DROP TRIGGER [trigger];
    SELECT name FROM sqlite_master WHERE type='trigger';
  }
} {}

finish_test