/ Check-in [972e75bb]
Login

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

Overview
Comment:Version 3.7.12.1
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | apple-osx
Files: files | file ages | folders
SHA1: 972e75bb5d7349297b94cec2f19561ee105a22cf
User & Date: drh 2012-05-22 13:11:12
Context
2012-05-31
00:21
Only call fchown when running as root and supporting files mismatch the database owner & perms check-in: ed53b645 user: adam tags: apple-osx
2012-05-22
13:11
Version 3.7.12.1 check-in: 972e75bb user: drh tags: apple-osx
02:45
Version 3.7.12.1 check-in: 6d326d44 user: drh tags: trunk, release, version-3.7.12.1
2012-05-17
14:17
Stylistic fixes: limit source code line length to 80 characters. C89-style comments only, not C++/C99 style. check-in: 4068abe0 user: drh tags: apple-osx
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Changes to VERSION.

1
3.7.12
|
1
3.7.12.1

Changes to configure.

1
2
3
4
5
6
7
8
9
10
...
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
....
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
....
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
....
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
.....
14028
14029
14030
14031
14032
14033
14034
14035
14036
14037
14038
14039
14040
14041
14042
.....
14081
14082
14083
14084
14085
14086
14087
14088
14089
14090
14091
14092
14093
14094
14095
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.62 for sqlite 3.7.12.
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
## --------------------- ##
## M4sh Initialization.  ##
................................................................................
MFLAGS=
MAKEFLAGS=
SHELL=${CONFIG_SHELL-/bin/sh}

# Identity of this package.
PACKAGE_NAME='sqlite'
PACKAGE_TARNAME='sqlite'
PACKAGE_VERSION='3.7.12'
PACKAGE_STRING='sqlite 3.7.12'
PACKAGE_BUGREPORT=''

# Factoring default headers for most tests.
ac_includes_default="\
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
................................................................................
#
# Report the --help message.
#
if test "$ac_init_help" = "long"; then
  # Omit some internal or obsolete options to make the list less imposing.
  # This message is too long to be a string in the A/UX 3.1 sh.
  cat <<_ACEOF
\`configure' configures sqlite 3.7.12 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.
................................................................................
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
_ACEOF
fi

if test -n "$ac_init_help"; then
  case $ac_init_help in
     short | recursive ) echo "Configuration of sqlite 3.7.12:";;
   esac
  cat <<\_ACEOF

Optional Features:
  --disable-option-checking  ignore unrecognized --enable/--with options
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
................................................................................
    cd "$ac_pwd" || { ac_status=$?; break; }
  done
fi

test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
  cat <<\_ACEOF
sqlite configure 3.7.12
generated by GNU Autoconf 2.62

Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
  exit
fi
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by sqlite $as_me 3.7.12, which was
generated by GNU Autoconf 2.62.  Invocation command line was

  $ $0 $@

_ACEOF
exec 5>>config.log
{
................................................................................

exec 6>&1

# Save the log message, to keep $[0] and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by sqlite $as_me 3.7.12, which was
generated by GNU Autoconf 2.62.  Invocation command line was

  CONFIG_FILES    = $CONFIG_FILES
  CONFIG_HEADERS  = $CONFIG_HEADERS
  CONFIG_LINKS    = $CONFIG_LINKS
  CONFIG_COMMANDS = $CONFIG_COMMANDS
  $ $0 $@
................................................................................
$config_commands

Report bugs to <bug-autoconf@gnu.org>."

_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
sqlite config.status 3.7.12
configured by $0, generated by GNU Autoconf 2.62,
  with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"

Copyright (C) 2008 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."



|







 







|
|







 







|







 







|







 







|













|







 







|







 







|







1
2
3
4
5
6
7
8
9
10
...
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
....
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
....
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
....
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
.....
14028
14029
14030
14031
14032
14033
14034
14035
14036
14037
14038
14039
14040
14041
14042
.....
14081
14082
14083
14084
14085
14086
14087
14088
14089
14090
14091
14092
14093
14094
14095
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.62 for sqlite 3.7.12.1.
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
## --------------------- ##
## M4sh Initialization.  ##
................................................................................
MFLAGS=
MAKEFLAGS=
SHELL=${CONFIG_SHELL-/bin/sh}

# Identity of this package.
PACKAGE_NAME='sqlite'
PACKAGE_TARNAME='sqlite'
PACKAGE_VERSION='3.7.12.1'
PACKAGE_STRING='sqlite 3.7.12.1'
PACKAGE_BUGREPORT=''

# Factoring default headers for most tests.
ac_includes_default="\
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
................................................................................
#
# Report the --help message.
#
if test "$ac_init_help" = "long"; then
  # Omit some internal or obsolete options to make the list less imposing.
  # This message is too long to be a string in the A/UX 3.1 sh.
  cat <<_ACEOF
\`configure' configures sqlite 3.7.12.1 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.
................................................................................
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
_ACEOF
fi

if test -n "$ac_init_help"; then
  case $ac_init_help in
     short | recursive ) echo "Configuration of sqlite 3.7.12.1:";;
   esac
  cat <<\_ACEOF

Optional Features:
  --disable-option-checking  ignore unrecognized --enable/--with options
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
................................................................................
    cd "$ac_pwd" || { ac_status=$?; break; }
  done
fi

test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
  cat <<\_ACEOF
sqlite configure 3.7.12.1
generated by GNU Autoconf 2.62

Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
  exit
fi
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by sqlite $as_me 3.7.12.1, which was
generated by GNU Autoconf 2.62.  Invocation command line was

  $ $0 $@

_ACEOF
exec 5>>config.log
{
................................................................................

exec 6>&1

# Save the log message, to keep $[0] and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by sqlite $as_me 3.7.12.1, which was
generated by GNU Autoconf 2.62.  Invocation command line was

  CONFIG_FILES    = $CONFIG_FILES
  CONFIG_HEADERS  = $CONFIG_HEADERS
  CONFIG_LINKS    = $CONFIG_LINKS
  CONFIG_COMMANDS = $CONFIG_COMMANDS
  $ $0 $@
................................................................................
$config_commands

Report bugs to <bug-autoconf@gnu.org>."

_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
sqlite config.status 3.7.12.1
configured by $0, generated by GNU Autoconf 2.62,
  with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"

Copyright (C) 2008 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."

Changes to src/build.c.

498
499
500
501
502
503
504






505
506
507

508
509
510
511
512
513






514
515
516
517
518
519
520
...
539
540
541
542
543
544
545



546
547
548
549
550
551
552
....
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
** Remove the memory data structures associated with the given
** Table.  No changes are made to disk by this routine.
**
** This routine just deletes the data structure.  It does not unlink
** the table data structure from the hash table.  But it does destroy
** memory structures of the indices and foreign keys associated with 
** the table.






*/
void sqlite3DeleteTable(sqlite3 *db, Table *pTable){
  Index *pIndex, *pNext;


  assert( !pTable || pTable->nRef>0 );

  /* Do not delete the table until the reference count reaches zero. */
  if( !pTable ) return;
  if( ((!db || db->pnBytesFreed==0) && (--pTable->nRef)>0) ) return;







  /* Delete all indices associated with this table. */
  for(pIndex = pTable->pIndex; pIndex; pIndex=pNext){
    pNext = pIndex->pNext;
    assert( pIndex->pSchema==pTable->pSchema );
    if( !db || db->pnBytesFreed==0 ){
      char *zName = pIndex->zName; 
................................................................................
#ifndef SQLITE_OMIT_CHECK
  sqlite3ExprListDelete(db, pTable->pCheck);
#endif
#ifndef SQLITE_OMIT_VIRTUALTABLE
  sqlite3VtabClear(db, pTable);
#endif
  sqlite3DbFree(db, pTable);



}

/*
** Unlink the given table from the hash tables and the delete the
** table structure with all its indices and foreign keys.
*/
void sqlite3UnlinkAndDeleteTable(sqlite3 *db, int iDb, const char *zTabName){
................................................................................
    memset(&sSrc, 0, sizeof(sSrc));
    sSrc.nSrc = 1;
    sSrc.a[0].zName = p->zName;
    sSrc.a[0].pTab = p;
    sSrc.a[0].iCursor = -1;
    sNC.pParse = pParse;
    sNC.pSrcList = &sSrc;
    sNC.isCheck = 1;
    pList = p->pCheck;
    for(i=0; i<pList->nExpr; i++){
      if( sqlite3ResolveExprNames(&sNC, pList->a[i].pExpr) ){
        return;
      }
    }
  }







>
>
>
>
>
>



>






>
>
>
>
>
>







 







>
>
>







 







|







498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
...
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
....
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
** Remove the memory data structures associated with the given
** Table.  No changes are made to disk by this routine.
**
** This routine just deletes the data structure.  It does not unlink
** the table data structure from the hash table.  But it does destroy
** memory structures of the indices and foreign keys associated with 
** the table.
**
** The db parameter is optional.  It is needed if the Table object 
** contains lookaside memory.  (Table objects in the schema do not use
** lookaside memory, but some ephemeral Table objects do.)  Or the
** db parameter can be used with db->pnBytesFreed to measure the memory
** used by the Table object.
*/
void sqlite3DeleteTable(sqlite3 *db, Table *pTable){
  Index *pIndex, *pNext;
  TESTONLY( int nLookaside; ) /* Used to verify lookaside not used for schema */

  assert( !pTable || pTable->nRef>0 );

  /* Do not delete the table until the reference count reaches zero. */
  if( !pTable ) return;
  if( ((!db || db->pnBytesFreed==0) && (--pTable->nRef)>0) ) return;

  /* Record the number of outstanding lookaside allocations in schema Tables
  ** prior to doing any free() operations.  Since schema Tables do not use
  ** lookaside, this number should not change. */
  TESTONLY( nLookaside = (db && (pTable->tabFlags & TF_Ephemeral)==0) ?
                         db->lookaside.nOut : 0 );

  /* Delete all indices associated with this table. */
  for(pIndex = pTable->pIndex; pIndex; pIndex=pNext){
    pNext = pIndex->pNext;
    assert( pIndex->pSchema==pTable->pSchema );
    if( !db || db->pnBytesFreed==0 ){
      char *zName = pIndex->zName; 
................................................................................
#ifndef SQLITE_OMIT_CHECK
  sqlite3ExprListDelete(db, pTable->pCheck);
#endif
#ifndef SQLITE_OMIT_VIRTUALTABLE
  sqlite3VtabClear(db, pTable);
#endif
  sqlite3DbFree(db, pTable);

  /* Verify that no lookaside memory was used by schema tables */
  assert( nLookaside==0 || nLookaside==db->lookaside.nOut );
}

/*
** Unlink the given table from the hash tables and the delete the
** table structure with all its indices and foreign keys.
*/
void sqlite3UnlinkAndDeleteTable(sqlite3 *db, int iDb, const char *zTabName){
................................................................................
    memset(&sSrc, 0, sizeof(sSrc));
    sSrc.nSrc = 1;
    sSrc.a[0].zName = p->zName;
    sSrc.a[0].pTab = p;
    sSrc.a[0].iCursor = -1;
    sNC.pParse = pParse;
    sNC.pSrcList = &sSrc;
    sNC.ncFlags = NC_IsCheck;
    pList = p->pCheck;
    for(i=0; i<pList->nExpr; i++){
      if( sqlite3ResolveExprNames(&sNC, pList->a[i].pExpr) ){
        return;
      }
    }
  }

Changes to src/expr.c.

3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
....
3961
3962
3963
3964
3965
3966
3967

3968

3969
3970
3971
3972
3973
3974
3975
....
3998
3999
4000
4001
4002
4003
4004

4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
  if( sqlite3ExprCompare(pA->pRight, pB->pRight) ) return 2;
  if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList) ) return 2;
  if( pA->iTable!=pB->iTable || pA->iColumn!=pB->iColumn ) return 2;
  if( ExprHasProperty(pA, EP_IntValue) ){
    if( !ExprHasProperty(pB, EP_IntValue) || pA->u.iValue!=pB->u.iValue ){
      return 2;
    }
  }else if( pA->op!=TK_COLUMN && pA->op!=TK_AGG_COLUMN && pA->u.zToken ){
    if( ExprHasProperty(pB, EP_IntValue) || NEVER(pB->u.zToken==0) ) return 2;
    if( strcmp(pA->u.zToken,pB->u.zToken)!=0 ){
      return 2;
    }
  }
  if( (pA->flags & EP_ExpCollate)!=(pB->flags & EP_ExpCollate) ) return 1;
  if( (pA->flags & EP_ExpCollate)!=0 && pA->pColl!=pB->pColl ) return 2;
................................................................................
            break;
          } /* endif pExpr->iTable==pItem->iCursor */
        } /* end loop over pSrcList */
      }
      return WRC_Prune;
    }
    case TK_AGG_FUNCTION: {

      if( !sqlite3FunctionUsesOtherSrc(pExpr, pSrcList) ){

        /* Check to see if pExpr is a duplicate of another aggregate 
        ** function that is already in the pAggInfo structure
        */
        struct AggInfo_func *pItem = pAggInfo->aFunc;
        for(i=0; i<pAggInfo->nFunc; i++, pItem++){
          if( sqlite3ExprCompare(pItem->pExpr, pExpr)==0 ){
            break;
................................................................................
        }
        /* Make pExpr point to the appropriate pAggInfo->aFunc[] entry
        */
        assert( !ExprHasAnyProperty(pExpr, EP_TokenOnly|EP_Reduced) );
        ExprSetIrreducible(pExpr);
        pExpr->iAgg = (i16)i;
        pExpr->pAggInfo = pAggInfo;

        return WRC_Prune;
      }
    }
  }
  return WRC_Continue;
}
static int analyzeAggregatesInSelect(Walker *pWalker, Select *pSelect){
  UNUSED_PARAMETER(pWalker);
  UNUSED_PARAMETER(pSelect);
  return WRC_Continue;
}







|







 







>
|
>







 







>



<







3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
....
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
....
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010

4011
4012
4013
4014
4015
4016
4017
  if( sqlite3ExprCompare(pA->pRight, pB->pRight) ) return 2;
  if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList) ) return 2;
  if( pA->iTable!=pB->iTable || pA->iColumn!=pB->iColumn ) return 2;
  if( ExprHasProperty(pA, EP_IntValue) ){
    if( !ExprHasProperty(pB, EP_IntValue) || pA->u.iValue!=pB->u.iValue ){
      return 2;
    }
  }else if( pA->op!=TK_COLUMN && ALWAYS(pA->op!=TK_AGG_COLUMN) && pA->u.zToken){
    if( ExprHasProperty(pB, EP_IntValue) || NEVER(pB->u.zToken==0) ) return 2;
    if( strcmp(pA->u.zToken,pB->u.zToken)!=0 ){
      return 2;
    }
  }
  if( (pA->flags & EP_ExpCollate)!=(pB->flags & EP_ExpCollate) ) return 1;
  if( (pA->flags & EP_ExpCollate)!=0 && pA->pColl!=pB->pColl ) return 2;
................................................................................
            break;
          } /* endif pExpr->iTable==pItem->iCursor */
        } /* end loop over pSrcList */
      }
      return WRC_Prune;
    }
    case TK_AGG_FUNCTION: {
      if( (pNC->ncFlags & NC_InAggFunc)==0
       && !sqlite3FunctionUsesOtherSrc(pExpr, pSrcList)
      ){
        /* Check to see if pExpr is a duplicate of another aggregate 
        ** function that is already in the pAggInfo structure
        */
        struct AggInfo_func *pItem = pAggInfo->aFunc;
        for(i=0; i<pAggInfo->nFunc; i++, pItem++){
          if( sqlite3ExprCompare(pItem->pExpr, pExpr)==0 ){
            break;
................................................................................
        }
        /* Make pExpr point to the appropriate pAggInfo->aFunc[] entry
        */
        assert( !ExprHasAnyProperty(pExpr, EP_TokenOnly|EP_Reduced) );
        ExprSetIrreducible(pExpr);
        pExpr->iAgg = (i16)i;
        pExpr->pAggInfo = pAggInfo;
      }
      return WRC_Prune;
    }
  }

  return WRC_Continue;
}
static int analyzeAggregatesInSelect(Walker *pWalker, Select *pSelect){
  UNUSED_PARAMETER(pWalker);
  UNUSED_PARAMETER(pSelect);
  return WRC_Continue;
}

Changes to src/malloc.c.

487
488
489
490
491
492
493




494
495
496
497
498
499
500
  if( db ){
    if( db->pnBytesFreed ){
      *db->pnBytesFreed += sqlite3DbMallocSize(db, p);
      return;
    }
    if( isLookaside(db, p) ){
      LookasideSlot *pBuf = (LookasideSlot*)p;




      pBuf->pNext = db->lookaside.pFree;
      db->lookaside.pFree = pBuf;
      db->lookaside.nOut--;
      return;
    }
  }
  assert( sqlite3MemdebugHasType(p, MEMTYPE_DB) );







>
>
>
>







487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
  if( db ){
    if( db->pnBytesFreed ){
      *db->pnBytesFreed += sqlite3DbMallocSize(db, p);
      return;
    }
    if( isLookaside(db, p) ){
      LookasideSlot *pBuf = (LookasideSlot*)p;
#if SQLITE_DEBUG
      /* Trash all content in the buffer being freed */
      memset(p, 0xaa, db->lookaside.sz);
#endif
      pBuf->pNext = db->lookaside.pFree;
      db->lookaside.pFree = pBuf;
      db->lookaside.nOut--;
      return;
    }
  }
  assert( sqlite3MemdebugHasType(p, MEMTYPE_DB) );

Changes to src/prepare.c.

705
706
707
708
709
710
711

712
713
714
715
716
717
718
  rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, pOld, ppStmt, pzTail);
  if( rc==SQLITE_SCHEMA ){
    sqlite3_finalize(*ppStmt);
    rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, pOld, ppStmt, pzTail);
  }
  sqlite3BtreeLeaveAll(db);
  sqlite3_mutex_leave(db->mutex);

  return rc;
}

/*
** Rerun the compilation of a statement after a schema change.
**
** If the statement is successfully recompiled, return SQLITE_OK. Otherwise,







>







705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
  rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, pOld, ppStmt, pzTail);
  if( rc==SQLITE_SCHEMA ){
    sqlite3_finalize(*ppStmt);
    rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, pOld, ppStmt, pzTail);
  }
  sqlite3BtreeLeaveAll(db);
  sqlite3_mutex_leave(db->mutex);
  assert( rc==SQLITE_OK || *ppStmt==0 );
  return rc;
}

/*
** Rerun the compilation of a statement after a schema change.
**
** If the statement is successfully recompiled, return SQLITE_OK. Otherwise,

Changes to src/resolve.c.

307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
...
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
...
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
...
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
...
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
....
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
....
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
....
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
        char *zAs = pEList->a[j].zName;
        if( zAs!=0 && sqlite3StrICmp(zAs, zCol)==0 ){
          Expr *pOrig;
          assert( pExpr->pLeft==0 && pExpr->pRight==0 );
          assert( pExpr->x.pList==0 );
          assert( pExpr->x.pSelect==0 );
          pOrig = pEList->a[j].pExpr;
          if( !pNC->allowAgg && ExprHasProperty(pOrig, EP_Agg) ){
            sqlite3ErrorMsg(pParse, "misuse of aliased aggregate %s", zAs);
            return WRC_Abort;
          }
          resolveAlias(pParse, pEList, j, pExpr, "");
          cnt = 1;
          pMatch = 0;
          assert( zTab==0 && zDb==0 );
................................................................................
            pNC->nErr++;
          }
          pExpr->op = TK_NULL;
          return WRC_Prune;
        }
      }
#endif
      if( is_agg && !pNC->allowAgg ){
        sqlite3ErrorMsg(pParse, "misuse of aggregate function %.*s()", nId,zId);
        pNC->nErr++;
        is_agg = 0;
      }else if( no_such_func ){
        sqlite3ErrorMsg(pParse, "no such function: %.*s", nId, zId);
        pNC->nErr++;
      }else if( wrong_num_args ){
        sqlite3ErrorMsg(pParse,"wrong number of arguments to function %.*s()",
             nId, zId);
        pNC->nErr++;
      }
      if( is_agg ){
        pExpr->op = TK_AGG_FUNCTION;
        pNC->hasAgg = 1;
      }
      if( is_agg ) pNC->allowAgg = 0;
      sqlite3WalkExprList(pWalker, pList);
      if( is_agg ) pNC->allowAgg = 1;
      /* FIX ME:  Compute pExpr->affinity based on the expected return
      ** type of the function 
      */
      return WRC_Prune;
    }
#ifndef SQLITE_OMIT_SUBQUERY
    case TK_SELECT:
................................................................................
    case TK_EXISTS:  testcase( pExpr->op==TK_EXISTS );
#endif
    case TK_IN: {
      testcase( pExpr->op==TK_IN );
      if( ExprHasProperty(pExpr, EP_xIsSelect) ){
        int nRef = pNC->nRef;
#ifndef SQLITE_OMIT_CHECK
        if( pNC->isCheck ){
          sqlite3ErrorMsg(pParse,"subqueries prohibited in CHECK constraints");
        }
#endif
        sqlite3WalkSelect(pWalker, pExpr->x.pSelect);
        assert( pNC->nRef>=nRef );
        if( nRef!=pNC->nRef ){
          ExprSetProperty(pExpr, EP_VarSelect);
        }
      }
      break;
    }
#ifndef SQLITE_OMIT_CHECK
    case TK_VARIABLE: {
      if( pNC->isCheck ){
        sqlite3ErrorMsg(pParse,"parameters prohibited in CHECK constraints");
      }
      break;
    }
#endif
  }
  return (pParse->nErr || pParse->db->mallocFailed) ? WRC_Abort : WRC_Continue;
................................................................................

  /* Resolve all names in the ORDER BY term expression
  */
  memset(&nc, 0, sizeof(nc));
  nc.pParse = pParse;
  nc.pSrcList = pSelect->pSrc;
  nc.pEList = pEList;
  nc.allowAgg = 1;
  nc.nErr = 0;
  db = pParse->db;
  savedSuppErr = db->suppressErr;
  db->suppressErr = 1;
  rc = sqlite3ResolveExprNames(&nc, pE);
  db->suppressErr = savedSuppErr;
  if( rc ) return 0;
................................................................................
        sqlite3ResolveExprNames(&sNC, p->pOffset) ){
      return WRC_Abort;
    }
  
    /* Set up the local name-context to pass to sqlite3ResolveExprNames() to
    ** resolve the result-set expression list.
    */
    sNC.allowAgg = 1;
    sNC.pSrcList = p->pSrc;
    sNC.pNext = pOuterNC;
  
    /* Resolve names in the result set. */
    pEList = p->pEList;
    assert( pEList!=0 );
    for(i=0; i<pEList->nExpr; i++){
................................................................................
    }
  
    /* If there are no aggregate functions in the result-set, and no GROUP BY 
    ** expression, do not allow aggregates in any of the other expressions.
    */
    assert( (p->selFlags & SF_Aggregate)==0 );
    pGroupBy = p->pGroupBy;
    if( pGroupBy || sNC.hasAgg ){
      p->selFlags |= SF_Aggregate;
    }else{
      sNC.allowAgg = 0;
    }
  
    /* If a HAVING clause is present, then there must be a GROUP BY clause.
    */
    if( p->pHaving && !pGroupBy ){
      sqlite3ErrorMsg(pParse, "a GROUP BY clause is required before HAVING");
      return WRC_Abort;
................................................................................
      return WRC_Abort;
    }

    /* The ORDER BY and GROUP BY clauses may not refer to terms in
    ** outer queries 
    */
    sNC.pNext = 0;
    sNC.allowAgg = 1;

    /* Process the ORDER BY clause for singleton SELECT statements.
    ** The ORDER BY clause for compounds SELECT statements is handled
    ** below, after all of the result-sets for all of the elements of
    ** the compound have been resolved.
    */
    if( !isCompound && resolveOrderGroupBy(&sNC, p, p->pOrderBy, "ORDER") ){
................................................................................
**
** The "x" term of the order by is replaced by "a+b" to render:
**
**      SELECT a+b AS x, c+d AS y FROM t1 ORDER BY a+b;
**
** Function calls are checked to make sure that the function is 
** defined and that the correct number of arguments are specified.
** If the function is an aggregate function, then the pNC->hasAgg is
** set and the opcode is changed from TK_FUNCTION to TK_AGG_FUNCTION.
** If an expression contains aggregate functions then the EP_Agg
** property on the expression is set.
**
** An error message is left in pParse if anything is amiss.  The number
** if errors is returned.
*/
int sqlite3ResolveExprNames( 
  NameContext *pNC,       /* Namespace to resolve expressions in. */
  Expr *pExpr             /* The expression to be analyzed. */
){
  int savedHasAgg;
  Walker w;

  if( pExpr==0 ) return 0;
#if SQLITE_MAX_EXPR_DEPTH>0
  {
    Parse *pParse = pNC->pParse;
    if( sqlite3ExprCheckHeight(pParse, pExpr->nHeight+pNC->pParse->nHeight) ){
      return 1;
    }
    pParse->nHeight += pExpr->nHeight;
  }
#endif
  savedHasAgg = pNC->hasAgg;
  pNC->hasAgg = 0;
  w.xExprCallback = resolveExprStep;
  w.xSelectCallback = resolveSelectStep;
  w.pParse = pNC->pParse;
  w.u.pNC = pNC;
  sqlite3WalkExpr(&w, pExpr);
#if SQLITE_MAX_EXPR_DEPTH>0
  pNC->pParse->nHeight -= pExpr->nHeight;
#endif
  if( pNC->nErr>0 || w.pParse->nErr>0 ){
    ExprSetProperty(pExpr, EP_Error);
  }
  if( pNC->hasAgg ){
    ExprSetProperty(pExpr, EP_Agg);
  }else if( savedHasAgg ){
    pNC->hasAgg = 1;
  }
  return ExprHasProperty(pExpr, EP_Error);
}


/*
** Resolve all names in all expressions of a SELECT and in all







|







 







|













|

|

|







 







|













|







 







|







 







|







 







|


|







 







|







 







|











|












|
|











|


|







307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
...
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
...
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
...
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
...
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
....
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
....
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
....
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
        char *zAs = pEList->a[j].zName;
        if( zAs!=0 && sqlite3StrICmp(zAs, zCol)==0 ){
          Expr *pOrig;
          assert( pExpr->pLeft==0 && pExpr->pRight==0 );
          assert( pExpr->x.pList==0 );
          assert( pExpr->x.pSelect==0 );
          pOrig = pEList->a[j].pExpr;
          if( (pNC->ncFlags&NC_AllowAgg)==0 && ExprHasProperty(pOrig, EP_Agg) ){
            sqlite3ErrorMsg(pParse, "misuse of aliased aggregate %s", zAs);
            return WRC_Abort;
          }
          resolveAlias(pParse, pEList, j, pExpr, "");
          cnt = 1;
          pMatch = 0;
          assert( zTab==0 && zDb==0 );
................................................................................
            pNC->nErr++;
          }
          pExpr->op = TK_NULL;
          return WRC_Prune;
        }
      }
#endif
      if( is_agg && (pNC->ncFlags & NC_AllowAgg)==0 ){
        sqlite3ErrorMsg(pParse, "misuse of aggregate function %.*s()", nId,zId);
        pNC->nErr++;
        is_agg = 0;
      }else if( no_such_func ){
        sqlite3ErrorMsg(pParse, "no such function: %.*s", nId, zId);
        pNC->nErr++;
      }else if( wrong_num_args ){
        sqlite3ErrorMsg(pParse,"wrong number of arguments to function %.*s()",
             nId, zId);
        pNC->nErr++;
      }
      if( is_agg ){
        pExpr->op = TK_AGG_FUNCTION;
        pNC->ncFlags |= NC_HasAgg;
      }
      if( is_agg ) pNC->ncFlags &= ~NC_AllowAgg;
      sqlite3WalkExprList(pWalker, pList);
      if( is_agg ) pNC->ncFlags |= NC_AllowAgg;
      /* FIX ME:  Compute pExpr->affinity based on the expected return
      ** type of the function 
      */
      return WRC_Prune;
    }
#ifndef SQLITE_OMIT_SUBQUERY
    case TK_SELECT:
................................................................................
    case TK_EXISTS:  testcase( pExpr->op==TK_EXISTS );
#endif
    case TK_IN: {
      testcase( pExpr->op==TK_IN );
      if( ExprHasProperty(pExpr, EP_xIsSelect) ){
        int nRef = pNC->nRef;
#ifndef SQLITE_OMIT_CHECK
        if( (pNC->ncFlags & NC_IsCheck)!=0 ){
          sqlite3ErrorMsg(pParse,"subqueries prohibited in CHECK constraints");
        }
#endif
        sqlite3WalkSelect(pWalker, pExpr->x.pSelect);
        assert( pNC->nRef>=nRef );
        if( nRef!=pNC->nRef ){
          ExprSetProperty(pExpr, EP_VarSelect);
        }
      }
      break;
    }
#ifndef SQLITE_OMIT_CHECK
    case TK_VARIABLE: {
      if( (pNC->ncFlags & NC_IsCheck)!=0 ){
        sqlite3ErrorMsg(pParse,"parameters prohibited in CHECK constraints");
      }
      break;
    }
#endif
  }
  return (pParse->nErr || pParse->db->mallocFailed) ? WRC_Abort : WRC_Continue;
................................................................................

  /* Resolve all names in the ORDER BY term expression
  */
  memset(&nc, 0, sizeof(nc));
  nc.pParse = pParse;
  nc.pSrcList = pSelect->pSrc;
  nc.pEList = pEList;
  nc.ncFlags = NC_AllowAgg;
  nc.nErr = 0;
  db = pParse->db;
  savedSuppErr = db->suppressErr;
  db->suppressErr = 1;
  rc = sqlite3ResolveExprNames(&nc, pE);
  db->suppressErr = savedSuppErr;
  if( rc ) return 0;
................................................................................
        sqlite3ResolveExprNames(&sNC, p->pOffset) ){
      return WRC_Abort;
    }
  
    /* Set up the local name-context to pass to sqlite3ResolveExprNames() to
    ** resolve the result-set expression list.
    */
    sNC.ncFlags = NC_AllowAgg;
    sNC.pSrcList = p->pSrc;
    sNC.pNext = pOuterNC;
  
    /* Resolve names in the result set. */
    pEList = p->pEList;
    assert( pEList!=0 );
    for(i=0; i<pEList->nExpr; i++){
................................................................................
    }
  
    /* If there are no aggregate functions in the result-set, and no GROUP BY 
    ** expression, do not allow aggregates in any of the other expressions.
    */
    assert( (p->selFlags & SF_Aggregate)==0 );
    pGroupBy = p->pGroupBy;
    if( pGroupBy || (sNC.ncFlags & NC_HasAgg)!=0 ){
      p->selFlags |= SF_Aggregate;
    }else{
      sNC.ncFlags &= ~NC_AllowAgg;
    }
  
    /* If a HAVING clause is present, then there must be a GROUP BY clause.
    */
    if( p->pHaving && !pGroupBy ){
      sqlite3ErrorMsg(pParse, "a GROUP BY clause is required before HAVING");
      return WRC_Abort;
................................................................................
      return WRC_Abort;
    }

    /* The ORDER BY and GROUP BY clauses may not refer to terms in
    ** outer queries 
    */
    sNC.pNext = 0;
    sNC.ncFlags |= NC_AllowAgg;

    /* Process the ORDER BY clause for singleton SELECT statements.
    ** The ORDER BY clause for compounds SELECT statements is handled
    ** below, after all of the result-sets for all of the elements of
    ** the compound have been resolved.
    */
    if( !isCompound && resolveOrderGroupBy(&sNC, p, p->pOrderBy, "ORDER") ){
................................................................................
**
** The "x" term of the order by is replaced by "a+b" to render:
**
**      SELECT a+b AS x, c+d AS y FROM t1 ORDER BY a+b;
**
** Function calls are checked to make sure that the function is 
** defined and that the correct number of arguments are specified.
** If the function is an aggregate function, then the NC_HasAgg flag is
** set and the opcode is changed from TK_FUNCTION to TK_AGG_FUNCTION.
** If an expression contains aggregate functions then the EP_Agg
** property on the expression is set.
**
** An error message is left in pParse if anything is amiss.  The number
** if errors is returned.
*/
int sqlite3ResolveExprNames( 
  NameContext *pNC,       /* Namespace to resolve expressions in. */
  Expr *pExpr             /* The expression to be analyzed. */
){
  u8 savedHasAgg;
  Walker w;

  if( pExpr==0 ) return 0;
#if SQLITE_MAX_EXPR_DEPTH>0
  {
    Parse *pParse = pNC->pParse;
    if( sqlite3ExprCheckHeight(pParse, pExpr->nHeight+pNC->pParse->nHeight) ){
      return 1;
    }
    pParse->nHeight += pExpr->nHeight;
  }
#endif
  savedHasAgg = pNC->ncFlags & NC_HasAgg;
  pNC->ncFlags &= ~NC_HasAgg;
  w.xExprCallback = resolveExprStep;
  w.xSelectCallback = resolveSelectStep;
  w.pParse = pNC->pParse;
  w.u.pNC = pNC;
  sqlite3WalkExpr(&w, pExpr);
#if SQLITE_MAX_EXPR_DEPTH>0
  pNC->pParse->nHeight -= pExpr->nHeight;
#endif
  if( pNC->nErr>0 || w.pParse->nErr>0 ){
    ExprSetProperty(pExpr, EP_Error);
  }
  if( pNC->ncFlags & NC_HasAgg ){
    ExprSetProperty(pExpr, EP_Agg);
  }else if( savedHasAgg ){
    pNC->ncFlags |= NC_HasAgg;
  }
  return ExprHasProperty(pExpr, EP_Error);
}


/*
** Resolve all names in all expressions of a SELECT and in all

Changes to src/select.c.

3145
3146
3147
3148
3149
3150
3151

3152
3153
3154
3155
3156
3157
3158
....
4135
4136
4137
4138
4139
4140
4141

4142

4143
4144
4145
4146
4147
4148
4149
  }
  pTab = p->pSrc->a[0].pTab;
  pExpr = p->pEList->a[0].pExpr;
  assert( pTab && !pTab->pSelect && pExpr );

  if( IsVirtual(pTab) ) return 0;
  if( pExpr->op!=TK_AGG_FUNCTION ) return 0;

  if( (pAggInfo->aFunc[0].pFunc->flags&SQLITE_FUNC_COUNT)==0 ) return 0;
  if( pExpr->flags&EP_Distinct ) return 0;

  return pTab;
}

/*
................................................................................
    sqlite3ExprAnalyzeAggList(&sNC, pOrderBy);
    if( pHaving ){
      sqlite3ExprAnalyzeAggregates(&sNC, pHaving);
    }
    sAggInfo.nAccumulator = sAggInfo.nColumn;
    for(i=0; i<sAggInfo.nFunc; i++){
      assert( !ExprHasProperty(sAggInfo.aFunc[i].pExpr, EP_xIsSelect) );

      sqlite3ExprAnalyzeAggList(&sNC, sAggInfo.aFunc[i].pExpr->x.pList);

    }
    if( db->mallocFailed ) goto select_end;

    /* Processing for aggregates with GROUP BY is very different and
    ** much more complex than aggregates without a GROUP BY.
    */
    if( pGroupBy ){







>







 







>

>







3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
....
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
  }
  pTab = p->pSrc->a[0].pTab;
  pExpr = p->pEList->a[0].pExpr;
  assert( pTab && !pTab->pSelect && pExpr );

  if( IsVirtual(pTab) ) return 0;
  if( pExpr->op!=TK_AGG_FUNCTION ) return 0;
  if( pAggInfo->nFunc==0 ) return 0;
  if( (pAggInfo->aFunc[0].pFunc->flags&SQLITE_FUNC_COUNT)==0 ) return 0;
  if( pExpr->flags&EP_Distinct ) return 0;

  return pTab;
}

/*
................................................................................
    sqlite3ExprAnalyzeAggList(&sNC, pOrderBy);
    if( pHaving ){
      sqlite3ExprAnalyzeAggregates(&sNC, pHaving);
    }
    sAggInfo.nAccumulator = sAggInfo.nColumn;
    for(i=0; i<sAggInfo.nFunc; i++){
      assert( !ExprHasProperty(sAggInfo.aFunc[i].pExpr, EP_xIsSelect) );
      sNC.ncFlags |= NC_InAggFunc;
      sqlite3ExprAnalyzeAggList(&sNC, sAggInfo.aFunc[i].pExpr->x.pList);
      sNC.ncFlags &= ~NC_InAggFunc;
    }
    if( db->mallocFailed ) goto select_end;

    /* Processing for aggregates with GROUP BY is very different and
    ** much more complex than aggregates without a GROUP BY.
    */
    if( pGroupBy ){

Changes to src/shell.c.

2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192

2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203

2204
2205
2206
2207
2208
2209
2210
        new_colv[1] = 0;
        callback(&data, 1, new_argv, new_colv);
        rc = SQLITE_OK;
      }else{
        zShellStatic = azArg[1];
        rc = sqlite3_exec(p->db,
          "SELECT sql FROM "
          "  (SELECT sql sql, type type, tbl_name tbl_name, name name"
          "     FROM sqlite_master UNION ALL"
          "   SELECT sql, type, tbl_name, name FROM sqlite_temp_master) "
          "WHERE lower(tbl_name) LIKE shellstatic()"
          "  AND type!='meta' AND sql NOTNULL "
          "ORDER BY substr(type,2,1), name",

          callback, &data, &zErrMsg);
        zShellStatic = 0;
      }
    }else{
      rc = sqlite3_exec(p->db,
         "SELECT sql FROM "
         "  (SELECT sql sql, type type, tbl_name tbl_name, name name"
         "     FROM sqlite_master UNION ALL"
         "   SELECT sql, type, tbl_name, name FROM sqlite_temp_master) "
         "WHERE type!='meta' AND sql NOTNULL AND name NOT LIKE 'sqlite_%'"
         "ORDER BY substr(type,2,1), name",

         callback, &data, &zErrMsg
      );
    }
    if( zErrMsg ){
      fprintf(stderr,"Error: %s\n", zErrMsg);
      sqlite3_free(zErrMsg);
      rc = 1;







|

|


|
>






|

|

|
>







2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
        new_colv[1] = 0;
        callback(&data, 1, new_argv, new_colv);
        rc = SQLITE_OK;
      }else{
        zShellStatic = azArg[1];
        rc = sqlite3_exec(p->db,
          "SELECT sql FROM "
          "  (SELECT sql sql, type type, tbl_name tbl_name, name name, rowid x"
          "     FROM sqlite_master UNION ALL"
          "   SELECT sql, type, tbl_name, name, rowid FROM sqlite_temp_master) "
          "WHERE lower(tbl_name) LIKE shellstatic()"
          "  AND type!='meta' AND sql NOTNULL "
          "ORDER BY substr(type,2,1), "
                  " CASE type WHEN 'view' THEN rowid ELSE name END",
          callback, &data, &zErrMsg);
        zShellStatic = 0;
      }
    }else{
      rc = sqlite3_exec(p->db,
         "SELECT sql FROM "
         "  (SELECT sql sql, type type, tbl_name tbl_name, name name, rowid x"
         "     FROM sqlite_master UNION ALL"
         "   SELECT sql, type, tbl_name, name, rowid FROM sqlite_temp_master) "
         "WHERE type!='meta' AND sql NOTNULL AND name NOT LIKE 'sqlite_%'"
         "ORDER BY substr(type,2,1),"
                  " CASE type WHEN 'view' THEN rowid ELSE name END",
         callback, &data, &zErrMsg
      );
    }
    if( zErrMsg ){
      fprintf(stderr,"Error: %s\n", zErrMsg);
      sqlite3_free(zErrMsg);
      rc = 1;

Changes to src/sqliteInt.h.

2012
2013
2014
2015
2016
2017
2018


2019
2020
2021
2022
2023
2024
2025
2026
2027








2028
2029
2030
2031
2032
2033
2034
** NameContext list corresponds to searching through successively outer
** subqueries looking for a match.
*/
struct NameContext {
  Parse *pParse;       /* The parser */
  SrcList *pSrcList;   /* One or more tables used to resolve names */
  ExprList *pEList;    /* Optional list of named expressions */


  int nRef;            /* Number of names resolved by this context */
  int nErr;            /* Number of errors encountered while resolving names */
  u8 allowAgg;         /* Aggregate functions allowed here */
  u8 hasAgg;           /* True if aggregates are seen */
  u8 isCheck;          /* True if resolving names in a CHECK constraint */
  AggInfo *pAggInfo;   /* Information about aggregates at this level */
  NameContext *pNext;  /* Next outer name context.  NULL for outermost */
};









/*
** An instance of the following structure contains all information
** needed to generate code for a single SELECT statement.
**
** nLimit is set to -1 if there is no LIMIT clause.  nOffset is set to 0.
** If there is a LIMIT clause, the parser sets nLimit to the value of the
** limit and nOffset to the value of the offset (or 0 if there is not







>
>


<
<
|
<
<


>
>
>
>
>
>
>
>







2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022


2023


2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
** NameContext list corresponds to searching through successively outer
** subqueries looking for a match.
*/
struct NameContext {
  Parse *pParse;       /* The parser */
  SrcList *pSrcList;   /* One or more tables used to resolve names */
  ExprList *pEList;    /* Optional list of named expressions */
  AggInfo *pAggInfo;   /* Information about aggregates at this level */
  NameContext *pNext;  /* Next outer name context.  NULL for outermost */
  int nRef;            /* Number of names resolved by this context */
  int nErr;            /* Number of errors encountered while resolving names */


  u8 ncFlags;          /* Zero or more NC_* flags defined below */


};

/*
** Allowed values for the NameContext, ncFlags field.
*/
#define NC_AllowAgg  0x01    /* Aggregate functions are allowed here */
#define NC_HasAgg    0x02    /* One or more aggregate functions seen */
#define NC_IsCheck   0x04    /* True if resolving names in a CHECK constraint */
#define NC_InAggFunc 0x08    /* True if analyzing arguments to an agg func */

/*
** An instance of the following structure contains all information
** needed to generate code for a single SELECT statement.
**
** nLimit is set to -1 if there is no LIMIT clause.  nOffset is set to 0.
** If there is a LIMIT clause, the parser sets nLimit to the value of the
** limit and nOffset to the value of the offset (or 0 if there is not

Changes to src/test_quota.c.

40
41
42
43
44
45
46
























































47
48
49
50
51
52
53
...
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
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
#define sqlite3_mutex_enter(X)
#define sqlite3_mutex_try(X)      SQLITE_OK
#define sqlite3_mutex_leave(X)
#define sqlite3_mutex_held(X)     ((void)(X),1)
#define sqlite3_mutex_notheld(X)  ((void)(X),1)
#endif /* SQLITE_THREADSAFE==0 */


























































/************************ Object Definitions ******************************/

/* Forward declaration of all object types */
typedef struct quotaGroup quotaGroup;
typedef struct quotaConn quotaConn;
typedef struct quotaFile quotaFile;
................................................................................
      pFile->ppPrev = &pGroup->pFiles;
      pGroup->pFiles = pFile;
      pFile->pGroup = pGroup;
    }
  }
  return pFile;
}

/*
** Figure out if we are dealing with Unix, Windows, or some other
** operating system.  After the following block of preprocess macros,
** all of SQLITE_OS_UNIX, SQLITE_OS_WIN, SQLITE_OS_OS2, and SQLITE_OS_OTHER 
** will defined to either 1 or 0.  One of the four will be 1.  The other 
** three will be 0.
*/
#if defined(SQLITE_OS_OTHER)
# if SQLITE_OS_OTHER==1
#   undef SQLITE_OS_UNIX
#   define SQLITE_OS_UNIX 0
#   undef SQLITE_OS_WIN
#   define SQLITE_OS_WIN 0
#   undef SQLITE_OS_OS2
#   define SQLITE_OS_OS2 0
# else
#   undef SQLITE_OS_OTHER
# endif
#endif
#if !defined(SQLITE_OS_UNIX) && !defined(SQLITE_OS_OTHER)
# define SQLITE_OS_OTHER 0
# ifndef SQLITE_OS_WIN
#   if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) \
                       || defined(__MINGW32__) || defined(__BORLANDC__)
#     define SQLITE_OS_WIN 1
#     define SQLITE_OS_UNIX 0
#     define SQLITE_OS_OS2 0
#   elif defined(__EMX__) || defined(_OS2) || defined(OS2) \
                          || defined(_OS2_) || defined(__OS2__)
#     define SQLITE_OS_WIN 0
#     define SQLITE_OS_UNIX 0
#     define SQLITE_OS_OS2 1
#   else
#     define SQLITE_OS_WIN 0
#     define SQLITE_OS_UNIX 1
#     define SQLITE_OS_OS2 0
#  endif
# else
#  define SQLITE_OS_UNIX 0
#  define SQLITE_OS_OS2 0
# endif
#else
# ifndef SQLITE_OS_WIN
#  define SQLITE_OS_WIN 0
# endif
#endif

#if SQLITE_OS_UNIX
# include <unistd.h>
#endif
#if SQLITE_OS_WIN
# include <windows.h>
# include <io.h>
#endif

/*
** Translate UTF8 to MBCS for use in fopen() calls.  Return a pointer to the
** translated text..  Call quota_mbcs_free() to deallocate any memory
** used to store the returned pointer when done.
*/
static char *quota_utf8_to_mbcs(const char *zUtf8){
#if SQLITE_OS_WIN







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







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
...
411
412
413
414
415
416
417
























































418
419
420
421
422
423
424
#define sqlite3_mutex_enter(X)
#define sqlite3_mutex_try(X)      SQLITE_OK
#define sqlite3_mutex_leave(X)
#define sqlite3_mutex_held(X)     ((void)(X),1)
#define sqlite3_mutex_notheld(X)  ((void)(X),1)
#endif /* SQLITE_THREADSAFE==0 */


/*
** Figure out if we are dealing with Unix, Windows, or some other
** operating system.  After the following block of preprocess macros,
** all of SQLITE_OS_UNIX, SQLITE_OS_WIN, SQLITE_OS_OS2, and SQLITE_OS_OTHER 
** will defined to either 1 or 0.  One of the four will be 1.  The other 
** three will be 0.
*/
#if defined(SQLITE_OS_OTHER)
# if SQLITE_OS_OTHER==1
#   undef SQLITE_OS_UNIX
#   define SQLITE_OS_UNIX 0
#   undef SQLITE_OS_WIN
#   define SQLITE_OS_WIN 0
#   undef SQLITE_OS_OS2
#   define SQLITE_OS_OS2 0
# else
#   undef SQLITE_OS_OTHER
# endif
#endif
#if !defined(SQLITE_OS_UNIX) && !defined(SQLITE_OS_OTHER)
# define SQLITE_OS_OTHER 0
# ifndef SQLITE_OS_WIN
#   if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) \
                       || defined(__MINGW32__) || defined(__BORLANDC__)
#     define SQLITE_OS_WIN 1
#     define SQLITE_OS_UNIX 0
#     define SQLITE_OS_OS2 0
#   elif defined(__EMX__) || defined(_OS2) || defined(OS2) \
                          || defined(_OS2_) || defined(__OS2__)
#     define SQLITE_OS_WIN 0
#     define SQLITE_OS_UNIX 0
#     define SQLITE_OS_OS2 1
#   else
#     define SQLITE_OS_WIN 0
#     define SQLITE_OS_UNIX 1
#     define SQLITE_OS_OS2 0
#  endif
# else
#  define SQLITE_OS_UNIX 0
#  define SQLITE_OS_OS2 0
# endif
#else
# ifndef SQLITE_OS_WIN
#  define SQLITE_OS_WIN 0
# endif
#endif

#if SQLITE_OS_UNIX
# include <unistd.h>
#endif
#if SQLITE_OS_WIN
# include <windows.h>
# include <io.h>
#endif


/************************ Object Definitions ******************************/

/* Forward declaration of all object types */
typedef struct quotaGroup quotaGroup;
typedef struct quotaConn quotaConn;
typedef struct quotaFile quotaFile;
................................................................................
      pFile->ppPrev = &pGroup->pFiles;
      pGroup->pFiles = pFile;
      pFile->pGroup = pGroup;
    }
  }
  return pFile;
}
























































/*
** Translate UTF8 to MBCS for use in fopen() calls.  Return a pointer to the
** translated text..  Call quota_mbcs_free() to deallocate any memory
** used to store the returned pointer when done.
*/
static char *quota_utf8_to_mbcs(const char *zUtf8){
#if SQLITE_OS_WIN

Changes to src/vdbetrace.c.

166
167
168
169
170
171
172

173
174
175
176
177
178
179
180
181
#if defined(SQLITE_ENABLE_TREE_EXPLAIN)

/*
** Allocate a new Explain object
*/
void sqlite3ExplainBegin(Vdbe *pVdbe){
  if( pVdbe ){

    sqlite3BeginBenignMalloc();
    Explain *p = sqlite3_malloc( sizeof(Explain) );
    if( p ){
      memset(p, 0, sizeof(*p));
      p->pVdbe = pVdbe;
      sqlite3_free(pVdbe->pExplain);
      pVdbe->pExplain = p;
      sqlite3StrAccumInit(&p->str, p->zBase, sizeof(p->zBase),
                          SQLITE_MAX_LENGTH);







>

|







166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#if defined(SQLITE_ENABLE_TREE_EXPLAIN)

/*
** Allocate a new Explain object
*/
void sqlite3ExplainBegin(Vdbe *pVdbe){
  if( pVdbe ){
    Explain *p;
    sqlite3BeginBenignMalloc();
    p = sqlite3_malloc( sizeof(Explain) );
    if( p ){
      memset(p, 0, sizeof(*p));
      p->pVdbe = pVdbe;
      sqlite3_free(pVdbe->pExplain);
      pVdbe->pExplain = p;
      sqlite3StrAccumInit(&p->str, p->zBase, sizeof(p->zBase),
                          SQLITE_MAX_LENGTH);

Added test/fuzz-oss1.test.



































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
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
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
# 2012 May 21
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
# NB:  Portions of this file are extracted from open-source projects
# covered by permissive licenses.  Use of this file for testing is clearly
# allowed.  However, do not incorporate the text of this one file into
# end-products without checking the licenses on the open-source projects
# from which this code was extracted.  This warning applies to this one
# file only - not the bulk of the SQLite source code and tests.
#
#***********************************************************************
#
# This file contains large and complex schemas obtained from open-source
# software projects.  The schemas are parsed just to make sure that nothing
# breaks in the parser logic.
#
# These tests merely verify that the parse occurs without error.
# No attempt is made to verify correct operation of the resulting schema
# and statements.
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Schema and query extracted from Skrooge.org.  
#
do_test fuzz-oss1-skrooge {
  db eval {
CREATE TABLE parameters (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,t_uuid_parent TEXT NOT NULL DEFAULT '',t_name TEXT NOT NULL,t_value TEXT NOT NULL DEFAULT '',b_blob BLOB,d_lastmodifdate DATE NOT NULL DEFAULT CURRENT_TIMESTAMP,i_tmp INTEGER NOT NULL DEFAULT 0);
CREATE TABLE doctransaction (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,t_name TEXT NOT NULL,t_mode VARCHAR(1) DEFAULT 'U' CHECK (t_mode IN ('U', 'R')),d_date DATE NOT NULL,t_savestep VARCHAR(1) DEFAULT 'N' CHECK (t_savestep IN ('Y', 'N')),i_parent INTEGER, t_refreshviews VARCHAR(1) DEFAULT 'Y' CHECK (t_refreshviews IN ('Y', 'N')));
CREATE TABLE doctransactionitem (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, rd_doctransaction_id INTEGER NOT NULL,i_object_id INTEGER NOT NULL,t_object_table TEXT NOT NULL,t_action VARCHAR(1) DEFAULT 'I' CHECK (t_action IN ('I', 'U', 'D')),t_sqlorder TEXT NOT NULL DEFAULT '');
CREATE TABLE doctransactionmsg (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, rd_doctransaction_id INTEGER NOT NULL,t_message TEXT NOT NULL DEFAULT '',t_popup VARCHAR(1) DEFAULT 'Y' CHECK (t_popup IN ('Y', 'N')));
CREATE TABLE unit(id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,t_name TEXT NOT NULL,t_symbol TEXT NOT NULL DEFAULT '',t_country TEXT NOT NULL DEFAULT '',t_type VARCHAR(1) NOT NULL DEFAULT 'C' CHECK (t_type IN ('1', '2', 'C', 'S', 'I', 'O')),t_internet_code TEXT NOT NULL DEFAULT '',i_nbdecimal INT NOT NULL DEFAULT 2,rd_unit_id INTEGER NOT NULL DEFAULT 0, t_source TEXT NOT NULL DEFAULT '');
CREATE TABLE unitvalue(id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,rd_unit_id INTEGER NOT NULL,d_date DATE NOT NULL,f_quantity FLOAT NOT NULL CHECK (f_quantity>=0));
CREATE TABLE bank (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,t_name TEXT NOT NULL DEFAULT '',t_bank_number TEXT NOT NULL DEFAULT '',t_icon TEXT NOT NULL DEFAULT '');
CREATE TABLE interest(id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,rd_account_id INTEGER NOT NULL,d_date DATE NOT NULL,f_rate FLOAT NOT NULL CHECK (f_rate>=0),t_income_value_date_mode VARCHAR(1) NOT NULL DEFAULT 'F' CHECK (t_income_value_date_mode IN ('F', '0', '1', '2', '3', '4', '5')),t_expenditure_value_date_mode VARCHAR(1) NOT NULL DEFAULT 'F' CHECK (t_expenditure_value_date_mode IN ('F', '0', '1', '2', '3', '4', '5')),t_base VARCHAR(3) NOT NULL DEFAULT '24' CHECK (t_base IN ('24', '360', '365')));
CREATE TABLE operation(id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,i_group_id INTEGER NOT NULL DEFAULT 0,i_number INTEGER DEFAULT 0 CHECK (i_number>=0),d_date DATE NOT NULL DEFAULT '0000-00-00',rd_account_id INTEGER NOT NULL,t_mode TEXT NOT NULL DEFAULT '',r_payee_id INTEGER NOT NULL DEFAULT 0,t_comment TEXT NOT NULL DEFAULT '',rc_unit_id INTEGER NOT NULL,t_status VARCHAR(1) NOT NULL DEFAULT 'N' CHECK (t_status IN ('N', 'P', 'Y')),t_bookmarked VARCHAR(1) NOT NULL DEFAULT 'N' CHECK (t_bookmarked IN ('Y', 'N')),t_imported VARCHAR(1) NOT NULL DEFAULT 'N' CHECK (t_imported IN ('Y', 'N', 'P', 'T')),t_template VARCHAR(1) NOT NULL DEFAULT 'N' CHECK (t_template IN ('Y', 'N')),t_import_id TEXT NOT NULL DEFAULT '',i_tmp INTEGER NOT NULL DEFAULT 0,r_recurrentoperation_id INTEGER NOT NULL DEFAULT 0);
CREATE TABLE operationbalance(id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,f_balance FLOAT NOT NULL DEFAULT 0,r_operation_id INTEGER NOT NULL);
CREATE TABLE refund (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,t_name TEXT NOT NULL DEFAULT '',t_comment TEXT NOT NULL DEFAULT '',t_close VARCHAR(1) DEFAULT 'N' CHECK (t_close IN ('Y', 'N')));
CREATE TABLE payee (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,t_name TEXT NOT NULL DEFAULT '',t_address TEXT NOT NULL DEFAULT '', t_bookmarked VARCHAR(1) NOT NULL DEFAULT 'N' CHECK (t_bookmarked IN ('Y', 'N')));
CREATE TABLE suboperation(id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,t_comment TEXT NOT NULL DEFAULT '',rd_operation_id INTEGER NOT NULL,r_category_id INTEGER NOT NULL DEFAULT 0,f_value FLOAT NOT NULL DEFAULT 0.0,i_tmp INTEGER NOT NULL DEFAULT 0,r_refund_id INTEGER NOT NULL DEFAULT 0, t_formula TEXT NOT NULL DEFAULT '');
CREATE TABLE rule (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,t_description TEXT NOT NULL DEFAULT '',t_definition TEXT NOT NULL DEFAULT '',t_action_description TEXT NOT NULL DEFAULT '',t_action_definition TEXT NOT NULL DEFAULT '',t_action_type VARCHAR(1) DEFAULT 'S' CHECK (t_action_type IN ('S', 'U', 'A')),t_bookmarked VARCHAR(1) NOT NULL DEFAULT 'N' CHECK (t_bookmarked IN ('Y', 'N')),f_sortorder FLOAT);
CREATE TABLE budget (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,rc_category_id INTEGER NOT NULL DEFAULT 0,t_including_subcategories TEXT NOT NULL DEFAULT 'N' CHECK (t_including_subcategories IN ('Y', 'N')),f_budgeted FLOAT NOT NULL DEFAULT 0.0,f_budgeted_modified FLOAT NOT NULL DEFAULT 0.0,f_transferred FLOAT NOT NULL DEFAULT 0.0,i_year INTEGER NOT NULL DEFAULT 2010,i_month INTEGER NOT NULL DEFAULT 0 CHECK (i_month>=0 AND i_month<=12));
CREATE TABLE budgetcategory(id INTEGER NOT NULL DEFAULT 0,id_category INTEGER NOT NULL DEFAULT 0);
CREATE TABLE budgetrule (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,rc_category_id INTEGER NOT NULL DEFAULT 0,t_category_condition TEXT NOT NULL DEFAULT 'Y' CHECK (t_category_condition IN ('Y', 'N')),t_year_condition TEXT NOT NULL DEFAULT 'Y' CHECK (t_year_condition IN ('Y', 'N')),i_year INTEGER NOT NULL DEFAULT 2010,i_month INTEGER NOT NULL DEFAULT 0 CHECK (i_month>=0 AND i_month<=12),t_month_condition TEXT NOT NULL DEFAULT 'Y' CHECK (t_month_condition IN ('Y', 'N')),i_condition INTEGER NOT NULL DEFAULT 0 CHECK (i_condition IN (-1,0,1)),f_quantity FLOAT NOT NULL DEFAULT 0.0,t_absolute TEXT NOT NULL DEFAULT 'Y' CHECK (t_absolute IN ('Y', 'N')),rc_category_id_target INTEGER NOT NULL DEFAULT 0,t_category_target TEXT NOT NULL DEFAULT 'Y' CHECK (t_category_target IN ('Y', 'N')),t_rule TEXT NOT NULL DEFAULT 'N' CHECK (t_rule IN ('N', 'C', 'Y')));
CREATE TABLE "recurrentoperation" (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,d_date DATE NOT NULL DEFAULT '0000-00-00',rd_operation_id INTEGER NOT NULL,i_period_increment INTEGER NOT NULL DEFAULT 1 CHECK (i_period_increment>=0),t_period_unit TEXT NOT NULL DEFAULT 'M' CHECK (t_period_unit IN ('D', 'W', 'M', 'Y')),t_auto_write VARCHAR(1) DEFAULT 'Y' CHECK (t_auto_write IN ('Y', 'N')),i_auto_write_days INTEGER NOT NULL DEFAULT 5 CHECK (i_auto_write_days>=0),t_warn VARCHAR(1) DEFAULT 'Y' CHECK (t_warn IN ('Y', 'N')),i_warn_days INTEGER NOT NULL DEFAULT 5 CHECK (i_warn_days>=0),t_times VARCHAR(1) DEFAULT 'N' CHECK (t_times IN ('Y', 'N')),i_nb_times INTEGER NOT NULL DEFAULT 1 CHECK (i_nb_times>=0));
CREATE TABLE "category" (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,t_name TEXT NOT NULL DEFAULT '' CHECK (t_name NOT LIKE '% > %'),t_fullname TEXT,rd_category_id INT,t_bookmarked VARCHAR(1) NOT NULL DEFAULT 'N' CHECK (t_bookmarked IN ('Y', 'N')));
CREATE TABLE "account"(id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,t_name TEXT NOT NULL,t_number TEXT NOT NULL DEFAULT '',t_agency_number TEXT NOT NULL DEFAULT '',t_agency_address TEXT NOT NULL DEFAULT '',t_comment TEXT NOT NULL DEFAULT '',t_close VARCHAR(1) DEFAULT 'N' CHECK (t_close IN ('Y', 'N')),t_type VARCHAR(1) NOT NULL DEFAULT 'C' CHECK (t_type IN ('C', 'D', 'A', 'I', 'L', 'W', 'O')),t_bookmarked VARCHAR(1) NOT NULL DEFAULT 'N' CHECK (t_bookmarked IN ('Y', 'N')),rd_bank_id INTEGER NOT NULL);
CREATE TABLE "node" (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,t_name TEXT NOT NULL DEFAULT '' CHECK (t_name NOT LIKE '% > %'),t_fullname TEXT,t_icon TEXT DEFAULT '',f_sortorder FLOAT,t_autostart VARCHAR(1) DEFAULT 'N' CHECK (t_autostart IN ('Y', 'N')),t_data TEXT,rd_node_id INT CONSTRAINT fk_id REFERENCES node(id) ON DELETE CASCADE);
CREATE TABLE vm_category_display_tmp(
  id INT,
  t_name TEXT,
  t_fullname TEXT,
  rd_category_id INT,
  t_bookmarked TEXT,
  i_NBOPERATIONS,
  f_REALCURRENTAMOUNT
);
CREATE TABLE vm_budget_tmp(
  id INT,
  rc_category_id INT,
  t_including_subcategories TEXT,
  f_budgeted REAL,
  f_budgeted_modified REAL,
  f_transferred REAL,
  i_year INT,
  i_month INT,
  t_CATEGORY,
  t_PERIOD,
  f_CURRENTAMOUNT,
  t_RULES
);
CREATE INDEX idx_doctransaction_parent ON doctransaction (i_parent);
CREATE INDEX idx_doctransactionitem_i_object_id ON doctransactionitem (i_object_id);
CREATE INDEX idx_doctransactionitem_t_object_table ON doctransactionitem (t_object_table);
CREATE INDEX idx_doctransactionitem_t_action ON doctransactionitem (t_action);
CREATE INDEX idx_doctransactionitem_rd_doctransaction_id ON doctransactionitem (rd_doctransaction_id);
CREATE INDEX idx_doctransactionitem_optimization ON doctransactionitem (rd_doctransaction_id, i_object_id, t_object_table, t_action, id);
CREATE INDEX idx_unit_unit_id ON unitvalue(rd_unit_id);
CREATE INDEX idx_account_bank_id ON account(rd_bank_id);
CREATE INDEX idx_account_type ON account(t_type);
CREATE INDEX idx_category_category_id ON category(rd_category_id);
CREATE INDEX idx_category_t_fullname ON category(t_fullname);
CREATE INDEX idx_operation_account_id ON operation (rd_account_id);
CREATE INDEX idx_operation_tmp1_found_transfert ON operation (rc_unit_id, d_date);
CREATE INDEX idx_operation_grouped_operation_id ON operation (i_group_id);
CREATE INDEX idx_operation_i_number ON operation (i_number);
CREATE INDEX idx_operation_i_tmp ON operation (i_tmp);
CREATE INDEX idx_operation_rd_account_id ON operation (rd_account_id);
CREATE INDEX idx_operation_rc_unit_id ON operation (rc_unit_id);
CREATE INDEX idx_operation_t_status ON operation (t_status);
CREATE INDEX idx_operation_t_import_id ON operation (t_import_id);
CREATE INDEX idx_operation_t_template ON operation (t_template);
CREATE INDEX idx_operation_d_date ON operation (d_date);
CREATE INDEX idx_operationbalance_operation_id ON operationbalance (r_operation_id);
CREATE INDEX idx_suboperation_operation_id ON suboperation (rd_operation_id);
CREATE INDEX idx_suboperation_i_tmp ON suboperation (i_tmp);
CREATE INDEX idx_suboperation_category_id ON suboperation (r_category_id);
CREATE INDEX idx_suboperation_refund_id_id ON suboperation (r_refund_id);
CREATE INDEX idx_recurrentoperation_rd_operation_id ON recurrentoperation (rd_operation_id);
CREATE INDEX idx_refund_close ON refund(t_close);
CREATE INDEX idx_interest_account_id ON interest (rd_account_id);
CREATE INDEX idx_rule_action_type ON rule(t_action_type);
CREATE INDEX idx_budget_category_id ON budget(rc_category_id);
CREATE INDEX idx_budgetcategory_id ON budgetcategory (id);
CREATE INDEX idx_budgetcategory_id_category ON budgetcategory (id_category);
CREATE UNIQUE INDEX uidx_parameters_uuid_parent_name ON parameters (t_uuid_parent, t_name);
CREATE UNIQUE INDEX uidx_node_parent_id_name ON node(t_name,rd_node_id);
CREATE UNIQUE INDEX uidx_node_fullname ON node(t_fullname);
CREATE UNIQUE INDEX uidx_unit_name ON unit(t_name);
CREATE UNIQUE INDEX uidx_unit_symbol ON unit(t_symbol);
CREATE UNIQUE INDEX uidx_unitvalue ON unitvalue(d_date,rd_unit_id);
CREATE UNIQUE INDEX uidx_bank_name ON bank(t_name);
CREATE UNIQUE INDEX uidx_account_name ON account(t_name);
CREATE UNIQUE INDEX uidx_category_parent_id_name ON category(t_name,rd_category_id);
CREATE UNIQUE INDEX uidx_category_fullname ON  category(t_fullname);
CREATE UNIQUE INDEX uidx_refund_name ON refund(t_name);
CREATE UNIQUE INDEX uidx_payee_name ON payee(t_name);
CREATE UNIQUE INDEX uidx_interest ON interest(d_date,rd_account_id);
CREATE UNIQUE INDEX uidx_budget ON budget(i_year,i_month, rc_category_id);
CREATE VIEW v_node AS SELECT * from node;
CREATE VIEW v_node_displayname AS SELECT *, t_fullname AS t_displayname from node;
CREATE VIEW v_parameters_displayname AS SELECT *, t_name AS t_displayname from parameters;
CREATE TRIGGER fkdc_parameters_parameters_uuid BEFORE DELETE ON parameters FOR EACH ROW BEGIN     DELETE FROM parameters WHERE parameters.t_uuid_parent=OLD.id||'-'||'parameters'; END;
CREATE TRIGGER fkdc_node_parameters_uuid BEFORE DELETE ON node FOR EACH ROW BEGIN     DELETE FROM parameters WHERE parameters.t_uuid_parent=OLD.id||'-'||'node'; END;
CREATE TRIGGER cpt_node_fullname1 AFTER INSERT ON node BEGIN UPDATE node SET t_fullname=CASE WHEN new.rd_node_id IS NULL OR new.rd_node_id='' OR new.rd_node_id=0 THEN new.t_name ELSE (SELECT c.t_fullname from node c where c.id=new.rd_node_id)||' > '||new.t_name END WHERE id=new.id;END;
CREATE TRIGGER cpt_node_fullname2 AFTER UPDATE OF t_name, rd_node_id ON node BEGIN UPDATE node SET t_fullname=CASE WHEN new.rd_node_id IS NULL OR new.rd_node_id='' OR new.rd_node_id=0 THEN new.t_name ELSE (SELECT c.t_fullname from node c where c.id=new.rd_node_id)||' > '||new.t_name END WHERE id=new.id;UPDATE node SET t_name=t_name WHERE rd_node_id=new.id;END;
CREATE TRIGGER fki_account_bank_rd_bank_id_id BEFORE INSERT ON account FOR EACH ROW BEGIN   SELECT RAISE(ABORT, 'Impossible d''ajouter un objet (bank est utilisé par account)
Nom de la contrainte : fki_account_bank_rd_bank_id_id')   WHERE NEW.rd_bank_id!=0 AND NEW.rd_bank_id!='' AND (SELECT id FROM bank WHERE id = NEW.rd_bank_id) IS NULL; END;
CREATE TRIGGER fku_account_bank_rd_bank_id_id BEFORE UPDATE ON account FOR EACH ROW BEGIN     SELECT RAISE(ABORT, 'Impossible de modifier un objet (bank est utilisé par account)
Nom de la contrainte : fku_account_bank_rd_bank_id_id')       WHERE NEW.rd_bank_id!=0 AND NEW.rd_bank_id!='' AND (SELECT id FROM bank WHERE id = NEW.rd_bank_id) IS NULL; END;
CREATE TRIGGER fkdc_bank_account_id_rd_bank_id BEFORE DELETE ON bank FOR EACH ROW BEGIN     DELETE FROM account WHERE account.rd_bank_id = OLD.id; END;
CREATE TRIGGER fki_budget_category_rc_category_id_id BEFORE INSERT ON budget FOR EACH ROW BEGIN   SELECT RAISE(ABORT, 'Impossible d''ajouter un objet (category est utilisé par budget)
Nom de la contrainte : fki_budget_category_rc_category_id_id')   WHERE NEW.rc_category_id!=0 AND NEW.rc_category_id!='' AND (SELECT id FROM category WHERE id = NEW.rc_category_id) IS NULL; END;
CREATE TRIGGER fku_budget_category_rc_category_id_id BEFORE UPDATE ON budget FOR EACH ROW BEGIN     SELECT RAISE(ABORT, 'Impossible de modifier un objet (category est utilisé par budget)
Nom de la contrainte : fku_budget_category_rc_category_id_id')       WHERE NEW.rc_category_id!=0 AND NEW.rc_category_id!='' AND (SELECT id FROM category WHERE id = NEW.rc_category_id) IS NULL; END;
CREATE TRIGGER fkd_budget_category_rc_category_id_id BEFORE DELETE ON category FOR EACH ROW BEGIN     SELECT RAISE(ABORT, 'Impossible de détruire un objet (category est utilisé par budget)
Nom de la contrainte : fkd_budget_category_rc_category_id_id')     WHERE (SELECT rc_category_id FROM budget WHERE rc_category_id = OLD.id) IS NOT NULL; END;
CREATE TRIGGER fki_budgetrule_category_rc_category_id_id BEFORE INSERT ON budgetrule FOR EACH ROW BEGIN   SELECT RAISE(ABORT, 'Impossible d''ajouter un objet (category est utilisé par budgetrule)
Nom de la contrainte : fki_budgetrule_category_rc_category_id_id')   WHERE NEW.rc_category_id!=0 AND NEW.rc_category_id!='' AND (SELECT id FROM category WHERE id = NEW.rc_category_id) IS NULL; END;
CREATE TRIGGER fku_budgetrule_category_rc_category_id_id BEFORE UPDATE ON budgetrule FOR EACH ROW BEGIN     SELECT RAISE(ABORT, 'Impossible de modifier un objet (category est utilisé par budgetrule)
Nom de la contrainte : fku_budgetrule_category_rc_category_id_id')       WHERE NEW.rc_category_id!=0 AND NEW.rc_category_id!='' AND (SELECT id FROM category WHERE id = NEW.rc_category_id) IS NULL; END;
CREATE TRIGGER fkd_budgetrule_category_rc_category_id_id BEFORE DELETE ON category FOR EACH ROW BEGIN     SELECT RAISE(ABORT, 'Impossible de détruire un objet (category est utilisé par budgetrule)
Nom de la contrainte : fkd_budgetrule_category_rc_category_id_id')     WHERE (SELECT rc_category_id FROM budgetrule WHERE rc_category_id = OLD.id) IS NOT NULL; END;
CREATE TRIGGER fki_budgetrule_category_rc_category_id_target_id BEFORE INSERT ON budgetrule FOR EACH ROW BEGIN   SELECT RAISE(ABORT, 'Impossible d''ajouter un objet (category est utilisé par budgetrule)
Nom de la contrainte : fki_budgetrule_category_rc_category_id_target_id')   WHERE NEW.rc_category_id_target!=0 AND NEW.rc_category_id_target!='' AND (SELECT id FROM category WHERE id = NEW.rc_category_id_target) IS NULL; END;
CREATE TRIGGER fku_budgetrule_category_rc_category_id_target_id BEFORE UPDATE ON budgetrule FOR EACH ROW BEGIN     SELECT RAISE(ABORT, 'Impossible de modifier un objet (category est utilisé par budgetrule)
Nom de la contrainte : fku_budgetrule_category_rc_category_id_target_id')       WHERE NEW.rc_category_id_target!=0 AND NEW.rc_category_id_target!='' AND (SELECT id FROM category WHERE id = NEW.rc_category_id_target) IS NULL; END;
CREATE TRIGGER fkd_budgetrule_category_rc_category_id_target_id BEFORE DELETE ON category FOR EACH ROW BEGIN     SELECT RAISE(ABORT, 'Impossible de détruire un objet (category est utilisé par budgetrule)
Nom de la contrainte : fkd_budgetrule_category_rc_category_id_target_id')     WHERE (SELECT rc_category_id_target FROM budgetrule WHERE rc_category_id_target = OLD.id) IS NOT NULL; END;
CREATE TRIGGER fki_category_category_rd_category_id_id BEFORE INSERT ON category FOR EACH ROW BEGIN   SELECT RAISE(ABORT, 'Impossible d''ajouter un objet (category est utilisé par category)
Nom de la contrainte : fki_category_category_rd_category_id_id')   WHERE NEW.rd_category_id!=0 AND NEW.rd_category_id!='' AND (SELECT id FROM category WHERE id = NEW.rd_category_id) IS NULL; END;
CREATE TRIGGER fku_category_category_rd_category_id_id BEFORE UPDATE ON category FOR EACH ROW BEGIN     SELECT RAISE(ABORT, 'Impossible de modifier un objet (category est utilisé par category)
Nom de la contrainte : fku_category_category_rd_category_id_id')       WHERE NEW.rd_category_id!=0 AND NEW.rd_category_id!='' AND (SELECT id FROM category WHERE id = NEW.rd_category_id) IS NULL; END;
CREATE TRIGGER fkdc_category_category_id_rd_category_id BEFORE DELETE ON category FOR EACH ROW BEGIN     DELETE FROM category WHERE category.rd_category_id = OLD.id; END;
CREATE TRIGGER fki_doctransactionitem_doctransaction_rd_doctransaction_id_id BEFORE INSERT ON doctransactionitem FOR EACH ROW BEGIN   SELECT RAISE(ABORT, 'Impossible d''ajouter un objet (doctransaction est utilisé par doctransactionitem)
Nom de la contrainte : fki_doctransactionitem_doctransaction_rd_doctransaction_id_id')   WHERE NEW.rd_doctransaction_id!=0 AND NEW.rd_doctransaction_id!='' AND (SELECT id FROM doctransaction WHERE id = NEW.rd_doctransaction_id) IS NULL; END;
CREATE TRIGGER fku_doctransactionitem_doctransaction_rd_doctransaction_id_id BEFORE UPDATE ON doctransactionitem FOR EACH ROW BEGIN     SELECT RAISE(ABORT, 'Impossible de modifier un objet (doctransaction est utilisé par doctransactionitem)
Nom de la contrainte : fku_doctransactionitem_doctransaction_rd_doctransaction_id_id')       WHERE NEW.rd_doctransaction_id!=0 AND NEW.rd_doctransaction_id!='' AND (SELECT id FROM doctransaction WHERE id = NEW.rd_doctransaction_id) IS NULL; END;
CREATE TRIGGER fkdc_doctransaction_doctransactionitem_id_rd_doctransaction_id BEFORE DELETE ON doctransaction FOR EACH ROW BEGIN     DELETE FROM doctransactionitem WHERE doctransactionitem.rd_doctransaction_id = OLD.id; END;
CREATE TRIGGER fki_doctransactionmsg_doctransaction_rd_doctransaction_id_id BEFORE INSERT ON doctransactionmsg FOR EACH ROW BEGIN   SELECT RAISE(ABORT, 'Impossible d''ajouter un objet (doctransaction est utilisé par doctransactionmsg)
Nom de la contrainte : fki_doctransactionmsg_doctransaction_rd_doctransaction_id_id')   WHERE NEW.rd_doctransaction_id!=0 AND NEW.rd_doctransaction_id!='' AND (SELECT id FROM doctransaction WHERE id = NEW.rd_doctransaction_id) IS NULL; END;
CREATE TRIGGER fku_doctransactionmsg_doctransaction_rd_doctransaction_id_id BEFORE UPDATE ON doctransactionmsg FOR EACH ROW BEGIN     SELECT RAISE(ABORT, 'Impossible de modifier un objet (doctransaction est utilisé par doctransactionmsg)
Nom de la contrainte : fku_doctransactionmsg_doctransaction_rd_doctransaction_id_id')       WHERE NEW.rd_doctransaction_id!=0 AND NEW.rd_doctransaction_id!='' AND (SELECT id FROM doctransaction WHERE id = NEW.rd_doctransaction_id) IS NULL; END;
CREATE TRIGGER fkdc_doctransaction_doctransactionmsg_id_rd_doctransaction_id BEFORE DELETE ON doctransaction FOR EACH ROW BEGIN     DELETE FROM doctransactionmsg WHERE doctransactionmsg.rd_doctransaction_id = OLD.id; END;
CREATE TRIGGER fki_interest_account_rd_account_id_id BEFORE INSERT ON interest FOR EACH ROW BEGIN   SELECT RAISE(ABORT, 'Impossible d''ajouter un objet (account est utilisé par interest)
Nom de la contrainte : fki_interest_account_rd_account_id_id')   WHERE NEW.rd_account_id!=0 AND NEW.rd_account_id!='' AND (SELECT id FROM account WHERE id = NEW.rd_account_id) IS NULL; END;
CREATE TRIGGER fku_interest_account_rd_account_id_id BEFORE UPDATE ON interest FOR EACH ROW BEGIN     SELECT RAISE(ABORT, 'Impossible de modifier un objet (account est utilisé par interest)
Nom de la contrainte : fku_interest_account_rd_account_id_id')       WHERE NEW.rd_account_id!=0 AND NEW.rd_account_id!='' AND (SELECT id FROM account WHERE id = NEW.rd_account_id) IS NULL; END;
CREATE TRIGGER fkdc_account_interest_id_rd_account_id BEFORE DELETE ON account FOR EACH ROW BEGIN     DELETE FROM interest WHERE interest.rd_account_id = OLD.id; END;
CREATE TRIGGER fki_node_node_rd_node_id_id BEFORE INSERT ON node FOR EACH ROW BEGIN   SELECT RAISE(ABORT, 'Impossible d''ajouter un objet (node est utilisé par node)
Nom de la contrainte : fki_node_node_rd_node_id_id')   WHERE NEW.rd_node_id!=0 AND NEW.rd_node_id!='' AND (SELECT id FROM node WHERE id = NEW.rd_node_id) IS NULL; END;
CREATE TRIGGER fku_node_node_rd_node_id_id BEFORE UPDATE ON node FOR EACH ROW BEGIN     SELECT RAISE(ABORT, 'Impossible de modifier un objet (node est utilisé par node)
Nom de la contrainte : fku_node_node_rd_node_id_id')       WHERE NEW.rd_node_id!=0 AND NEW.rd_node_id!='' AND (SELECT id FROM node WHERE id = NEW.rd_node_id) IS NULL; END;
CREATE TRIGGER fkdc_node_node_id_rd_node_id BEFORE DELETE ON node FOR EACH ROW BEGIN     DELETE FROM node WHERE node.rd_node_id = OLD.id; END;
CREATE TRIGGER fki_operation_account_rd_account_id_id BEFORE INSERT ON operation FOR EACH ROW BEGIN   SELECT RAISE(ABORT, 'Impossible d''ajouter un objet (account est utilisé par operation)
Nom de la contrainte : fki_operation_account_rd_account_id_id')   WHERE NEW.rd_account_id!=0 AND NEW.rd_account_id!='' AND (SELECT id FROM account WHERE id = NEW.rd_account_id) IS NULL; END;
CREATE TRIGGER fku_operation_account_rd_account_id_id BEFORE UPDATE ON operation FOR EACH ROW BEGIN     SELECT RAISE(ABORT, 'Impossible de modifier un objet (account est utilisé par operation)
Nom de la contrainte : fku_operation_account_rd_account_id_id')       WHERE NEW.rd_account_id!=0 AND NEW.rd_account_id!='' AND (SELECT id FROM account WHERE id = NEW.rd_account_id) IS NULL; END;
CREATE TRIGGER fkdc_account_operation_id_rd_account_id BEFORE DELETE ON account FOR EACH ROW BEGIN     DELETE FROM operation WHERE operation.rd_account_id = OLD.id; END;
CREATE TRIGGER fki_operation_payee_r_payee_id_id BEFORE INSERT ON operation FOR EACH ROW BEGIN   SELECT RAISE(ABORT, 'Impossible d''ajouter un objet (payee est utilisé par operation)
Nom de la contrainte : fki_operation_payee_r_payee_id_id')   WHERE NEW.r_payee_id!=0 AND NEW.r_payee_id!='' AND (SELECT id FROM payee WHERE id = NEW.r_payee_id) IS NULL; END;
CREATE TRIGGER fku_operation_payee_r_payee_id_id BEFORE UPDATE ON operation FOR EACH ROW BEGIN     SELECT RAISE(ABORT, 'Impossible de modifier un objet (payee est utilisé par operation)
Nom de la contrainte : fku_operation_payee_r_payee_id_id')       WHERE NEW.r_payee_id!=0 AND NEW.r_payee_id!='' AND (SELECT id FROM payee WHERE id = NEW.r_payee_id) IS NULL; END;
CREATE TRIGGER fkd_operation_payee_r_payee_id_id BEFORE DELETE ON payee FOR EACH ROW BEGIN     UPDATE operation SET r_payee_id=0 WHERE r_payee_id=OLD.id; END;
CREATE TRIGGER fki_operation_unit_rc_unit_id_id BEFORE INSERT ON operation FOR EACH ROW BEGIN   SELECT RAISE(ABORT, 'Impossible d''ajouter un objet (unit est utilisé par operation)
Nom de la contrainte : fki_operation_unit_rc_unit_id_id')   WHERE NEW.rc_unit_id!=0 AND NEW.rc_unit_id!='' AND (SELECT id FROM unit WHERE id = NEW.rc_unit_id) IS NULL; END;
CREATE TRIGGER fku_operation_unit_rc_unit_id_id BEFORE UPDATE ON operation FOR EACH ROW BEGIN     SELECT RAISE(ABORT, 'Impossible de modifier un objet (unit est utilisé par operation)
Nom de la contrainte : fku_operation_unit_rc_unit_id_id')       WHERE NEW.rc_unit_id!=0 AND NEW.rc_unit_id!='' AND (SELECT id FROM unit WHERE id = NEW.rc_unit_id) IS NULL; END;
CREATE TRIGGER fkd_operation_unit_rc_unit_id_id BEFORE DELETE ON unit FOR EACH ROW BEGIN     SELECT RAISE(ABORT, 'Impossible de détruire un objet (unit est utilisé par operation)
Nom de la contrainte : fkd_operation_unit_rc_unit_id_id')     WHERE (SELECT rc_unit_id FROM operation WHERE rc_unit_id = OLD.id) IS NOT NULL; END;
CREATE TRIGGER fki_operation_recurrentoperation_r_recurrentoperation_id_id BEFORE INSERT ON operation FOR EACH ROW BEGIN   SELECT RAISE(ABORT, 'Impossible d''ajouter un objet (recurrentoperation est utilisé par operation)
Nom de la contrainte : fki_operation_recurrentoperation_r_recurrentoperation_id_id')   WHERE NEW.r_recurrentoperation_id!=0 AND NEW.r_recurrentoperation_id!='' AND (SELECT id FROM recurrentoperation WHERE id = NEW.r_recurrentoperation_id) IS NULL; END;
CREATE TRIGGER fku_operation_recurrentoperation_r_recurrentoperation_id_id BEFORE UPDATE ON operation FOR EACH ROW BEGIN     SELECT RAISE(ABORT, 'Impossible de modifier un objet (recurrentoperation est utilisé par operation)
Nom de la contrainte : fku_operation_recurrentoperation_r_recurrentoperation_id_id')       WHERE NEW.r_recurrentoperation_id!=0 AND NEW.r_recurrentoperation_id!='' AND (SELECT id FROM recurrentoperation WHERE id = NEW.r_recurrentoperation_id) IS NULL; END;
CREATE TRIGGER fkd_operation_recurrentoperation_r_recurrentoperation_id_id BEFORE DELETE ON recurrentoperation FOR EACH ROW BEGIN     UPDATE operation SET r_recurrentoperation_id=0 WHERE r_recurrentoperation_id=OLD.id; END;
CREATE TRIGGER fki_operationbalance_operation_r_operation_id_id BEFORE INSERT ON operationbalance FOR EACH ROW BEGIN   SELECT RAISE(ABORT, 'Impossible d''ajouter un objet (operation est utilisé par operationbalance)
Nom de la contrainte : fki_operationbalance_operation_r_operation_id_id')   WHERE NEW.r_operation_id!=0 AND NEW.r_operation_id!='' AND (SELECT id FROM operation WHERE id = NEW.r_operation_id) IS NULL; END;
CREATE TRIGGER fku_operationbalance_operation_r_operation_id_id BEFORE UPDATE ON operationbalance FOR EACH ROW BEGIN     SELECT RAISE(ABORT, 'Impossible de modifier un objet (operation est utilisé par operationbalance)
Nom de la contrainte : fku_operationbalance_operation_r_operation_id_id')       WHERE NEW.r_operation_id!=0 AND NEW.r_operation_id!='' AND (SELECT id FROM operation WHERE id = NEW.r_operation_id) IS NULL; END;
CREATE TRIGGER fkd_operationbalance_operation_r_operation_id_id BEFORE DELETE ON operation FOR EACH ROW BEGIN     UPDATE operationbalance SET r_operation_id=0 WHERE r_operation_id=OLD.id; END;
CREATE TRIGGER fki_recurrentoperation_operation_rd_operation_id_id BEFORE INSERT ON recurrentoperation FOR EACH ROW BEGIN   SELECT RAISE(ABORT, 'Impossible d''ajouter un objet (operation est utilisé par recurrentoperation)
Nom de la contrainte : fki_recurrentoperation_operation_rd_operation_id_id')   WHERE NEW.rd_operation_id!=0 AND NEW.rd_operation_id!='' AND (SELECT id FROM operation WHERE id = NEW.rd_operation_id) IS NULL; END;
CREATE TRIGGER fku_recurrentoperation_operation_rd_operation_id_id BEFORE UPDATE ON recurrentoperation FOR EACH ROW BEGIN     SELECT RAISE(ABORT, 'Impossible de modifier un objet (operation est utilisé par recurrentoperation)
Nom de la contrainte : fku_recurrentoperation_operation_rd_operation_id_id')       WHERE NEW.rd_operation_id!=0 AND NEW.rd_operation_id!='' AND (SELECT id FROM operation WHERE id = NEW.rd_operation_id) IS NULL; END;
CREATE TRIGGER fkdc_operation_recurrentoperation_id_rd_operation_id BEFORE DELETE ON operation FOR EACH ROW BEGIN     DELETE FROM recurrentoperation WHERE recurrentoperation.rd_operation_id = OLD.id; END;
CREATE TRIGGER fki_suboperation_operation_rd_operation_id_id BEFORE INSERT ON suboperation FOR EACH ROW BEGIN   SELECT RAISE(ABORT, 'Impossible d''ajouter un objet (operation est utilisé par suboperation)
Nom de la contrainte : fki_suboperation_operation_rd_operation_id_id')   WHERE NEW.rd_operation_id!=0 AND NEW.rd_operation_id!='' AND (SELECT id FROM operation WHERE id = NEW.rd_operation_id) IS NULL; END;
CREATE TRIGGER fku_suboperation_operation_rd_operation_id_id BEFORE UPDATE ON suboperation FOR EACH ROW BEGIN     SELECT RAISE(ABORT, 'Impossible de modifier un objet (operation est utilisé par suboperation)
Nom de la contrainte : fku_suboperation_operation_rd_operation_id_id')       WHERE NEW.rd_operation_id!=0 AND NEW.rd_operation_id!='' AND (SELECT id FROM operation WHERE id = NEW.rd_operation_id) IS NULL; END;
CREATE TRIGGER fkdc_operation_suboperation_id_rd_operation_id BEFORE DELETE ON operation FOR EACH ROW BEGIN     DELETE FROM suboperation WHERE suboperation.rd_operation_id = OLD.id; END;
CREATE TRIGGER fki_suboperation_category_r_category_id_id BEFORE INSERT ON suboperation FOR EACH ROW BEGIN   SELECT RAISE(ABORT, 'Impossible d''ajouter un objet (category est utilisé par suboperation)
Nom de la contrainte : fki_suboperation_category_r_category_id_id')   WHERE NEW.r_category_id!=0 AND NEW.r_category_id!='' AND (SELECT id FROM category WHERE id = NEW.r_category_id) IS NULL; END;
CREATE TRIGGER fku_suboperation_category_r_category_id_id BEFORE UPDATE ON suboperation FOR EACH ROW BEGIN     SELECT RAISE(ABORT, 'Impossible de modifier un objet (category est utilisé par suboperation)
Nom de la contrainte : fku_suboperation_category_r_category_id_id')       WHERE NEW.r_category_id!=0 AND NEW.r_category_id!='' AND (SELECT id FROM category WHERE id = NEW.r_category_id) IS NULL; END;
CREATE TRIGGER fkd_suboperation_category_r_category_id_id BEFORE DELETE ON category FOR EACH ROW BEGIN     UPDATE suboperation SET r_category_id=0 WHERE r_category_id=OLD.id; END;
CREATE TRIGGER fki_suboperation_refund_r_refund_id_id BEFORE INSERT ON suboperation FOR EACH ROW BEGIN   SELECT RAISE(ABORT, 'Impossible d''ajouter un objet (refund est utilisé par suboperation)
Nom de la contrainte : fki_suboperation_refund_r_refund_id_id')   WHERE NEW.r_refund_id!=0 AND NEW.r_refund_id!='' AND (SELECT id FROM refund WHERE id = NEW.r_refund_id) IS NULL; END;
CREATE TRIGGER fku_suboperation_refund_r_refund_id_id BEFORE UPDATE ON suboperation FOR EACH ROW BEGIN     SELECT RAISE(ABORT, 'Impossible de modifier un objet (refund est utilisé par suboperation)
Nom de la contrainte : fku_suboperation_refund_r_refund_id_id')       WHERE NEW.r_refund_id!=0 AND NEW.r_refund_id!='' AND (SELECT id FROM refund WHERE id = NEW.r_refund_id) IS NULL; END;
CREATE TRIGGER fkd_suboperation_refund_r_refund_id_id BEFORE DELETE ON refund FOR EACH ROW BEGIN     UPDATE suboperation SET r_refund_id=0 WHERE r_refund_id=OLD.id; END;
CREATE TRIGGER fki_unit_unit_rd_unit_id_id BEFORE INSERT ON unit FOR EACH ROW BEGIN   SELECT RAISE(ABORT, 'Impossible d''ajouter un objet (unit est utilisé par unit)
Nom de la contrainte : fki_unit_unit_rd_unit_id_id')   WHERE NEW.rd_unit_id!=0 AND NEW.rd_unit_id!='' AND (SELECT id FROM unit WHERE id = NEW.rd_unit_id) IS NULL; END;
CREATE TRIGGER fku_unit_unit_rd_unit_id_id BEFORE UPDATE ON unit FOR EACH ROW BEGIN     SELECT RAISE(ABORT, 'Impossible de modifier un objet (unit est utilisé par unit)
Nom de la contrainte : fku_unit_unit_rd_unit_id_id')       WHERE NEW.rd_unit_id!=0 AND NEW.rd_unit_id!='' AND (SELECT id FROM unit WHERE id = NEW.rd_unit_id) IS NULL; END;
CREATE TRIGGER fkdc_unit_unit_id_rd_unit_id BEFORE DELETE ON unit FOR EACH ROW BEGIN     DELETE FROM unit WHERE unit.rd_unit_id = OLD.id; END;
CREATE TRIGGER fki_unitvalue_unit_rd_unit_id_id BEFORE INSERT ON unitvalue FOR EACH ROW BEGIN   SELECT RAISE(ABORT, 'Impossible d''ajouter un objet (unit est utilisé par unitvalue)
Nom de la contrainte : fki_unitvalue_unit_rd_unit_id_id')   WHERE NEW.rd_unit_id!=0 AND NEW.rd_unit_id!='' AND (SELECT id FROM unit WHERE id = NEW.rd_unit_id) IS NULL; END;
CREATE TRIGGER fku_unitvalue_unit_rd_unit_id_id BEFORE UPDATE ON unitvalue FOR EACH ROW BEGIN     SELECT RAISE(ABORT, 'Impossible de modifier un objet (unit est utilisé par unitvalue)
Nom de la contrainte : fku_unitvalue_unit_rd_unit_id_id')       WHERE NEW.rd_unit_id!=0 AND NEW.rd_unit_id!='' AND (SELECT id FROM unit WHERE id = NEW.rd_unit_id) IS NULL; END;
CREATE TRIGGER fkdc_unit_unitvalue_id_rd_unit_id BEFORE DELETE ON unit FOR EACH ROW BEGIN     DELETE FROM unitvalue WHERE unitvalue.rd_unit_id = OLD.id; END;
CREATE TRIGGER fkd_vm_budget_tmp_category_rc_category_id_id BEFORE DELETE ON category FOR EACH ROW BEGIN     SELECT RAISE(ABORT, 'Impossible de détruire un objet (category est utilisé par vm_budget_tmp)
Nom de la contrainte : fkd_vm_budget_tmp_category_rc_category_id_id')     WHERE (SELECT rc_category_id FROM vm_budget_tmp WHERE rc_category_id = OLD.id) IS NOT NULL; END;
CREATE TRIGGER fkdc_category_vm_category_display_tmp_id_rd_category_id BEFORE DELETE ON category FOR EACH ROW BEGIN     DELETE FROM vm_category_display_tmp WHERE vm_category_display_tmp.rd_category_id = OLD.id; END;
CREATE VIEW v_unit_displayname AS SELECT *, t_name||' ('||t_symbol||')' AS t_displayname FROM unit;
CREATE VIEW v_unit_tmp1 AS SELECT *,(SELECT count(*) FROM unitvalue s WHERE s.rd_unit_id=unit.id) AS i_NBVALUES, (CASE WHEN unit.rd_unit_id=0 THEN '' ELSE (SELECT (CASE WHEN s.t_symbol!='' THEN s.t_symbol ELSE s.t_name END) FROM unit s WHERE s.id=unit.rd_unit_id) END) AS t_UNIT,(CASE unit.t_type WHEN '1' THEN 'Monnaie principale' WHEN '2' THEN 'Monnaie secondaire' WHEN 'C' THEN 'Monnaie' WHEN 'S' THEN 'Action' WHEN 'I' THEN 'Indice' ELSE 'Objet' END) AS t_TYPENLS, (SELECT MIN(s.d_date) FROM  unitvalue s WHERE s.rd_unit_id=unit.id) AS d_MINDATE, (SELECT MAX(s.d_date) FROM  unitvalue s WHERE s.rd_unit_id=unit.id) AS d_MAXDATE from unit;
CREATE VIEW v_unit_tmp2 AS SELECT *,CASE WHEN v_unit_tmp1.t_type='1' THEN 1 ELSE IFNULL((SELECT s.f_quantity FROM unitvalue s WHERE s.rd_unit_id=v_unit_tmp1.id AND s.d_date=v_unit_tmp1.d_MAXDATE),1) END AS f_LASTVALUE from v_unit_tmp1;
CREATE VIEW v_unit AS SELECT *,v_unit_tmp2.f_LASTVALUE*IFNULL((SELECT s2.f_LASTVALUE FROM v_unit_tmp2 s2 WHERE s2.id=v_unit_tmp2.rd_unit_id) , 1) AS f_CURRENTAMOUNT from v_unit_tmp2;
CREATE VIEW v_unitvalue_displayname AS SELECT *, (SELECT t_displayname FROM v_unit_displayname WHERE unitvalue.rd_unit_id=v_unit_displayname.id)||' '||STRFTIME('%d/%m/%Y',d_date) AS t_displayname FROM unitvalue;
CREATE VIEW v_unitvalue AS SELECT * FROM unitvalue;
CREATE VIEW v_suboperation AS SELECT * FROM suboperation;
CREATE VIEW v_operation_numbers AS SELECT DISTINCT i_number, rd_account_id FROM operation;
CREATE VIEW v_operation_next_numbers AS SELECT T1.i_number+1 AS i_number FROM v_operation_numbers AS T1 LEFT OUTER JOIN v_operation_numbers T2 ON T2.rd_account_id=T1.rd_account_id AND T2.i_number=T1.i_number+1 WHERE T1.i_number!=0 AND (T2.i_number IS NULL) ORDER BY T1.i_number;
CREATE VIEW v_operation_tmp1 AS SELECT *,(SELECT t_name FROM payee s WHERE s.id=operation.r_payee_id) AS t_PAYEE,(SELECT TOTAL(s.f_value) FROM suboperation s WHERE s.rd_operation_id=operation.ID) AS f_QUANTITY,(SELECT count(*) FROM suboperation s WHERE s.rd_operation_id=operation.ID) AS i_NBSUBCATEGORY FROM operation;
CREATE VIEW v_operation AS SELECT *,(SELECT s.id FROM suboperation s WHERE s.rd_operation_id=v_operation_tmp1.id AND ABS(s.f_value)=(SELECT MAX(ABS(s2.f_value)) FROM suboperation s2 WHERE s2.rd_operation_id=v_operation_tmp1.id)) AS i_MOSTIMPSUBOP,((SELECT s.f_CURRENTAMOUNT FROM v_unit s WHERE s.id=v_operation_tmp1.rc_unit_id)*v_operation_tmp1.f_QUANTITY) AS f_CURRENTAMOUNT, (CASE WHEN v_operation_tmp1.i_group_id<>0 AND EXISTS (SELECT 1 FROM account a WHERE v_operation_tmp1.rd_account_id=a.id AND a.t_type<>'L') AND EXISTS (SELECT 1 FROM v_operation_tmp1 op2, account a WHERE op2.i_group_id=v_operation_tmp1.i_group_id AND op2.rd_account_id=a.id AND a.t_type<>'L' AND op2.rc_unit_id=v_operation_tmp1.rc_unit_id AND op2.f_QUANTITY=-v_operation_tmp1.f_QUANTITY) THEN 'Y' ELSE 'N' END) AS t_TRANSFER FROM v_operation_tmp1;
CREATE VIEW v_operation_displayname AS SELECT *, STRFTIME('%d/%m/%Y',d_date)||' '||IFNULL(t_PAYEE,'')||' '||v_operation.f_CURRENTAMOUNT||' '||(SELECT (CASE WHEN s.t_symbol!='' THEN s.t_symbol ELSE s.t_name END) FROM unit s WHERE s.id=v_operation.rc_unit_id) AS t_displayname FROM v_operation;
CREATE VIEW v_operation_delete AS SELECT *, (CASE WHEN t_status='Y' THEN 'Vous n''êtes pas autorisé à détruire cette opération car en état « rapproché »' END) t_delete_message FROM operation;
CREATE VIEW v_account AS SELECT *,(SELECT MAX(s.d_date) FROM  interest s WHERE s.rd_account_id=account.id) AS d_MAXDATE, (SELECT TOTAL(s.f_CURRENTAMOUNT) FROM v_operation s WHERE s.rd_account_id=account.id AND s.t_template='N') AS f_CURRENTAMOUNT FROM account;
CREATE VIEW v_account_delete AS SELECT *, (CASE WHEN EXISTS(SELECT 1 FROM operation WHERE rd_account_id=account.id AND d_date<>'0000-00-00' AND t_template='N' AND t_status='Y') THEN 'Vous n''êtes pas autorisé à détruire ce compte car il contient des opérations rapprochées' END) t_delete_message FROM account;
CREATE VIEW v_bank_displayname AS SELECT *, t_name AS t_displayname FROM bank;
CREATE VIEW v_account_displayname AS SELECT *, (SELECT t_displayname FROM v_bank_displayname WHERE account.rd_bank_id=v_bank_displayname.id)||'-'||t_name AS t_displayname FROM account;
CREATE VIEW v_bank AS SELECT *,(SELECT TOTAL(s.f_CURRENTAMOUNT) FROM v_account s WHERE s.rd_bank_id=bank.id) AS f_CURRENTAMOUNT FROM bank;
CREATE VIEW v_category_displayname AS SELECT *, t_fullname AS t_displayname FROM category;
CREATE VIEW v_category AS SELECT * FROM category;
CREATE VIEW v_recurrentoperation AS SELECT *,i_period_increment||' '||(CASE t_period_unit WHEN 'Y' THEN 'année(s)' WHEN 'M' THEN 'mois' WHEN 'W' THEN 'semaine(s)' ELSE 'jour(s)' END) AS t_PERIODNLS FROM recurrentoperation;
CREATE VIEW v_recurrentoperation_displayname AS SELECT *, STRFTIME('%d/%m/%Y',d_date)||' '||SUBSTR((SELECT t_displayname FROM v_operation_displayname WHERE v_operation_displayname.id=v_recurrentoperation.rd_operation_id), 11) AS t_displayname FROM v_recurrentoperation;
CREATE VIEW v_unitvalue_display AS SELECT *,IFNULL((SELECT (CASE WHEN s.t_symbol!='' THEN s.t_symbol ELSE s.t_name END) FROM unit s WHERE s.id=(SELECT s2.rd_unit_id FROM unit s2 WHERE s2.id=unitvalue.rd_unit_id)),'') AS t_UNIT,STRFTIME('%Y-%m',unitvalue.d_date) AS d_DATEMONTH,STRFTIME('%Y',unitvalue.d_date) AS d_DATEYEAR FROM unitvalue;
CREATE VIEW v_suboperation_display AS SELECT *,IFNULL((SELECT s.t_fullname FROM category s WHERE s.id=v_suboperation.r_category_id),'') AS t_CATEGORY, IFNULL((SELECT s.t_name FROM refund s WHERE s.id=v_suboperation.r_refund_id),'') AS t_REFUND, (CASE WHEN v_suboperation.f_value>=0 THEN v_suboperation.f_value ELSE 0 END) AS f_VALUE_INCOME, (CASE WHEN v_suboperation.f_value<=0 THEN v_suboperation.f_value ELSE 0 END) AS f_VALUE_EXPENSE FROM v_suboperation;
CREATE VIEW v_suboperation_displayname AS SELECT *, t_CATEGORY||' : '||f_value AS t_displayname FROM v_suboperation_display;
CREATE VIEW v_operation_display_all AS SELECT *,(SELECT s.t_name FROM account s WHERE s.id=v_operation.rd_account_id) AS t_ACCOUNT,(SELECT (CASE WHEN s.t_symbol!='' THEN s.t_symbol ELSE s.t_name END) FROM unit s WHERE s.id=v_operation.rc_unit_id) AS t_UNIT,(SELECT s.t_CATEGORY FROM v_suboperation_display s WHERE s.id=v_operation.i_MOSTIMPSUBOP) AS t_CATEGORY,(SELECT s.t_REFUND FROM v_suboperation_display s WHERE s.id=v_operation.i_MOSTIMPSUBOP) AS t_REFUND,(CASE WHEN v_operation.f_QUANTITY<0 THEN '-' WHEN v_operation.f_QUANTITY=0 THEN '' ELSE '+' END) AS t_TYPEEXPENSE, (CASE WHEN v_operation.f_QUANTITY<=0 THEN 'Dépense' ELSE 'Revenu' END) AS t_TYPEEXPENSENLS, STRFTIME('%Y-W%W',v_operation.d_date) AS d_DATEWEEK,STRFTIME('%Y-%m',v_operation.d_date) AS d_DATEMONTH,STRFTIME('%Y',v_operation.d_date)||'-Q'||(CASE WHEN STRFTIME('%m',v_operation.d_date)<='03' THEN '1' WHEN STRFTIME('%m',v_operation.d_date)<='06' THEN '2' WHEN STRFTIME('%m',v_operation.d_date)<='09' THEN '3' ELSE '4' END) AS d_DATEQUARTER, STRFTIME('%Y',v_operation.d_date)||'-S'||(CASE WHEN STRFTIME('%m',v_operation.d_date)<='06' THEN '1' ELSE '2' END) AS d_DATESEMESTER, STRFTIME('%Y',v_operation.d_date) AS d_DATEYEAR, (SELECT count(*) FROM v_recurrentoperation s WHERE s.rd_operation_id=v_operation.id) AS i_NBRECURRENT,  (CASE WHEN v_operation.f_QUANTITY>=0 THEN v_operation.f_QUANTITY ELSE 0 END) AS f_QUANTITY_INCOME, (CASE WHEN v_operation.f_QUANTITY<=0 THEN v_operation.f_QUANTITY ELSE 0 END) AS f_QUANTITY_EXPENSE, (SELECT o2.f_balance FROM operationbalance o2 WHERE o2.r_operation_id=v_operation.id ) AS f_BALANCE, (CASE WHEN v_operation.f_QUANTITY>=0 THEN v_operation.f_CURRENTAMOUNT ELSE 0 END) AS f_CURRENTAMOUNT_INCOME, (CASE WHEN v_operation.f_QUANTITY<=0 THEN v_operation.f_CURRENTAMOUNT ELSE 0 END) AS f_CURRENTAMOUNT_EXPENSE FROM v_operation;
CREATE VIEW v_operation_template_display AS SELECT * FROM v_operation_display_all WHERE t_template='Y';
CREATE VIEW v_operation_display AS SELECT * FROM v_operation_display_all WHERE d_date!='0000-00-00' AND t_template='N';
CREATE VIEW v_unit_display AS SELECT *,(SELECT TOTAL(o.f_QUANTITY) FROM v_operation_display o WHERE o.rc_unit_id=v_unit.id) AS f_QUANTITYOWNED FROM v_unit;
CREATE VIEW v_account_display AS SELECT (CASE t_type WHEN 'C' THEN 'Courant' WHEN 'D' THEN 'Carte de crédit' WHEN 'A' THEN 'Actif' WHEN 'I' THEN 'Investissement' WHEN 'W' THEN 'Portefeuille' WHEN 'L' THEN 'Prêt' WHEN 'O' THEN 'Autre' END) AS t_TYPENLS,bank.t_name  AS t_BANK,bank.t_bank_number AS t_BANK_NUMBER,bank.t_icon AS t_ICON,v_account.*,(v_account.f_CURRENTAMOUNT/(SELECT u.f_CURRENTAMOUNT FROM v_unit u, operation s WHERE u.id=s.rc_unit_id AND s.rd_account_id=v_account.id AND s.d_date='0000-00-00')) AS f_QUANTITY, (SELECT (CASE WHEN u.t_symbol!='' THEN u.t_symbol ELSE u.t_name END) FROM unit u, operation s WHERE u.id=s.rc_unit_id AND s.rd_account_id=v_account.id AND s.d_date='0000-00-00') AS t_UNIT, (SELECT TOTAL(s.f_CURRENTAMOUNT) FROM v_operation s WHERE s.rd_account_id=v_account.id AND s.t_status!='N' AND s.t_template='N') AS f_CHECKED, (SELECT TOTAL(s.f_CURRENTAMOUNT) FROM v_operation s WHERE s.rd_account_id=v_account.id AND s.t_status='N' AND s.t_template='N') AS f_COMING_SOON, (SELECT TOTAL(s.f_CURRENTAMOUNT) FROM v_operation s WHERE s.rd_account_id=v_account.id AND s.d_date<=date('now') AND s.t_template='N') AS f_TODAYAMOUNT, (SELECT count(*) FROM v_operation_display s WHERE s.rd_account_id=v_account.id) AS i_NBOPERATIONS, IFNULL((SELECT s.f_rate FROM interest s WHERE s.rd_account_id=v_account.id AND s.d_date=v_account.d_MAXDATE),0) AS f_RATE FROM v_account, bank WHERE bank.id=v_account.rd_bank_id;
CREATE VIEW v_operation_consolidated AS SELECT (SELECT s.t_TYPENLS FROM v_account_display s WHERE s.id=op.rd_account_id) AS t_ACCOUNTTYPE,(SELECT u.t_TYPENLS FROM v_unit u WHERE u.id=op.rc_unit_id) AS t_UNITTYPE,sop.id AS i_SUBOPID, sop.r_refund_id AS r_refund_id, (CASE WHEN sop.t_comment='' THEN op.t_comment ELSE sop.t_comment END) AS t_REALCOMMENT, sop.t_CATEGORY AS t_REALCATEGORY, sop.t_REFUND AS t_REALREFUND, sop.r_category_id AS i_IDCATEGORY, (CASE WHEN sop.f_value<0 THEN '-' WHEN sop.f_value=0 THEN '' ELSE '+' END) AS t_TYPEEXPENSE, (CASE WHEN sop.f_value<0 THEN 'Dépense' WHEN sop.f_value=0 THEN '' ELSE 'Revenu' END) AS t_TYPEEXPENSENLS, sop.f_value AS f_REALQUANTITY, sop.f_VALUE_INCOME AS f_REALQUANTITY_INCOME, sop.f_VALUE_EXPENSE AS f_REALQUANTITY_EXPENSE, ((SELECT u.f_CURRENTAMOUNT FROM v_unit u WHERE u.id=op.rc_unit_id)*sop.f_value) AS f_REALCURRENTAMOUNT, ((SELECT u.f_CURRENTAMOUNT FROM v_unit u WHERE u.id=op.rc_unit_id)*sop.f_VALUE_INCOME) AS f_REALCURRENTAMOUNT_INCOME, ((SELECT u.f_CURRENTAMOUNT FROM v_unit u WHERE u.id=op.rc_unit_id)*sop.f_VALUE_EXPENSE) AS f_REALCURRENTAMOUNT_EXPENSE, op.* FROM v_operation_display_all AS op, v_suboperation_display AS sop WHERE op.t_template='N' AND sop.rd_operation_id=op.ID;
CREATE VIEW v_operation_prop AS SELECT p.id AS i_PROPPID, p.t_name AS i_PROPPNAME, p.t_value AS i_PROPVALUE, op.* FROM v_operation_consolidated AS op LEFT OUTER JOIN parameters AS p ON p.t_uuid_parent=op.id||'-operation';
CREATE VIEW v_refund_delete AS SELECT *, (CASE WHEN EXISTS(SELECT 1 FROM v_operation_consolidated WHERE r_refund_id=refund.id AND t_status='Y') THEN 'Vous n''êtes pas autorisé à détruire ce suiveur car utilisé par des opérations rapprochées' END) t_delete_message FROM refund;
CREATE VIEW v_refund AS SELECT *, (SELECT TOTAL(o.f_REALCURRENTAMOUNT) FROM v_operation_consolidated o WHERE o.r_refund_id=refund.id) AS f_CURRENTAMOUNT FROM refund;
CREATE VIEW v_refund_display AS SELECT *,(SELECT MIN(o.d_date) FROM v_operation_consolidated o WHERE o.r_refund_id=v_refund.id) AS d_FIRSTDATE, (SELECT MAX(o.d_date) FROM v_operation_consolidated o WHERE o.r_refund_id=v_refund.id) AS d_LASTDATE  FROM v_refund;
CREATE VIEW v_refund_displayname AS SELECT *, t_name AS t_displayname FROM refund;
CREATE VIEW v_payee_delete AS SELECT *, (CASE WHEN EXISTS(SELECT 1 FROM operation WHERE r_payee_id=payee.id AND t_status='Y') THEN 'Vous n''êtes pas autorisé à détruire ce tiers car utilisé par des opérations rapprochées' END) t_delete_message FROM payee;
CREATE VIEW v_payee AS SELECT *, (SELECT TOTAL(o.f_CURRENTAMOUNT) FROM v_operation o WHERE o.r_payee_id=payee.id AND o.t_template='N') AS f_CURRENTAMOUNT FROM payee;
CREATE VIEW v_payee_display AS SELECT *  FROM v_payee;
CREATE VIEW v_payee_displayname AS SELECT *, t_name AS t_displayname FROM payee;
CREATE VIEW v_category_delete AS SELECT *, (CASE WHEN EXISTS(SELECT 1 FROM v_operation_consolidated WHERE (t_REALCATEGORY=category.t_fullname OR t_REALCATEGORY like category.t_fullname||'%') AND t_status='Y') THEN 'Vous n''êtes pas autorisé à détruire cette catégorie car utilisée par des opérations rapprochées' END) t_delete_message FROM category;
CREATE VIEW v_category_display_tmp AS SELECT *,(SELECT count(distinct(so.rd_operation_id)) FROM operation o, suboperation so WHERE so.rd_operation_id=o.id AND so.r_category_id=v_category.ID AND o.t_template='N') AS i_NBOPERATIONS, (SELECT TOTAL(o.f_REALCURRENTAMOUNT) FROM v_operation_consolidated o WHERE o.i_IDCATEGORY=v_category.ID) AS f_REALCURRENTAMOUNT FROM v_category;
CREATE VIEW v_category_display AS SELECT *,f_REALCURRENTAMOUNT+(SELECT TOTAL(c.f_REALCURRENTAMOUNT) FROM vm_category_display_tmp c WHERE c.t_fullname LIKE vm_category_display_tmp.t_fullname||' > %') AS f_SUMCURRENTAMOUNT, i_NBOPERATIONS+(SELECT CAST(TOTAL(c.i_NBOPERATIONS) AS INTEGER) FROM vm_category_display_tmp c WHERE c.t_fullname like vm_category_display_tmp.t_fullname||' > %') AS i_SUMNBOPERATIONS, (CASE WHEN t_bookmarked='Y' THEN 'Y' WHEN EXISTS(SELECT 1 FROM category c WHERE c.t_bookmarked='Y' AND c.t_fullname like vm_category_display_tmp.t_fullname||' > %') THEN 'C' ELSE 'N' END) AS t_HASBOOKMARKEDCHILD, (CASE WHEN vm_category_display_tmp.f_REALCURRENTAMOUNT<0 THEN '-' WHEN vm_category_display_tmp.f_REALCURRENTAMOUNT=0 THEN '' ELSE '+' END) AS t_TYPEEXPENSE,(CASE WHEN vm_category_display_tmp.f_REALCURRENTAMOUNT<0 THEN 'Dépense' WHEN vm_category_display_tmp.f_REALCURRENTAMOUNT=0 THEN '' ELSE 'Revenu' END) AS t_TYPEEXPENSENLS FROM vm_category_display_tmp;
CREATE VIEW v_recurrentoperation_display AS SELECT rop.*, op.t_ACCOUNT, op.i_number, op.t_mode, op.i_group_id, op.t_TRANSFER, op.t_PAYEE, op.t_comment, op.t_CATEGORY, op.t_status, op.f_CURRENTAMOUNT FROM v_recurrentoperation rop, v_operation_display_all AS op WHERE rop.rd_operation_id=op.ID;
CREATE VIEW v_rule AS SELECT *,(SELECT COUNT(1) FROM rule r WHERE r.f_sortorder<=rule.f_sortorder) AS i_ORDER FROM rule;
CREATE VIEW v_rule_displayname AS SELECT *, t_definition AS t_displayname FROM rule;
CREATE VIEW v_interest AS SELECT *,(SELECT s.t_name FROM account s WHERE s.id=interest.rd_account_id) AS t_ACCOUNT  FROM interest;
CREATE VIEW v_interest_displayname AS SELECT *, STRFTIME('%d/%m/%Y',d_date)||' '||f_rate||'%' AS t_displayname FROM interest;
CREATE VIEW v_budgetrule AS SELECT *, IFNULL((SELECT s.t_fullname FROM category s WHERE s.id=budgetrule.rc_category_id),'') AS t_CATEGORYCONDITION, IFNULL((SELECT s.t_fullname FROM category s WHERE s.id=budgetrule.rc_category_id_target),'') AS t_CATEGORY, (CASE WHEN budgetrule.i_condition=-1 THEN 'Négatif' WHEN budgetrule.i_condition=1 THEN 'Positif' WHEN budgetrule.i_condition=0 THEN 'Tous' END) AS t_WHENNLS, f_quantity||(CASE WHEN budgetrule.t_absolute='N' THEN '%' ELSE (SELECT t_symbol FROM unit WHERE t_type='1') END) AS t_WHATNLS,(CASE WHEN budgetrule.t_rule='N' THEN 'Suivant' WHEN budgetrule.t_rule='C' THEN 'Courant' WHEN budgetrule.t_rule='Y' THEN 'Année' END) AS t_RULENLS FROM budgetrule;
CREATE VIEW v_budgetrule_display AS SELECT *  FROM v_budgetrule;
CREATE VIEW v_budgetrule_displayname AS SELECT *, t_WHENNLS||' '||t_WHATNLS||' '||t_RULENLS||' '||t_CATEGORY AS t_displayname FROM v_budgetrule;
CREATE VIEW v_budget_tmp AS SELECT *, IFNULL((SELECT s.t_fullname FROM category s WHERE s.id=budget.rc_category_id),'') AS t_CATEGORY, (i_year||(CASE WHEN i_month=0 THEN '' WHEN i_month<10 THEN '-0'||i_month ELSE '-'||i_month END)) AS t_PERIOD, (SELECT TOTAL(o.f_REALCURRENTAMOUNT) FROM v_operation_consolidated o WHERE STRFTIME('%Y', o.d_date)=i_year AND (i_month=0 OR STRFTIME('%m', o.d_date)=i_month) AND o.i_IDCATEGORY IN (SELECT b2.id_category FROM budgetcategory b2 WHERE b2.id=budget.id)) AS f_CURRENTAMOUNT, (SELECT GROUP_CONCAT(v_budgetrule_displayname.t_displayname,',') FROM v_budgetrule_displayname WHERE (v_budgetrule_displayname.t_year_condition='N' OR budget.i_year=v_budgetrule_displayname.i_year) AND (v_budgetrule_displayname.t_month_condition='N' OR budget.i_month=v_budgetrule_displayname.i_month) AND (v_budgetrule_displayname.t_category_condition='N' OR budget.rc_category_id=v_budgetrule_displayname.rc_category_id) ORDER BY v_budgetrule_displayname.t_absolute DESC, v_budgetrule_displayname.id) AS t_RULES FROM budget;
CREATE VIEW v_budget AS SELECT *, (f_CURRENTAMOUNT-f_budgeted_modified) AS f_DELTABEFORETRANSFER, (f_CURRENTAMOUNT-f_budgeted_modified-f_transferred) AS f_DELTA FROM v_budget_tmp;
CREATE VIEW v_budget_display AS SELECT *, (f_CURRENTAMOUNT-f_budgeted_modified) AS f_DELTABEFORETRANSFER, (f_CURRENTAMOUNT-f_budgeted_modified-f_transferred) AS f_DELTA FROM vm_budget_tmp;
CREATE VIEW v_budget_displayname AS SELECT *, t_CATEGORY||' '||t_PERIOD||' '||f_budgeted_modified AS t_displayname FROM v_budget;
CREATE TRIGGER fkdc_bank_parameters_uuid BEFORE DELETE ON bank FOR EACH ROW BEGIN     DELETE FROM parameters WHERE parameters.t_uuid_parent=OLD.id||'-'||'bank'; END;
CREATE TRIGGER fkdc_account_parameters_uuid BEFORE DELETE ON account FOR EACH ROW BEGIN     DELETE FROM parameters WHERE parameters.t_uuid_parent=OLD.id||'-'||'account'; END;
CREATE TRIGGER fkdc_unit_parameters_uuid BEFORE DELETE ON unit FOR EACH ROW BEGIN     DELETE FROM parameters WHERE parameters.t_uuid_parent=OLD.id||'-'||'unit'; END;
CREATE TRIGGER fkdc_unitvalue_parameters_uuid BEFORE DELETE ON unitvalue FOR EACH ROW BEGIN     DELETE FROM parameters WHERE parameters.t_uuid_parent=OLD.id||'-'||'unitvalue'; END;
CREATE TRIGGER fkdc_category_parameters_uuid BEFORE DELETE ON category FOR EACH ROW BEGIN     DELETE FROM parameters WHERE parameters.t_uuid_parent=OLD.id||'-'||'category'; END;
CREATE TRIGGER fkdc_operation_parameters_uuid BEFORE DELETE ON operation FOR EACH ROW BEGIN     DELETE FROM parameters WHERE parameters.t_uuid_parent=OLD.id||'-'||'operation'; END;
CREATE TRIGGER fkdc_interest_parameters_uuid BEFORE DELETE ON interest FOR EACH ROW BEGIN     DELETE FROM parameters WHERE parameters.t_uuid_parent=OLD.id||'-'||'interest'; END;
CREATE TRIGGER fkdc_suboperation_parameters_uuid BEFORE DELETE ON suboperation FOR EACH ROW BEGIN     DELETE FROM parameters WHERE parameters.t_uuid_parent=OLD.id||'-'||'suboperation'; END;
CREATE TRIGGER fkdc_refund_parameters_uuid BEFORE DELETE ON refund FOR EACH ROW BEGIN     DELETE FROM parameters WHERE parameters.t_uuid_parent=OLD.id||'-'||'refund'; END;
CREATE TRIGGER fkdc_payee_parameters_uuid BEFORE DELETE ON payee FOR EACH ROW BEGIN     DELETE FROM parameters WHERE parameters.t_uuid_parent=OLD.id||'-'||'payee'; END;
CREATE TRIGGER fkdc_recurrentoperation_parameters_uuid BEFORE DELETE ON recurrentoperation FOR EACH ROW BEGIN     DELETE FROM parameters WHERE parameters.t_uuid_parent=OLD.id||'-'||'recurrentoperation'; END;
CREATE TRIGGER fkdc_rule_parameters_uuid BEFORE DELETE ON rule FOR EACH ROW BEGIN     DELETE FROM parameters WHERE parameters.t_uuid_parent=OLD.id||'-'||'rule'; END;
CREATE TRIGGER fkdc_budget_parameters_uuid BEFORE DELETE ON budget FOR EACH ROW BEGIN     DELETE FROM parameters WHERE parameters.t_uuid_parent=OLD.id||'-'||'budget'; END;
CREATE TRIGGER fkdc_budgetrule_parameters_uuid BEFORE DELETE ON budgetrule FOR EACH ROW BEGIN     DELETE FROM parameters WHERE parameters.t_uuid_parent=OLD.id||'-'||'budgetrule'; END;
CREATE TRIGGER cpt_category_fullname1 AFTER INSERT ON category BEGIN UPDATE category SET t_fullname=CASE WHEN rd_category_id IS NULL OR rd_category_id='' OR rd_category_id=0 THEN new.t_name ELSE (SELECT c.t_fullname FROM category c WHERE c.id=new.rd_category_id)||' > '||new.t_name END WHERE id=new.id;END;
CREATE TRIGGER cpt_category_fullname2 AFTER UPDATE OF t_name, rd_category_id ON category BEGIN UPDATE category SET t_fullname=CASE WHEN rd_category_id IS NULL OR rd_category_id='' OR rd_category_id=0 THEN new.t_name ELSE (SELECT c.t_fullname FROM category c WHERE c.id=new.rd_category_id)||' > '||new.t_name END WHERE id=new.id;UPDATE category SET t_name=t_name WHERE rd_category_id=new.id;END;
CREATE TRIGGER fkdc_category_delete BEFORE DELETE ON category FOR EACH ROW BEGIN     UPDATE suboperation SET r_category_id=OLD.rd_category_id WHERE r_category_id=OLD.id; END;
explain
       SELECT TOTAL(f_CURRENTAMOUNT), d_DATEMONTH
       from v_operation_display
       WHERE d_DATEMONTH IN ('2012-05', '2012-04')
       group by d_DATEMONTH, t_TYPEEXPENSE;
  }
} {/.* Goto .*/}

# The next test requires FTS4
ifcapable !fts3 {
  finish_test
  return
}

# Taken from the gnome-shell project
#
db close
forcedelete test.db
sqlite3 db test.db
do_test fuzz-oss1-gnomeshell {
  db eval {
CREATE TABLE Resource (ID INTEGER NOT NULL PRIMARY KEY, Uri TEXT NOT
NULL, UNIQUE (Uri));
CREATE VIRTUAL TABLE fts USING fts4;
CREATE TABLE "mfo:Action" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "mfo:Enclosure" (ID INTEGER NOT NULL PRIMARY KEY,
"mfo:remoteLink" INTEGER, "mfo:remoteLink:graph" INTEGER,
"mfo:groupDefault" INTEGER, "mfo:groupDefault:graph" INTEGER,
"mfo:localLink" INTEGER, "mfo:localLink:graph" INTEGER, "mfo:optional"
INTEGER, "mfo:optional:graph" INTEGER);
CREATE TABLE "mfo:FeedChannel" (ID INTEGER NOT NULL PRIMARY KEY,
"mfo:updatedTime" INTEGER, "mfo:updatedTime:graph" INTEGER,
"mfo:updatedTime:localDate" INTEGER, "mfo:updatedTime:localTime"
INTEGER, "mfo:unreadCount" INTEGER, "mfo:unreadCount:graph" INTEGER,
"mfo:totalCount" INTEGER, "mfo:totalCount:graph" INTEGER, "mfo:action"
INTEGER, "mfo:action:graph" INTEGER, "mfo:type" INTEGER,
"mfo:type:graph" INTEGER);
CREATE TABLE "mfo:FeedElement" (ID INTEGER NOT NULL PRIMARY KEY,
"mfo:image" TEXT COLLATE NOCASE, "mfo:image:graph" INTEGER,
"mfo:feedSettings" INTEGER, "mfo:feedSettings:graph" INTEGER);
CREATE TABLE "mfo:FeedMessage" (ID INTEGER NOT NULL PRIMARY KEY,
"mfo:downloadedTime" INTEGER, "mfo:downloadedTime:graph" INTEGER,
"mfo:downloadedTime:localDate" INTEGER, "mfo:downloadedTime:localTime"
INTEGER);
CREATE TABLE "mfo:FeedMessage_mfo:enclosureList" (ID INTEGER NOT NULL,
"mfo:enclosureList" INTEGER NOT NULL, "mfo:enclosureList:graph"
INTEGER);
CREATE TABLE "mfo:FeedSettings" (ID INTEGER NOT NULL PRIMARY KEY,
"mfo:updateInterval" INTEGER, "mfo:updateInterval:graph" INTEGER,
"mfo:expiryInterval" INTEGER, "mfo:expiryInterval:graph" INTEGER,
"mfo:downloadPath" TEXT COLLATE NOCASE, "mfo:downloadPath:graph"
INTEGER, "mfo:downloadFlag" INTEGER, "mfo:downloadFlag:graph" INTEGER,
"mfo:maxSize" INTEGER, "mfo:maxSize:graph" INTEGER);
CREATE TABLE "mfo:FeedType" (ID INTEGER NOT NULL PRIMARY KEY,
"mfo:name" TEXT COLLATE NOCASE, "mfo:name:graph" INTEGER);
CREATE TABLE "mlo:GeoBoundingBox" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "mlo:GeoBoundingBox_mlo:bbNorthWest" (ID INTEGER NOT
NULL, "mlo:bbNorthWest" INTEGER NOT NULL, "mlo:bbNorthWest:graph"
INTEGER);
CREATE TABLE "mlo:GeoBoundingBox_mlo:bbSouthEast" (ID INTEGER NOT
NULL, "mlo:bbSouthEast" INTEGER NOT NULL, "mlo:bbSouthEast:graph"
INTEGER);
CREATE TABLE "mlo:GeoLocation" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "mlo:GeoLocation_mlo:asBoundingBox" (ID INTEGER NOT NULL,
"mlo:asBoundingBox" INTEGER NOT NULL, "mlo:asBoundingBox:graph"
INTEGER);
CREATE TABLE "mlo:GeoLocation_mlo:asGeoPoint" (ID INTEGER NOT NULL,
"mlo:asGeoPoint" INTEGER NOT NULL, "mlo:asGeoPoint:graph" INTEGER);
CREATE TABLE "mlo:GeoLocation_mlo:asPostalAddress" (ID INTEGER NOT
NULL, "mlo:asPostalAddress" INTEGER NOT NULL,
"mlo:asPostalAddress:graph" INTEGER);
CREATE TABLE "mlo:GeoPoint" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "mlo:GeoPoint_mlo:address" (ID INTEGER NOT NULL,
"mlo:address" TEXT NOT NULL, "mlo:address:graph" INTEGER);
CREATE TABLE "mlo:GeoPoint_mlo:altitude" (ID INTEGER NOT NULL,
"mlo:altitude" REAL NOT NULL, "mlo:altitude:graph" INTEGER);
CREATE TABLE "mlo:GeoPoint_mlo:city" (ID INTEGER NOT NULL, "mlo:city"
TEXT NOT NULL, "mlo:city:graph" INTEGER);
CREATE TABLE "mlo:GeoPoint_mlo:country" (ID INTEGER NOT NULL,
"mlo:country" TEXT NOT NULL, "mlo:country:graph" INTEGER);
CREATE TABLE "mlo:GeoPoint_mlo:latitude" (ID INTEGER NOT NULL,
"mlo:latitude" REAL NOT NULL, "mlo:latitude:graph" INTEGER);
CREATE TABLE "mlo:GeoPoint_mlo:longitude" (ID INTEGER NOT NULL,
"mlo:longitude" REAL NOT NULL, "mlo:longitude:graph" INTEGER);
CREATE TABLE "mlo:GeoPoint_mlo:state" (ID INTEGER NOT NULL,
"mlo:state" TEXT NOT NULL, "mlo:state:graph" INTEGER);
CREATE TABLE "mlo:GeoPoint_mlo:timestamp" (ID INTEGER NOT NULL,
"mlo:timestamp" INTEGER NOT NULL, "mlo:timestamp:graph" INTEGER,
"mlo:timestamp:localDate" INTEGER NOT NULL, "mlo:timestamp:localTime"
INTEGER NOT NULL);
CREATE TABLE "mlo:GeoSphere" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "mlo:GeoSphere_mlo:radius" (ID INTEGER NOT NULL,
"mlo:radius" REAL NOT NULL, "mlo:radius:graph" INTEGER);
CREATE TABLE "mlo:Landmark" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "mlo:LandmarkCategory" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "mlo:LandmarkCategory_mlo:isRemovable" (ID INTEGER NOT
NULL, "mlo:isRemovable" INTEGER NOT NULL, "mlo:isRemovable:graph"
INTEGER);
CREATE TABLE "mlo:Landmark_mlo:belongsToCategory" (ID INTEGER NOT
NULL, "mlo:belongsToCategory" INTEGER NOT NULL,
"mlo:belongsToCategory:graph" INTEGER);
CREATE TABLE "mlo:Landmark_mlo:poiLocation" (ID INTEGER NOT NULL,
"mlo:poiLocation" INTEGER NOT NULL, "mlo:poiLocation:graph" INTEGER);
CREATE TABLE "mlo:LocationBoundingBox" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "mlo:LocationBoundingBox_mlo:boxEastLimit" (ID INTEGER
NOT NULL, "mlo:boxEastLimit" INTEGER NOT NULL,
"mlo:boxEastLimit:graph" INTEGER);
CREATE TABLE "mlo:LocationBoundingBox_mlo:boxNorthLimit" (ID INTEGER
NOT NULL, "mlo:boxNorthLimit" INTEGER NOT NULL,
"mlo:boxNorthLimit:graph" INTEGER);
CREATE TABLE "mlo:LocationBoundingBox_mlo:boxSouthWestCorner" (ID
INTEGER NOT NULL, "mlo:boxSouthWestCorner" INTEGER NOT NULL,
"mlo:boxSouthWestCorner:graph" INTEGER);
CREATE TABLE "mlo:LocationBoundingBox_mlo:boxVerticalLimit" (ID
INTEGER NOT NULL, "mlo:boxVerticalLimit" INTEGER NOT NULL,
"mlo:boxVerticalLimit:graph" INTEGER);
CREATE TABLE "mlo:PointOfInterest" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "mlo:Route" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "mlo:Route_mlo:endTime" (ID INTEGER NOT NULL,
"mlo:endTime" INTEGER NOT NULL, "mlo:endTime:graph" INTEGER,
"mlo:endTime:localDate" INTEGER NOT NULL, "mlo:endTime:localTime"
INTEGER NOT NULL);
CREATE TABLE "mlo:Route_mlo:routeDetails" (ID INTEGER NOT NULL,
"mlo:routeDetails" TEXT NOT NULL, "mlo:routeDetails:graph" INTEGER);
CREATE TABLE "mlo:Route_mlo:startTime" (ID INTEGER NOT NULL,
"mlo:startTime" INTEGER NOT NULL, "mlo:startTime:graph" INTEGER,
"mlo:startTime:localDate" INTEGER NOT NULL, "mlo:startTime:localTime"
INTEGER NOT NULL);
CREATE TABLE "mto:DownloadTransfer" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "mto:State" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "mto:SyncTransfer" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "mto:Transfer" (ID INTEGER NOT NULL PRIMARY KEY,
"mto:transferState" INTEGER, "mto:transferState:graph" INTEGER,
"mto:method" INTEGER, "mto:method:graph" INTEGER, "mto:created"
INTEGER, "mto:created:graph" INTEGER, "mto:created:localDate" INTEGER,
"mto:created:localTime" INTEGER, "mto:account" TEXT COLLATE NOCASE,
"mto:account:graph" INTEGER, "mto:starter" INTEGER,
"mto:starter:graph" INTEGER, "mto:agent" INTEGER, "mto:agent:graph"
INTEGER);
CREATE TABLE "mto:TransferElement" (ID INTEGER NOT NULL PRIMARY KEY,
"mto:source" INTEGER, "mto:source:graph" INTEGER, "mto:destination"
INTEGER, "mto:destination:graph" INTEGER, "mto:startedTime" INTEGER,
"mto:startedTime:graph" INTEGER, "mto:startedTime:localDate" INTEGER,
"mto:startedTime:localTime" INTEGER, "mto:completedTime" INTEGER,
"mto:completedTime:graph" INTEGER, "mto:completedTime:localDate"
INTEGER, "mto:completedTime:localTime" INTEGER, "mto:state" INTEGER,
"mto:state:graph" INTEGER);
CREATE TABLE "mto:TransferMethod" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "mto:Transfer_mto:transferList" (ID INTEGER NOT NULL,
"mto:transferList" INTEGER NOT NULL, "mto:transferList:graph"
INTEGER);
CREATE TABLE "mto:Transfer_mto:transferPrivacyLevel" (ID INTEGER NOT
NULL, "mto:transferPrivacyLevel" TEXT NOT NULL,
"mto:transferPrivacyLevel:graph" INTEGER);
CREATE TABLE "mto:UploadTransfer" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "mto:UploadTransfer_mto:transferCategory" (ID INTEGER NOT
NULL, "mto:transferCategory" TEXT NOT NULL,
"mto:transferCategory:graph" INTEGER);
CREATE TABLE "mtp:ScanType" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nao:Property" (ID INTEGER NOT NULL PRIMARY KEY,
"nao:propertyName" TEXT COLLATE NOCASE, "nao:propertyName:graph"
INTEGER, "nao:propertyValue" TEXT COLLATE NOCASE,
"nao:propertyValue:graph" INTEGER);
CREATE TABLE "nao:Tag" (ID INTEGER NOT NULL PRIMARY KEY,
"nao:prefLabel" TEXT COLLATE NOCASE, "nao:prefLabel:graph" INTEGER,
"nao:description" TEXT COLLATE NOCASE, "nao:description:graph"
INTEGER);
CREATE TABLE "nao:Tag_tracker:isDefaultTag" (ID INTEGER NOT NULL,
"tracker:isDefaultTag" INTEGER NOT NULL, "tracker:isDefaultTag:graph"
INTEGER);
CREATE TABLE "nao:Tag_tracker:tagRelatedTo" (ID INTEGER NOT NULL,
"tracker:tagRelatedTo" INTEGER NOT NULL, "tracker:tagRelatedTo:graph"
INTEGER);
CREATE TABLE "ncal:AccessClassification" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "ncal:Alarm" (ID INTEGER NOT NULL PRIMARY KEY,
"ncal:repeat" INTEGER, "ncal:repeat:graph" INTEGER);
CREATE TABLE "ncal:AlarmAction" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "ncal:Alarm_ncal:action" (ID INTEGER NOT NULL,
"ncal:action" INTEGER NOT NULL, "ncal:action:graph" INTEGER);
CREATE TABLE "ncal:Attachment" (ID INTEGER NOT NULL PRIMARY KEY,
"ncal:attachmentUri" INTEGER, "ncal:attachmentUri:graph" INTEGER,
"ncal:fmttype" TEXT COLLATE NOCASE, "ncal:fmttype:graph" INTEGER,
"ncal:encoding" INTEGER, "ncal:encoding:graph" INTEGER,
"ncal:attachmentContent" TEXT COLLATE NOCASE,
"ncal:attachmentContent:graph" INTEGER);
CREATE TABLE "ncal:AttachmentEncoding" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "ncal:Attendee" (ID INTEGER NOT NULL PRIMARY KEY,
"ncal:delegatedTo" INTEGER, "ncal:delegatedTo:graph" INTEGER,
"ncal:delegatedFrom" INTEGER, "ncal:delegatedFrom:graph" INTEGER,
"ncal:cutype" INTEGER, "ncal:cutype:graph" INTEGER, "ncal:member"
INTEGER, "ncal:member:graph" INTEGER, "ncal:role" INTEGER,
"ncal:role:graph" INTEGER, "ncal:rsvp" INTEGER, "ncal:rsvp:graph"
INTEGER, "ncal:partstat" INTEGER, "ncal:partstat:graph" INTEGER);
CREATE TABLE "ncal:AttendeeOrOrganizer" (ID INTEGER NOT NULL PRIMARY
KEY, "ncal:dir" INTEGER, "ncal:dir:graph" INTEGER,
"ncal:involvedContact" INTEGER, "ncal:involvedContact:graph" INTEGER,
"ncal:sentBy" INTEGER, "ncal:sentBy:graph" INTEGER);
CREATE TABLE "ncal:AttendeeRole" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "ncal:BydayRulePart" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "ncal:BydayRulePart_ncal:bydayModifier" (ID INTEGER NOT
NULL, "ncal:bydayModifier" INTEGER NOT NULL,
"ncal:bydayModifier:graph" INTEGER);
CREATE TABLE "ncal:BydayRulePart_ncal:bydayWeekday" (ID INTEGER NOT
NULL, "ncal:bydayWeekday" INTEGER NOT NULL, "ncal:bydayWeekday:graph"
INTEGER);
CREATE TABLE "ncal:Calendar" (ID INTEGER NOT NULL PRIMARY KEY,
"ncal:method" TEXT COLLATE NOCASE, "ncal:method:graph" INTEGER,
"ncal:calscale" INTEGER, "ncal:calscale:graph" INTEGER, "ncal:prodid"
TEXT COLLATE NOCASE, "ncal:prodid:graph" INTEGER, "ncal:version" TEXT
COLLATE NOCASE, "ncal:version:graph" INTEGER);
CREATE TABLE "ncal:CalendarDataObject" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "ncal:CalendarScale" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "ncal:CalendarUserType" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "ncal:Calendar_ncal:component" (ID INTEGER NOT NULL,
"ncal:component" INTEGER NOT NULL, "ncal:component:graph" INTEGER);
CREATE TABLE "ncal:Event" (ID INTEGER NOT NULL PRIMARY KEY,
"ncal:eventStatus" INTEGER, "ncal:eventStatus:graph" INTEGER,
"ncal:transp" INTEGER, "ncal:transp:graph" INTEGER);
CREATE TABLE "ncal:EventStatus" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "ncal:Freebusy" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "ncal:FreebusyPeriod" (ID INTEGER NOT NULL PRIMARY KEY,
"ncal:fbtype" INTEGER, "ncal:fbtype:graph" INTEGER);
CREATE TABLE "ncal:FreebusyType" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "ncal:Freebusy_ncal:freebusy" (ID INTEGER NOT NULL,
"ncal:freebusy" INTEGER NOT NULL, "ncal:freebusy:graph" INTEGER);
CREATE TABLE "ncal:Journal" (ID INTEGER NOT NULL PRIMARY KEY,
"ncal:journalStatus" INTEGER, "ncal:journalStatus:graph" INTEGER);
CREATE TABLE "ncal:JournalStatus" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "ncal:NcalDateTime" (ID INTEGER NOT NULL PRIMARY KEY,
"ncal:ncalTimezone" INTEGER, "ncal:ncalTimezone:graph" INTEGER,
"ncal:date" INTEGER, "ncal:date:graph" INTEGER, "ncal:date:localDate"
INTEGER, "ncal:date:localTime" INTEGER, "ncal:dateTime" INTEGER,
"ncal:dateTime:graph" INTEGER, "ncal:dateTime:localDate" INTEGER,
"ncal:dateTime:localTime" INTEGER);
CREATE TABLE "ncal:NcalPeriod" (ID INTEGER NOT NULL PRIMARY KEY,
"ncal:periodBegin" INTEGER, "ncal:periodBegin:graph" INTEGER,
"ncal:periodBegin:localDate" INTEGER, "ncal:periodBegin:localTime"
INTEGER, "ncal:periodDuration" INTEGER, "ncal:periodDuration:graph"
INTEGER, "ncal:periodEnd" INTEGER, "ncal:periodEnd:graph" INTEGER,
"ncal:periodEnd:localDate" INTEGER, "ncal:periodEnd:localTime"
INTEGER);
CREATE TABLE "ncal:NcalTimeEntity" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "ncal:Organizer" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "ncal:ParticipationStatus" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "ncal:RecurrenceFrequency" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "ncal:RecurrenceIdentifier" (ID INTEGER NOT NULL PRIMARY
KEY, "ncal:range" INTEGER, "ncal:range:graph" INTEGER,
"ncal:recurrenceIdDateTime" INTEGER, "ncal:recurrenceIdDateTime:graph"
INTEGER);
CREATE TABLE "ncal:RecurrenceIdentifierRange" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "ncal:RecurrenceRule" (ID INTEGER NOT NULL PRIMARY KEY,
"ncal:until" INTEGER, "ncal:until:graph" INTEGER,
"ncal:until:localDate" INTEGER, "ncal:until:localTime" INTEGER,
"ncal:wkst" INTEGER, "ncal:wkst:graph" INTEGER, "ncal:interval"
INTEGER, "ncal:interval:graph" INTEGER, "ncal:count" INTEGER,
"ncal:count:graph" INTEGER, "ncal:freq" INTEGER, "ncal:freq:graph"
INTEGER);
CREATE TABLE "ncal:RecurrenceRule_ncal:byday" (ID INTEGER NOT NULL,
"ncal:byday" INTEGER NOT NULL, "ncal:byday:graph" INTEGER);
CREATE TABLE "ncal:RecurrenceRule_ncal:byhour" (ID INTEGER NOT NULL,
"ncal:byhour" INTEGER NOT NULL, "ncal:byhour:graph" INTEGER);
CREATE TABLE "ncal:RecurrenceRule_ncal:byminute" (ID INTEGER NOT NULL,
"ncal:byminute" INTEGER NOT NULL, "ncal:byminute:graph" INTEGER);
CREATE TABLE "ncal:RecurrenceRule_ncal:bymonth" (ID INTEGER NOT NULL,
"ncal:bymonth" INTEGER NOT NULL, "ncal:bymonth:graph" INTEGER);
CREATE TABLE "ncal:RecurrenceRule_ncal:bymonthday" (ID INTEGER NOT
NULL, "ncal:bymonthday" INTEGER NOT NULL, "ncal:bymonthday:graph"
INTEGER);
CREATE TABLE "ncal:RecurrenceRule_ncal:bysecond" (ID INTEGER NOT NULL,
"ncal:bysecond" INTEGER NOT NULL, "ncal:bysecond:graph" INTEGER);
CREATE TABLE "ncal:RecurrenceRule_ncal:bysetpos" (ID INTEGER NOT NULL,
"ncal:bysetpos" INTEGER NOT NULL, "ncal:bysetpos:graph" INTEGER);
CREATE TABLE "ncal:RecurrenceRule_ncal:byweekno" (ID INTEGER NOT NULL,
"ncal:byweekno" INTEGER NOT NULL, "ncal:byweekno:graph" INTEGER);
CREATE TABLE "ncal:RecurrenceRule_ncal:byyearday" (ID INTEGER NOT
NULL, "ncal:byyearday" INTEGER NOT NULL, "ncal:byyearday:graph"
INTEGER);
CREATE TABLE "ncal:RequestStatus" (ID INTEGER NOT NULL PRIMARY KEY,
"ncal:statusDescription" TEXT COLLATE NOCASE,
"ncal:statusDescription:graph" INTEGER, "ncal:returnStatus" TEXT
COLLATE NOCASE, "ncal:returnStatus:graph" INTEGER,
"ncal:requestStatusData" TEXT COLLATE NOCASE,
"ncal:requestStatusData:graph" INTEGER);
CREATE TABLE "ncal:TimeTransparency" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "ncal:Timezone" (ID INTEGER NOT NULL PRIMARY KEY,
"ncal:tzurl" INTEGER, "ncal:tzurl:graph" INTEGER, "ncal:standard"
INTEGER, "ncal:standard:graph" INTEGER, "ncal:daylight" INTEGER,
"ncal:daylight:graph" INTEGER, "ncal:tzid" TEXT COLLATE NOCASE,
"ncal:tzid:graph" INTEGER);
CREATE TABLE "ncal:TimezoneObservance" (ID INTEGER NOT NULL PRIMARY
KEY, "ncal:tzoffsetfrom" TEXT COLLATE NOCASE,
"ncal:tzoffsetfrom:graph" INTEGER, "ncal:tzoffsetto" TEXT COLLATE
NOCASE, "ncal:tzoffsetto:graph" INTEGER, "ncal:tzname" TEXT COLLATE
NOCASE, "ncal:tzname:graph" INTEGER);
CREATE TABLE "ncal:Todo" (ID INTEGER NOT NULL PRIMARY KEY,
"ncal:percentComplete" INTEGER, "ncal:percentComplete:graph" INTEGER,
"ncal:completed" INTEGER, "ncal:completed:graph" INTEGER,
"ncal:completed:localDate" INTEGER, "ncal:completed:localTime"
INTEGER, "ncal:todoStatus" INTEGER, "ncal:todoStatus:graph" INTEGER,
"ncal:due" INTEGER, "ncal:due:graph" INTEGER);
CREATE TABLE "ncal:TodoStatus" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "ncal:Trigger" (ID INTEGER NOT NULL PRIMARY KEY,
"ncal:related" INTEGER, "ncal:related:graph" INTEGER,
"ncal:triggerDateTime" INTEGER, "ncal:triggerDateTime:graph" INTEGER,
"ncal:triggerDateTime:localDate" INTEGER,
"ncal:triggerDateTime:localTime" INTEGER, "ncal:triggerDuration"
INTEGER, "ncal:triggerDuration:graph" INTEGER);
CREATE TABLE "ncal:TriggerRelation" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "ncal:UnionParentClass" (ID INTEGER NOT NULL PRIMARY KEY,
"ncal:lastModified" INTEGER, "ncal:lastModified:graph" INTEGER,
"ncal:lastModified:localDate" INTEGER, "ncal:lastModified:localTime"
INTEGER, "ncal:trigger" INTEGER, "ncal:trigger:graph" INTEGER,
"ncal:created" INTEGER, "ncal:created:graph" INTEGER,
"ncal:created:localDate" INTEGER, "ncal:created:localTime" INTEGER,
"ncal:url" INTEGER, "ncal:url:graph" INTEGER, "ncal:comment" TEXT
COLLATE NOCASE, "ncal:comment:graph" INTEGER, "ncal:summaryAltRep"
INTEGER, "ncal:summaryAltRep:graph" INTEGER, "ncal:priority" INTEGER,
"ncal:priority:graph" INTEGER, "ncal:location" TEXT COLLATE NOCASE,
"ncal:location:graph" INTEGER, "ncal:uid" TEXT COLLATE NOCASE,
"ncal:uid:graph" INTEGER, "ncal:requestStatus" INTEGER,
"ncal:requestStatus:graph" INTEGER, "ncal:recurrenceId" INTEGER,
"ncal:recurrenceId:graph" INTEGER, "ncal:dtstamp" INTEGER,
"ncal:dtstamp:graph" INTEGER, "ncal:dtstamp:localDate" INTEGER,
"ncal:dtstamp:localTime" INTEGER, "ncal:class" INTEGER,
"ncal:class:graph" INTEGER, "ncal:organizer" INTEGER,
"ncal:organizer:graph" INTEGER, "ncal:dtend" INTEGER,
"ncal:dtend:graph" INTEGER, "ncal:summary" TEXT COLLATE NOCASE,
"ncal:summary:graph" INTEGER, "ncal:descriptionAltRep" INTEGER,
"ncal:descriptionAltRep:graph" INTEGER, "ncal:commentAltRep" INTEGER,
"ncal:commentAltRep:graph" INTEGER, "ncal:sequence" INTEGER,
"ncal:sequence:graph" INTEGER, "ncal:contact" TEXT COLLATE NOCASE,
"ncal:contact:graph" INTEGER, "ncal:contactAltRep" INTEGER,
"ncal:contactAltRep:graph" INTEGER, "ncal:locationAltRep" INTEGER,
"ncal:locationAltRep:graph" INTEGER, "ncal:geo" INTEGER,
"ncal:geo:graph" INTEGER, "ncal:resourcesAltRep" INTEGER,
"ncal:resourcesAltRep:graph" INTEGER, "ncal:dtstart" INTEGER,
"ncal:dtstart:graph" INTEGER, "ncal:description" TEXT COLLATE NOCASE,
"ncal:description:graph" INTEGER, "ncal:relatedToSibling" TEXT COLLATE
NOCASE, "ncal:relatedToSibling:graph" INTEGER, "ncal:duration"
INTEGER, "ncal:duration:graph" INTEGER);
CREATE TABLE "ncal:UnionParentClass_ncal:attach" (ID INTEGER NOT NULL,
"ncal:attach" INTEGER NOT NULL, "ncal:attach:graph" INTEGER);
CREATE TABLE "ncal:UnionParentClass_ncal:attendee" (ID INTEGER NOT
NULL, "ncal:attendee" INTEGER NOT NULL, "ncal:attendee:graph"
INTEGER);
CREATE TABLE "ncal:UnionParentClass_ncal:categories" (ID INTEGER NOT
NULL, "ncal:categories" TEXT NOT NULL, "ncal:categories:graph"
INTEGER);
CREATE TABLE "ncal:UnionParentClass_ncal:exdate" (ID INTEGER NOT NULL,
"ncal:exdate" INTEGER NOT NULL, "ncal:exdate:graph" INTEGER);
CREATE TABLE "ncal:UnionParentClass_ncal:exrule" (ID INTEGER NOT NULL,
"ncal:exrule" INTEGER NOT NULL, "ncal:exrule:graph" INTEGER);
CREATE TABLE "ncal:UnionParentClass_ncal:hasAlarm" (ID INTEGER NOT
NULL, "ncal:hasAlarm" INTEGER NOT NULL, "ncal:hasAlarm:graph"
INTEGER);
CREATE TABLE "ncal:UnionParentClass_ncal:ncalRelation" (ID INTEGER NOT
NULL, "ncal:ncalRelation" TEXT NOT NULL, "ncal:ncalRelation:graph"
INTEGER);
CREATE TABLE "ncal:UnionParentClass_ncal:rdate" (ID INTEGER NOT NULL,
"ncal:rdate" INTEGER NOT NULL, "ncal:rdate:graph" INTEGER);
CREATE TABLE "ncal:UnionParentClass_ncal:relatedToChild" (ID INTEGER
NOT NULL, "ncal:relatedToChild" TEXT NOT NULL,
"ncal:relatedToChild:graph" INTEGER);
CREATE TABLE "ncal:UnionParentClass_ncal:relatedToParent" (ID INTEGER
NOT NULL, "ncal:relatedToParent" TEXT NOT NULL,
"ncal:relatedToParent:graph" INTEGER);
CREATE TABLE "ncal:UnionParentClass_ncal:resources" (ID INTEGER NOT
NULL, "ncal:resources" TEXT NOT NULL, "ncal:resources:graph" INTEGER);
CREATE TABLE "ncal:UnionParentClass_ncal:rrule" (ID INTEGER NOT NULL,
"ncal:rrule" INTEGER NOT NULL, "ncal:rrule:graph" INTEGER);
CREATE TABLE "ncal:Weekday" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nco:Affiliation" (ID INTEGER NOT NULL PRIMARY KEY,
"nco:department" TEXT COLLATE NOCASE, "nco:department:graph" INTEGER,
"nco:org" INTEGER, "nco:org:graph" INTEGER, "nco:role" TEXT COLLATE
NOCASE, "nco:role:graph" INTEGER);
CREATE TABLE "nco:Affiliation_nco:title" (ID INTEGER NOT NULL,
"nco:title" TEXT NOT NULL, "nco:title:graph" INTEGER);
CREATE TABLE "nco:AuthorizationStatus" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nco:BbsNumber" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nco:CarPhoneNumber" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nco:CellPhoneNumber" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nco:Contact" (ID INTEGER NOT NULL PRIMARY KEY,
"nco:fullname" TEXT COLLATE NOCASE, "nco:fullname:graph" INTEGER,
"nco:key" INTEGER, "nco:key:graph" INTEGER, "nco:contactUID" TEXT
COLLATE NOCASE, "nco:contactUID:graph" INTEGER, "nco:contactLocalUID"
TEXT COLLATE NOCASE, "nco:contactLocalUID:graph" INTEGER,
"nco:hasLocation" INTEGER, "nco:hasLocation:graph" INTEGER,
"nco:nickname" TEXT COLLATE NOCASE, "nco:nickname:graph" INTEGER,
"nco:representative" INTEGER, "nco:representative:graph" INTEGER,
"nco:photo" INTEGER, "nco:photo:graph" INTEGER, "nco:birthDate"
INTEGER, "nco:birthDate:graph" INTEGER, "nco:birthDate:localDate"
INTEGER, "nco:birthDate:localTime" INTEGER, "nco:sound" INTEGER,
"nco:sound:graph" INTEGER);
CREATE TABLE "nco:ContactGroup" (ID INTEGER NOT NULL PRIMARY KEY,
"nco:contactGroupName" TEXT COLLATE NOCASE,
"nco:contactGroupName:graph" INTEGER);
CREATE TABLE "nco:ContactList" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nco:ContactListDataObject" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nco:ContactList_nco:containsContact" (ID INTEGER NOT
NULL, "nco:containsContact" INTEGER NOT NULL,
"nco:containsContact:graph" INTEGER);
CREATE TABLE "nco:ContactMedium" (ID INTEGER NOT NULL PRIMARY KEY,
"nco:contactMediumComment" TEXT COLLATE NOCASE,
"nco:contactMediumComment:graph" INTEGER);
CREATE TABLE "nco:Contact_ncal:anniversary" (ID INTEGER NOT NULL,
"ncal:anniversary" INTEGER NOT NULL, "ncal:anniversary:graph"
INTEGER);
CREATE TABLE "nco:Contact_ncal:birthday" (ID INTEGER NOT NULL,
"ncal:birthday" INTEGER NOT NULL, "ncal:birthday:graph" INTEGER);
CREATE TABLE "nco:Contact_nco:belongsToGroup" (ID INTEGER NOT NULL,
"nco:belongsToGroup" INTEGER NOT NULL, "nco:belongsToGroup:graph"
INTEGER);
CREATE TABLE "nco:Contact_nco:note" (ID INTEGER NOT NULL, "nco:note"
TEXT NOT NULL, "nco:note:graph" INTEGER);
CREATE TABLE "nco:Contact_scal:anniversary" (ID INTEGER NOT NULL,
"scal:anniversary" INTEGER NOT NULL, "scal:anniversary:graph"
INTEGER);
CREATE TABLE "nco:Contact_scal:birthday" (ID INTEGER NOT NULL,
"scal:birthday" INTEGER NOT NULL, "scal:birthday:graph" INTEGER);
CREATE TABLE "nco:DomesticDeliveryAddress" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nco:EmailAddress" (ID INTEGER NOT NULL PRIMARY KEY,
"nco:emailAddress" TEXT COLLATE NOCASE UNIQUE,
"nco:emailAddress:graph" INTEGER);
CREATE TABLE "nco:FaxNumber" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nco:Gender" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nco:IMAccount" (ID INTEGER NOT NULL PRIMARY KEY,
"nco:imAccountAddress" INTEGER UNIQUE, "nco:imAccountAddress:graph"
INTEGER, "nco:imAccountType" TEXT COLLATE NOCASE,
"nco:imAccountType:graph" INTEGER, "nco:imDisplayName" TEXT COLLATE
NOCASE, "nco:imDisplayName:graph" INTEGER, "nco:imEnabled" INTEGER,
"nco:imEnabled:graph" INTEGER);
CREATE TABLE "nco:IMAccount_nco:hasIMContact" (ID INTEGER NOT NULL,
"nco:hasIMContact" INTEGER NOT NULL, "nco:hasIMContact:graph"
INTEGER);
CREATE TABLE "nco:IMAddress" (ID INTEGER NOT NULL PRIMARY KEY,
"nco:imID" TEXT COLLATE NOCASE, "nco:imID:graph" INTEGER,
"nco:imNickname" TEXT COLLATE NOCASE, "nco:imNickname:graph" INTEGER,
"nco:imAvatar" INTEGER, "nco:imAvatar:graph" INTEGER, "nco:imProtocol"
TEXT COLLATE NOCASE, "nco:imProtocol:graph" INTEGER,
"nco:imStatusMessage" TEXT COLLATE NOCASE,
"nco:imStatusMessage:graph" INTEGER, "nco:imPresence" INTEGER,
"nco:imPresence:graph" INTEGER, "nco:presenceLastModified" INTEGER,
"nco:presenceLastModified:graph" INTEGER,
"nco:presenceLastModified:localDate" INTEGER,
"nco:presenceLastModified:localTime" INTEGER,
"nco:imAddressAuthStatusFrom" INTEGER,
"nco:imAddressAuthStatusFrom:graph" INTEGER,
"nco:imAddressAuthStatusTo" INTEGER, "nco:imAddressAuthStatusTo:graph"
INTEGER);
CREATE TABLE "nco:IMAddress_nco:imCapability" (ID INTEGER NOT NULL,
"nco:imCapability" INTEGER NOT NULL, "nco:imCapability:graph"
INTEGER);
CREATE TABLE "nco:IMCapability" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nco:InternationalDeliveryAddress" (ID INTEGER NOT NULL
PRIMARY KEY);
CREATE TABLE "nco:IsdnNumber" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nco:MessagingNumber" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nco:ModemNumber" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nco:OrganizationContact" (ID INTEGER NOT NULL PRIMARY
KEY, "nco:logo" INTEGER, "nco:logo:graph" INTEGER);
CREATE TABLE "nco:PagerNumber" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nco:ParcelDeliveryAddress" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nco:PcsNumber" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nco:PersonContact" (ID INTEGER NOT NULL PRIMARY KEY,
"nco:nameFamily" TEXT COLLATE NOCASE, "nco:nameFamily:graph" INTEGER,
"nco:nameGiven" TEXT COLLATE NOCASE, "nco:nameGiven:graph" INTEGER,
"nco:nameAdditional" TEXT COLLATE NOCASE, "nco:nameAdditional:graph"
INTEGER, "nco:nameHonorificSuffix" TEXT COLLATE NOCASE,
"nco:nameHonorificSuffix:graph" INTEGER, "nco:nameHonorificPrefix"
TEXT COLLATE NOCASE, "nco:nameHonorificPrefix:graph" INTEGER,
"nco:hobby" TEXT COLLATE NOCASE, "nco:hobby:graph" INTEGER,
"nco:gender" INTEGER, "nco:gender:graph" INTEGER);
CREATE TABLE "nco:PersonContact_nco:hasAffiliation" (ID INTEGER NOT
NULL, "nco:hasAffiliation" INTEGER NOT NULL,
"nco:hasAffiliation:graph" INTEGER);
CREATE TABLE "nco:PhoneNumber" (ID INTEGER NOT NULL PRIMARY KEY,
"nco:phoneNumber" TEXT COLLATE NOCASE, "nco:phoneNumber:graph"
INTEGER);
CREATE TABLE "nco:PostalAddress" (ID INTEGER NOT NULL PRIMARY KEY,
"nco:region" TEXT COLLATE NOCASE, "nco:region:graph" INTEGER,
"nco:country" TEXT COLLATE NOCASE, "nco:country:graph" INTEGER,
"nco:extendedAddress" TEXT COLLATE NOCASE,
"nco:extendedAddress:graph" INTEGER, "nco:addressLocation" INTEGER,
"nco:addressLocation:graph" INTEGER, "nco:streetAddress" TEXT COLLATE
NOCASE, "nco:streetAddress:graph" INTEGER, "nco:postalcode" TEXT
COLLATE NOCASE, "nco:postalcode:graph" INTEGER, "nco:locality" TEXT
COLLATE NOCASE, "nco:locality:graph" INTEGER, "nco:county" TEXT
COLLATE NOCASE, "nco:county:graph" INTEGER, "nco:district" TEXT
COLLATE NOCASE, "nco:district:graph" INTEGER, "nco:pobox" TEXT
COLLATE NOCASE, "nco:pobox:graph" INTEGER);
CREATE TABLE "nco:PresenceStatus" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nco:Role" (ID INTEGER NOT NULL PRIMARY KEY, "nco:video"
INTEGER, "nco:video:graph" INTEGER);
CREATE TABLE "nco:Role_nco:blogUrl" (ID INTEGER NOT NULL,
"nco:blogUrl" INTEGER NOT NULL, "nco:blogUrl:graph" INTEGER);
CREATE TABLE "nco:Role_nco:foafUrl" (ID INTEGER NOT NULL,
"nco:foafUrl" INTEGER NOT NULL, "nco:foafUrl:graph" INTEGER);
CREATE TABLE "nco:Role_nco:hasContactMedium" (ID INTEGER NOT NULL,
"nco:hasContactMedium" INTEGER NOT NULL, "nco:hasContactMedium:graph"
INTEGER);
CREATE TABLE "nco:Role_nco:hasEmailAddress" (ID INTEGER NOT NULL,
"nco:hasEmailAddress" INTEGER NOT NULL, "nco:hasEmailAddress:graph"
INTEGER);
CREATE TABLE "nco:Role_nco:hasIMAddress" (ID INTEGER NOT NULL,
"nco:hasIMAddress" INTEGER NOT NULL, "nco:hasIMAddress:graph"
INTEGER);
CREATE TABLE "nco:Role_nco:hasPhoneNumber" (ID INTEGER NOT NULL,
"nco:hasPhoneNumber" INTEGER NOT NULL, "nco:hasPhoneNumber:graph"
INTEGER);
CREATE TABLE "nco:Role_nco:hasPostalAddress" (ID INTEGER NOT NULL,
"nco:hasPostalAddress" INTEGER NOT NULL, "nco:hasPostalAddress:graph"
INTEGER);
CREATE TABLE "nco:Role_nco:url" (ID INTEGER NOT NULL, "nco:url"
INTEGER NOT NULL, "nco:url:graph" INTEGER);
CREATE TABLE "nco:Role_nco:websiteUrl" (ID INTEGER NOT NULL,
"nco:websiteUrl" INTEGER NOT NULL, "nco:websiteUrl:graph" INTEGER);
CREATE TABLE "nco:VideoTelephoneNumber" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nco:VoicePhoneNumber" (ID INTEGER NOT NULL PRIMARY KEY,
"nco:voiceMail" INTEGER, "nco:voiceMail:graph" INTEGER);
CREATE TABLE "nfo:Application" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:Archive" (ID INTEGER NOT NULL PRIMARY KEY,
"nfo:uncompressedSize" INTEGER, "nfo:uncompressedSize:graph" INTEGER);
CREATE TABLE "nfo:ArchiveItem" (ID INTEGER NOT NULL PRIMARY KEY,
"nfo:isPasswordProtected" INTEGER, "nfo:isPasswordProtected:graph"
INTEGER);
CREATE TABLE "nfo:Attachment" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:Audio" (ID INTEGER NOT NULL PRIMARY KEY,
"nfo:channels" INTEGER, "nfo:channels:graph" INTEGER,
"nfo:sideChannels" INTEGER, "nfo:sideChannels:graph" INTEGER,
"nfo:lfeChannels" INTEGER, "nfo:lfeChannels:graph" INTEGER,
"nfo:sampleCount" INTEGER, "nfo:sampleCount:graph" INTEGER,
"nfo:bitsPerSample" INTEGER, "nfo:bitsPerSample:graph" INTEGER,
"nfo:frontChannels" INTEGER, "nfo:frontChannels:graph" INTEGER,
"nfo:sampleRate" REAL, "nfo:sampleRate:graph" INTEGER,
"nfo:averageAudioBitrate" REAL, "nfo:averageAudioBitrate:graph"
INTEGER, "nfo:rearChannels" INTEGER, "nfo:rearChannels:graph" INTEGER,
"nfo:gain" INTEGER, "nfo:gain:graph" INTEGER, "nfo:peakGain" INTEGER,
"nfo:peakGain:graph" INTEGER, "nfo:audioOffset" REAL,
"nfo:audioOffset:graph" INTEGER);
CREATE TABLE "nfo:Bookmark" (ID INTEGER NOT NULL PRIMARY KEY,
"nfo:bookmarks" INTEGER, "nfo:bookmarks:graph" INTEGER,
"nfo:characterPosition" INTEGER, "nfo:characterPosition:graph"
INTEGER, "nfo:pageNumber" INTEGER, "nfo:pageNumber:graph" INTEGER,
"nfo:streamPosition" INTEGER, "nfo:streamPosition:graph" INTEGER,
"nfo:streamDuration" INTEGER, "nfo:streamDuration:graph" INTEGER);
CREATE TABLE "nfo:BookmarkFolder" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:BookmarkFolder_nfo:containsBookmark" (ID INTEGER NOT
NULL, "nfo:containsBookmark" INTEGER NOT NULL,
"nfo:containsBookmark:graph" INTEGER);
CREATE TABLE "nfo:BookmarkFolder_nfo:containsBookmarkFolder" (ID
INTEGER NOT NULL, "nfo:containsBookmarkFolder" INTEGER NOT NULL,
"nfo:containsBookmarkFolder:graph" INTEGER);
CREATE TABLE "nfo:CompressionType" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:Cursor" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:DataContainer" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:DeletedResource" (ID INTEGER NOT NULL PRIMARY KEY,
"nfo:originalLocation" TEXT COLLATE NOCASE,
"nfo:originalLocation:graph" INTEGER, "nfo:deletionDate" INTEGER,
"nfo:deletionDate:graph" INTEGER, "nfo:deletionDate:localDate"
INTEGER, "nfo:deletionDate:localTime" INTEGER);
CREATE TABLE "nfo:Document" (ID INTEGER NOT NULL PRIMARY KEY,
"nfo:tableOfContents" TEXT COLLATE NOCASE,
"nfo:tableOfContents:graph" INTEGER);
CREATE TABLE "nfo:EmbeddedFileDataObject" (ID INTEGER NOT NULL PRIMARY
KEY, "nfo:encoding" TEXT COLLATE NOCASE, "nfo:encoding:graph"
INTEGER);
CREATE TABLE "nfo:Equipment" (ID INTEGER NOT NULL PRIMARY KEY,
"nfo:manufacturer" TEXT COLLATE NOCASE, "nfo:manufacturer:graph"
INTEGER, "nfo:model" TEXT COLLATE NOCASE, "nfo:model:graph" INTEGER,
"nfo:equipmentSoftware" TEXT COLLATE NOCASE,
"nfo:equipmentSoftware:graph" INTEGER);
CREATE TABLE "nfo:Executable" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:FileDataObject" (ID INTEGER NOT NULL PRIMARY KEY,
"nfo:fileLastAccessed" INTEGER, "nfo:fileLastAccessed:graph" INTEGER,
"nfo:fileLastAccessed:localDate" INTEGER,
"nfo:fileLastAccessed:localTime" INTEGER, "nfo:fileCreated" INTEGER,
"nfo:fileCreated:graph" INTEGER, "nfo:fileCreated:localDate" INTEGER,
"nfo:fileCreated:localTime" INTEGER, "nfo:fileSize" INTEGER,
"nfo:fileSize:graph" INTEGER, "nfo:permissions" TEXT COLLATE NOCASE,
"nfo:permissions:graph" INTEGER, "nfo:fileName" TEXT COLLATE NOCASE,
"nfo:fileName:graph" INTEGER, "nfo:hasHash" INTEGER,
"nfo:hasHash:graph" INTEGER, "nfo:fileOwner" INTEGER,
"nfo:fileOwner:graph" INTEGER, "nfo:fileLastModified" INTEGER,
"nfo:fileLastModified:graph" INTEGER, "nfo:fileLastModified:localDate"
INTEGER, "nfo:fileLastModified:localTime" INTEGER);
CREATE TABLE "nfo:FileHash" (ID INTEGER NOT NULL PRIMARY KEY,
"nfo:hashValue" TEXT COLLATE NOCASE, "nfo:hashValue:graph" INTEGER,
"nfo:hashAlgorithm" TEXT COLLATE NOCASE, "nfo:hashAlgorithm:graph"
INTEGER);
CREATE TABLE "nfo:Filesystem" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:FilesystemImage" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:Folder" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:Font" (ID INTEGER NOT NULL PRIMARY KEY,
"nfo:fontFamily" TEXT COLLATE NOCASE, "nfo:fontFamily:graph" INTEGER,
"nfo:foundry" INTEGER, "nfo:foundry:graph" INTEGER);
CREATE TABLE "nfo:HardDiskPartition" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:HelpDocument" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:HtmlDocument" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:Icon" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:Image" (ID INTEGER NOT NULL PRIMARY KEY,
"nfo:verticalResolution" INTEGER, "nfo:verticalResolution:graph"
INTEGER, "nfo:horizontalResolution" INTEGER,
"nfo:horizontalResolution:graph" INTEGER, "nfo:orientation" INTEGER,
"nfo:orientation:graph" INTEGER);
CREATE TABLE "nfo:Image_nfo:depicts" (ID INTEGER NOT NULL,
"nfo:depicts" INTEGER NOT NULL, "nfo:depicts:graph" INTEGER);
CREATE TABLE "nfo:Image_nfo:hasRegionOfInterest" (ID INTEGER NOT NULL,
"nfo:hasRegionOfInterest" INTEGER NOT NULL,
"nfo:hasRegionOfInterest:graph" INTEGER);
CREATE TABLE "nfo:Media" (ID INTEGER NOT NULL PRIMARY KEY, "nfo:count"
INTEGER, "nfo:count:graph" INTEGER, "nfo:duration" INTEGER,
"nfo:duration:graph" INTEGER, "nfo:compressionType" INTEGER,
"nfo:compressionType:graph" INTEGER, "nfo:hasMediaStream" INTEGER,
"nfo:hasMediaStream:graph" INTEGER, "nfo:bitDepth" INTEGER,
"nfo:bitDepth:graph" INTEGER, "nfo:codec" TEXT COLLATE NOCASE,
"nfo:codec:graph" INTEGER, "nfo:encodedBy" TEXT COLLATE NOCASE,
"nfo:encodedBy:graph" INTEGER, "nfo:bitrateType" TEXT COLLATE NOCASE,
"nfo:bitrateType:graph" INTEGER, "nfo:averageBitrate" REAL,
"nfo:averageBitrate:graph" INTEGER, "nfo:genre" TEXT COLLATE NOCASE,
"nfo:genre:graph" INTEGER, "nfo:equipment" INTEGER,
"nfo:equipment:graph" INTEGER, "nfo:lastPlayedPosition" INTEGER,
"nfo:lastPlayedPosition:graph" INTEGER, "nmm:genre" TEXT COLLATE
NOCASE, "nmm:genre:graph" INTEGER, "nmm:skipCounter" INTEGER,
"nmm:skipCounter:graph" INTEGER, "nmm:dlnaProfile" TEXT COLLATE
NOCASE, "nmm:dlnaProfile:graph" INTEGER, "nmm:dlnaMime" TEXT COLLATE
NOCASE, "nmm:dlnaMime:graph" INTEGER, "nmm:uPnPShared" INTEGER,
"nmm:uPnPShared:graph" INTEGER, "mtp:credits" TEXT COLLATE NOCASE,
"mtp:credits:graph" INTEGER, "mtp:creator" TEXT COLLATE NOCASE,
"mtp:creator:graph" INTEGER);
CREATE TABLE "nfo:MediaFileListEntry" (ID INTEGER NOT NULL PRIMARY
KEY, "nfo:listPosition" REAL, "nfo:listPosition:graph" INTEGER,
"nfo:entryUrl" TEXT COLLATE NOCASE, "nfo:entryUrl:graph" INTEGER);
CREATE TABLE "nfo:MediaList" (ID INTEGER NOT NULL PRIMARY KEY,
"nfo:entryCounter" INTEGER, "nfo:entryCounter:graph" INTEGER,
"nfo:listDuration" INTEGER, "nfo:listDuration:graph" INTEGER);
CREATE TABLE "nfo:MediaList_nfo:hasMediaFileListEntry" (ID INTEGER NOT
NULL, "nfo:hasMediaFileListEntry" INTEGER NOT NULL,
"nfo:hasMediaFileListEntry:graph" INTEGER);
CREATE TABLE "nfo:MediaList_nfo:mediaListEntry" (ID INTEGER NOT NULL,
"nfo:mediaListEntry" INTEGER NOT NULL, "nfo:mediaListEntry:graph"
INTEGER);
CREATE TABLE "nfo:MediaStream" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:Media_mtp:hidden" (ID INTEGER NOT NULL, "mtp:hidden"
INTEGER NOT NULL, "mtp:hidden:graph" INTEGER);
CREATE TABLE "nfo:Media_nmm:alternativeMedia" (ID INTEGER NOT NULL,
"nmm:alternativeMedia" INTEGER NOT NULL, "nmm:alternativeMedia:graph"
INTEGER);
CREATE TABLE "nfo:MindMap" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:Note" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:OperatingSystem" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:Orientation" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:PaginatedTextDocument" (ID INTEGER NOT NULL PRIMARY
KEY, "nfo:pageCount" INTEGER, "nfo:pageCount:graph" INTEGER);
CREATE TABLE "nfo:PlainTextDocument" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:Presentation" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:RasterImage" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:RegionOfInterest" (ID INTEGER NOT NULL PRIMARY KEY,
"nfo:regionOfInterestX" REAL, "nfo:regionOfInterestX:graph" INTEGER,
"nfo:regionOfInterestY" REAL, "nfo:regionOfInterestY:graph" INTEGER,
"nfo:regionOfInterestWidth" REAL, "nfo:regionOfInterestWidth:graph"
INTEGER, "nfo:regionOfInterestHeight" REAL,
"nfo:regionOfInterestHeight:graph" INTEGER, "nfo:regionOfInterestType"
INTEGER, "nfo:regionOfInterestType:graph" INTEGER, "nfo:roiRefersTo"
INTEGER, "nfo:roiRefersTo:graph" INTEGER);
CREATE TABLE "nfo:RegionOfInterestContent" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:RemoteDataObject" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:RemotePortAddress" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:Software" (ID INTEGER NOT NULL PRIMARY KEY,
"nfo:conflicts" INTEGER, "nfo:conflicts:graph" INTEGER,
"nfo:supercedes" INTEGER, "nfo:supercedes:graph" INTEGER,
"nfo:softwareIcon" INTEGER, "nfo:softwareIcon:graph" INTEGER,
"nfo:softwareCmdLine" TEXT COLLATE NOCASE,
"nfo:softwareCmdLine:graph" INTEGER);
CREATE TABLE "nfo:SoftwareApplication" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:SoftwareCategory" (ID INTEGER NOT NULL PRIMARY KEY,
"nfo:softwareCategoryIcon" INTEGER, "nfo:softwareCategoryIcon:graph"
INTEGER);
CREATE TABLE "nfo:SoftwareItem" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:SoftwareService" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:SourceCode" (ID INTEGER NOT NULL PRIMARY KEY,
"nfo:commentCharacterCount" INTEGER, "nfo:commentCharacterCount:graph"
INTEGER, "nfo:programmingLanguage" TEXT COLLATE NOCASE,
"nfo:programmingLanguage:graph" INTEGER, "nfo:definesClass" TEXT
COLLATE NOCASE, "nfo:definesClass:graph" INTEGER,
"nfo:definesFunction" TEXT COLLATE NOCASE,
"nfo:definesFunction:graph" INTEGER, "nfo:definesGlobalVariable" TEXT
COLLATE NOCASE, "nfo:definesGlobalVariable:graph" INTEGER);
CREATE TABLE "nfo:Spreadsheet" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:TextDocument" (ID INTEGER NOT NULL PRIMARY KEY,
"nfo:wordCount" INTEGER, "nfo:wordCount:graph" INTEGER,
"nfo:lineCount" INTEGER, "nfo:lineCount:graph" INTEGER,
"nfo:characterCount" INTEGER, "nfo:characterCount:graph" INTEGER);
CREATE TABLE "nfo:Trash" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:VectorImage" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nfo:Video" (ID INTEGER NOT NULL PRIMARY KEY,
"nfo:frameRate" REAL, "nfo:frameRate:graph" INTEGER, "nfo:frameCount"
INTEGER, "nfo:frameCount:graph" INTEGER, "nfo:averageVideoBitrate"
REAL, "nfo:averageVideoBitrate:graph" INTEGER);
CREATE TABLE "nfo:Visual" (ID INTEGER NOT NULL PRIMARY KEY,
"nie:contentCreated" INTEGER, "nie:contentCreated:graph" INTEGER,
"nie:contentCreated:localDate" INTEGER, "nie:contentCreated:localTime"
INTEGER, "nfo:aspectRatio" REAL, "nfo:aspectRatio:graph" INTEGER,
"nfo:heading" REAL, "nfo:heading:graph" INTEGER, "nfo:tilt" REAL,
"nfo:tilt:graph" INTEGER, "nfo:interlaceMode" INTEGER,
"nfo:interlaceMode:graph" INTEGER, "nfo:height" INTEGER,
"nfo:height:graph" INTEGER, "nfo:width" INTEGER, "nfo:width:graph"
INTEGER, "nfo:colorDepth" INTEGER, "nfo:colorDepth:graph" INTEGER);
CREATE TABLE "nfo:WebHistory" (ID INTEGER NOT NULL PRIMARY KEY,
"nfo:domain" TEXT COLLATE NOCASE, "nfo:domain:graph" INTEGER,
"nfo:uri" TEXT COLLATE NOCASE, "nfo:uri:graph" INTEGER);
CREATE TABLE "nfo:Website" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nid3:ID3Audio" (ID INTEGER NOT NULL PRIMARY KEY,
"nid3:title" TEXT COLLATE NOCASE, "nid3:title:graph" INTEGER,
"nid3:albumTitle" TEXT COLLATE NOCASE, "nid3:albumTitle:graph"
INTEGER, "nid3:contentType" TEXT COLLATE NOCASE,
"nid3:contentType:graph" INTEGER, "nid3:length" INTEGER,
"nid3:length:graph" INTEGER, "nid3:recordingYear" INTEGER,
"nid3:recordingYear:graph" INTEGER, "nid3:trackNumber" TEXT COLLATE
NOCASE, "nid3:trackNumber:graph" INTEGER, "nid3:partOfSet" TEXT
COLLATE NOCASE, "nid3:partOfSet:graph" INTEGER, "nid3:comments" TEXT
COLLATE NOCASE, "nid3:comments:graph" INTEGER);
CREATE TABLE "nid3:ID3Audio_nid3:leadArtist" (ID INTEGER NOT NULL,
"nid3:leadArtist" INTEGER NOT NULL, "nid3:leadArtist:graph" INTEGER);
CREATE TABLE "nie:DataObject" (ID INTEGER NOT NULL PRIMARY KEY,
"nie:url" TEXT COLLATE NOCASE UNIQUE, "nie:url:graph" INTEGER,
"nie:byteSize" INTEGER, "nie:byteSize:graph" INTEGER,
"nie:interpretedAs" INTEGER, "nie:interpretedAs:graph" INTEGER,
"nie:lastRefreshed" INTEGER, "nie:lastRefreshed:graph" INTEGER,
"nie:lastRefreshed:localDate" INTEGER, "nie:lastRefreshed:localTime"
INTEGER, "nie:created" INTEGER, "nie:created:graph" INTEGER,
"nie:created:localDate" INTEGER, "nie:created:localTime" INTEGER,
"nfo:belongsToContainer" INTEGER, "nfo:belongsToContainer:graph"
INTEGER, "tracker:available" INTEGER, "tracker:available:graph"
INTEGER);
CREATE TABLE "nie:DataObject_nie:dataSource" (ID INTEGER NOT NULL,
"nie:dataSource" INTEGER NOT NULL, "nie:dataSource:graph" INTEGER);
CREATE TABLE "nie:DataObject_nie:isPartOf" (ID INTEGER NOT NULL,
"nie:isPartOf" INTEGER NOT NULL, "nie:isPartOf:graph" INTEGER);
CREATE TABLE "nie:DataSource" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nie:InformationElement" (ID INTEGER NOT NULL PRIMARY
KEY, "nie:title" TEXT COLLATE NOCASE, "nie:title:graph" INTEGER,
"nie:contentLastModified" INTEGER, "nie:contentLastModified:graph"
INTEGER, "nie:contentLastModified:localDate" INTEGER,
"nie:contentLastModified:localTime" INTEGER, "nie:subject" TEXT
COLLATE NOCASE, "nie:subject:graph" INTEGER, "nie:mimeType" TEXT
COLLATE NOCASE, "nie:mimeType:graph" INTEGER, "nie:language" TEXT
COLLATE NOCASE, "nie:language:graph" INTEGER, "nie:plainTextContent"
TEXT COLLATE NOCASE, "nie:plainTextContent:graph" INTEGER,
"nie:legal" TEXT COLLATE NOCASE, "nie:legal:graph" INTEGER,
"nie:generator" TEXT COLLATE NOCASE, "nie:generator:graph" INTEGER,
"nie:description" TEXT COLLATE NOCASE, "nie:description:graph"
INTEGER, "nie:disclaimer" TEXT COLLATE NOCASE, "nie:disclaimer:graph"
INTEGER, "nie:depends" INTEGER, "nie:depends:graph" INTEGER,
"nie:links" INTEGER, "nie:links:graph" INTEGER, "nie:copyright" TEXT
COLLATE NOCASE, "nie:copyright:graph" INTEGER, "nie:comment" TEXT
COLLATE NOCASE, "nie:comment:graph" INTEGER, "nie:isStoredAs"
INTEGER, "nie:isStoredAs:graph" INTEGER, "nie:version" TEXT COLLATE
NOCASE, "nie:version:graph" INTEGER, "nie:contentCreated" INTEGER,
"nie:contentCreated:graph" INTEGER, "nie:contentCreated:localDate"
INTEGER, "nie:contentCreated:localTime" INTEGER, "nie:contentAccessed"
INTEGER, "nie:contentAccessed:graph" INTEGER,
"nie:contentAccessed:localDate" INTEGER,
"nie:contentAccessed:localTime" INTEGER, "nie:license" TEXT COLLATE
NOCASE, "nie:license:graph" INTEGER, "nie:identifier" TEXT COLLATE
NOCASE, "nie:identifier:graph" INTEGER, "nie:licenseType" TEXT
COLLATE NOCASE, "nie:licenseType:graph" INTEGER, "nie:characterSet"
TEXT COLLATE NOCASE, "nie:characterSet:graph" INTEGER,
"nie:contentSize" INTEGER, "nie:contentSize:graph" INTEGER,
"nie:rootElementOf" INTEGER, "nie:rootElementOf:graph" INTEGER,
"nie:usageCounter" INTEGER, "nie:usageCounter:graph" INTEGER,
"nco:publisher" INTEGER, "nco:publisher:graph" INTEGER,
"nfo:isContentEncrypted" INTEGER, "nfo:isContentEncrypted:graph"
INTEGER, "slo:location" INTEGER, "slo:location:graph" INTEGER,
"nfo:isBootable" INTEGER, "nfo:isBootable:graph" INTEGER, "osinfo:id"
TEXT COLLATE NOCASE, "osinfo:id:graph" INTEGER, "osinfo:mediaId" TEXT
COLLATE NOCASE, "osinfo:mediaId:graph" INTEGER);
CREATE TABLE "nie:InformationElement_mlo:location" (ID INTEGER NOT
NULL, "mlo:location" INTEGER NOT NULL, "mlo:location:graph" INTEGER);
CREATE TABLE "nie:InformationElement_nao:hasProperty" (ID INTEGER NOT
NULL, "nao:hasProperty" INTEGER NOT NULL, "nao:hasProperty:graph"
INTEGER);
CREATE TABLE "nie:InformationElement_nco:contributor" (ID INTEGER NOT
NULL, "nco:contributor" INTEGER NOT NULL, "nco:contributor:graph"
INTEGER);
CREATE TABLE "nie:InformationElement_nco:creator" (ID INTEGER NOT
NULL, "nco:creator" INTEGER NOT NULL, "nco:creator:graph" INTEGER);
CREATE TABLE "nie:InformationElement_nie:hasLogicalPart" (ID INTEGER
NOT NULL, "nie:hasLogicalPart" INTEGER NOT NULL,
"nie:hasLogicalPart:graph" INTEGER);
CREATE TABLE "nie:InformationElement_nie:hasPart" (ID INTEGER NOT
NULL, "nie:hasPart" INTEGER NOT NULL, "nie:hasPart:graph" INTEGER);
CREATE TABLE "nie:InformationElement_nie:informationElementDate" (ID
INTEGER NOT NULL, "nie:informationElementDate" INTEGER NOT NULL,
"nie:informationElementDate:graph" INTEGER,
"nie:informationElementDate:localDate" INTEGER NOT NULL,
"nie:informationElementDate:localTime" INTEGER NOT NULL);
CREATE TABLE "nie:InformationElement_nie:isLogicalPartOf" (ID INTEGER
NOT NULL, "nie:isLogicalPartOf" INTEGER NOT NULL,
"nie:isLogicalPartOf:graph" INTEGER);
CREATE TABLE "nie:InformationElement_nie:keyword" (ID INTEGER NOT
NULL, "nie:keyword" TEXT NOT NULL, "nie:keyword:graph" INTEGER);
CREATE TABLE "nie:InformationElement_nie:relatedTo" (ID INTEGER NOT
NULL, "nie:relatedTo" INTEGER NOT NULL, "nie:relatedTo:graph"
INTEGER);
CREATE TABLE "nmm:AnalogRadio" (ID INTEGER NOT NULL PRIMARY KEY,
"nmm:modulation" INTEGER, "nmm:modulation:graph" INTEGER,
"nmm:frequency" INTEGER, "nmm:frequency:graph" INTEGER);
CREATE TABLE "nmm:Artist" (ID INTEGER NOT NULL PRIMARY KEY,
"nmm:artistName" TEXT COLLATE NOCASE, "nmm:artistName:graph"
INTEGER);
CREATE TABLE "nmm:DigitalRadio" (ID INTEGER NOT NULL PRIMARY KEY,
"nmm:streamingBitrate" INTEGER, "nmm:streamingBitrate:graph" INTEGER,
"nmm:encoding" TEXT COLLATE NOCASE, "nmm:encoding:graph" INTEGER,
"nmm:protocol" TEXT COLLATE NOCASE, "nmm:protocol:graph" INTEGER);
CREATE TABLE "nmm:Flash" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nmm:ImageList" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nmm:MeteringMode" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nmm:MusicAlbum" (ID INTEGER NOT NULL PRIMARY KEY,
"nie:title" TEXT COLLATE NOCASE, "nie:title:graph" INTEGER,
"nmm:albumTrackCount" INTEGER, "nmm:albumTrackCount:graph" INTEGER,
"nmm:albumTitle" TEXT COLLATE NOCASE, "nmm:albumTitle:graph" INTEGER,
"nmm:albumDuration" INTEGER, "nmm:albumDuration:graph" INTEGER,
"nmm:albumGain" INTEGER, "nmm:albumGain:graph" INTEGER,
"nmm:albumPeakGain" INTEGER, "nmm:albumPeakGain:graph" INTEGER);
CREATE TABLE "nmm:MusicAlbumDisc" (ID INTEGER NOT NULL PRIMARY KEY,
"nmm:albumDiscAlbum" INTEGER, "nmm:albumDiscAlbum:graph" INTEGER,
"nmm:musicCDIdentifier" TEXT COLLATE NOCASE,
"nmm:musicCDIdentifier:graph" INTEGER, "nmm:setNumber" INTEGER,
"nmm:setNumber:graph" INTEGER);
CREATE TABLE "nmm:MusicAlbum_nmm:albumArtist" (ID INTEGER NOT NULL,
"nmm:albumArtist" INTEGER NOT NULL, "nmm:albumArtist:graph" INTEGER);
CREATE TABLE "nmm:MusicPiece" (ID INTEGER NOT NULL PRIMARY KEY,
"nie:title" TEXT COLLATE NOCASE, "nie:title:graph" INTEGER,
"nmm:musicAlbum" INTEGER, "nmm:musicAlbum:graph" INTEGER,
"nmm:musicAlbumDisc" INTEGER, "nmm:musicAlbumDisc:graph" INTEGER,
"nmm:beatsPerMinute" INTEGER, "nmm:beatsPerMinute:graph" INTEGER,
"nmm:performer" INTEGER, "nmm:performer:graph" INTEGER, "nmm:composer"
INTEGER, "nmm:composer:graph" INTEGER, "nmm:lyricist" INTEGER,
"nmm:lyricist:graph" INTEGER, "nmm:trackNumber" INTEGER,
"nmm:trackNumber:graph" INTEGER,
"nmm:internationalStandardRecordingCode" TEXT COLLATE NOCASE,
"nmm:internationalStandardRecordingCode:graph" INTEGER);
CREATE TABLE "nmm:MusicPiece_nmm:lyrics" (ID INTEGER NOT NULL,
"nmm:lyrics" INTEGER NOT NULL, "nmm:lyrics:graph" INTEGER);
CREATE TABLE "nmm:Photo" (ID INTEGER NOT NULL PRIMARY KEY,
"nmm:exposureTime" REAL, "nmm:exposureTime:graph" INTEGER, "nmm:flash"
INTEGER, "nmm:flash:graph" INTEGER, "nmm:fnumber" REAL,
"nmm:fnumber:graph" INTEGER, "nmm:focalLength" REAL,
"nmm:focalLength:graph" INTEGER, "nmm:isoSpeed" REAL,
"nmm:isoSpeed:graph" INTEGER, "nmm:meteringMode" INTEGER,
"nmm:meteringMode:graph" INTEGER, "nmm:whiteBalance" INTEGER,
"nmm:whiteBalance:graph" INTEGER, "nmm:isCropped" INTEGER,
"nmm:isCropped:graph" INTEGER, "nmm:isColorCorrected" INTEGER,
"nmm:isColorCorrected:graph" INTEGER);
CREATE TABLE "nmm:Playlist" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nmm:RadioModulation" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nmm:RadioStation" (ID INTEGER NOT NULL PRIMARY KEY,
"nmm:radioIcon" INTEGER, "nmm:radioIcon:graph" INTEGER, "nmm:radioPTY"
INTEGER, "nmm:radioPTY:graph" INTEGER);
CREATE TABLE "nmm:RadioStation_nmm:carrier" (ID INTEGER NOT NULL,
"nmm:carrier" INTEGER NOT NULL, "nmm:carrier:graph" INTEGER);
CREATE TABLE "nmm:SynchronizedText" (ID INTEGER NOT NULL PRIMARY KEY,
"nmm:isForHearingImpaired" INTEGER, "nmm:isForHearingImpaired:graph"
INTEGER);
CREATE TABLE "nmm:Video" (ID INTEGER NOT NULL PRIMARY KEY,
"nmm:videoAlbum" INTEGER, "nmm:videoAlbum:graph" INTEGER,
"nmm:isSeries" INTEGER, "nmm:isSeries:graph" INTEGER, "nmm:season"
INTEGER, "nmm:season:graph" INTEGER, "nmm:episodeNumber" INTEGER,
"nmm:episodeNumber:graph" INTEGER, "nmm:runTime" INTEGER,
"nmm:runTime:graph" INTEGER, "nmm:synopsis" TEXT COLLATE NOCASE,
"nmm:synopsis:graph" INTEGER, "nmm:MPAARating" TEXT COLLATE NOCASE,
"nmm:MPAARating:graph" INTEGER, "nmm:category" TEXT COLLATE NOCASE,
"nmm:category:graph" INTEGER, "nmm:producedBy" INTEGER,
"nmm:producedBy:graph" INTEGER, "nmm:hasSubtitle" INTEGER,
"nmm:hasSubtitle:graph" INTEGER, "nmm:isContentEncrypted" INTEGER,
"nmm:isContentEncrypted:graph" INTEGER, "mtp:fourCC" TEXT COLLATE
NOCASE, "mtp:fourCC:graph" INTEGER, "mtp:waveformat" TEXT COLLATE
NOCASE, "mtp:waveformat:graph" INTEGER);
CREATE TABLE "nmm:Video_mtp:scantype" (ID INTEGER NOT NULL,
"mtp:scantype" INTEGER NOT NULL, "mtp:scantype:graph" INTEGER);
CREATE TABLE "nmm:Video_nmm:director" (ID INTEGER NOT NULL,
"nmm:director" INTEGER NOT NULL, "nmm:director:graph" INTEGER);
CREATE TABLE "nmm:Video_nmm:leadActor" (ID INTEGER NOT NULL,
"nmm:leadActor" INTEGER NOT NULL, "nmm:leadActor:graph" INTEGER);
CREATE TABLE "nmm:Video_nmm:subtitle" (ID INTEGER NOT NULL,
"nmm:subtitle" INTEGER NOT NULL, "nmm:subtitle:graph" INTEGER);
CREATE TABLE "nmm:WhiteBalance" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nmo:Attachment" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nmo:Call" (ID INTEGER NOT NULL PRIMARY KEY,
"nmo:sentDate" INTEGER, "nmo:sentDate:graph" INTEGER,
"nmo:sentDate:localDate" INTEGER, "nmo:sentDate:localTime" INTEGER,
"nmo:duration" INTEGER, "nmo:duration:graph" INTEGER);
CREATE TABLE "nmo:CommunicationChannel" (ID INTEGER NOT NULL PRIMARY
KEY, "nmo:lastMessageDate" INTEGER, "nmo:lastMessageDate:graph"
INTEGER, "nmo:lastMessageDate:localDate" INTEGER,
"nmo:lastMessageDate:localTime" INTEGER,
"nmo:lastSuccessfulMessageDate" INTEGER,
"nmo:lastSuccessfulMessageDate:graph" INTEGER,
"nmo:lastSuccessfulMessageDate:localDate" INTEGER,
"nmo:lastSuccessfulMessageDate:localTime" INTEGER);
CREATE TABLE "nmo:CommunicationChannel_nmo:hasParticipant" (ID INTEGER
NOT NULL, "nmo:hasParticipant" INTEGER NOT NULL,
"nmo:hasParticipant:graph" INTEGER);
CREATE TABLE "nmo:Conversation" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nmo:DeliveryStatus" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nmo:Email" (ID INTEGER NOT NULL PRIMARY KEY,
"nmo:hasContent" INTEGER, "nmo:hasContent:graph" INTEGER,
"nmo:isFlagged" INTEGER, "nmo:isFlagged:graph" INTEGER, "nmo:isRecent"
INTEGER, "nmo:isRecent:graph" INTEGER, "nmo:status" TEXT COLLATE
NOCASE, "nmo:status:graph" INTEGER, "nmo:responseType" TEXT COLLATE
NOCASE, "nmo:responseType:graph" INTEGER);
CREATE TABLE "nmo:Email_nmo:contentMimeType" (ID INTEGER NOT NULL,
"nmo:contentMimeType" TEXT NOT NULL, "nmo:contentMimeType:graph"
INTEGER);
CREATE TABLE "nmo:IMMessage" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nmo:MMSMessage" (ID INTEGER NOT NULL PRIMARY KEY,
"nmo:mmsHasContent" INTEGER, "nmo:mmsHasContent:graph" INTEGER);
CREATE TABLE "nmo:MailAccount" (ID INTEGER NOT NULL PRIMARY KEY,
"nmo:accountName" TEXT COLLATE NOCASE, "nmo:accountName:graph"
INTEGER, "nmo:accountDisplayName" TEXT COLLATE NOCASE,
"nmo:accountDisplayName:graph" INTEGER, "nmo:fromAddress" INTEGER,
"nmo:fromAddress:graph" INTEGER, "nmo:signature" TEXT COLLATE NOCASE,
"nmo:signature:graph" INTEGER);
CREATE TABLE "nmo:MailFolder" (ID INTEGER NOT NULL PRIMARY KEY,
"nmo:folderName" TEXT COLLATE NOCASE, "nmo:folderName:graph" INTEGER,
"nmo:serverCount" INTEGER, "nmo:serverCount:graph" INTEGER,
"nmo:serverUnreadCount" INTEGER, "nmo:serverUnreadCount:graph"
INTEGER);
CREATE TABLE "nmo:MailboxDataObject" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nmo:Message" (ID INTEGER NOT NULL PRIMARY KEY,
"nmo:sentDate" INTEGER, "nmo:sentDate:graph" INTEGER,
"nmo:sentDate:localDate" INTEGER, "nmo:sentDate:localTime" INTEGER,
"nmo:from" INTEGER, "nmo:from:graph" INTEGER, "nmo:isAnswered"
INTEGER, "nmo:isAnswered:graph" INTEGER, "nmo:isDeleted" INTEGER,
"nmo:isDeleted:graph" INTEGER, "nmo:isDraft" INTEGER,
"nmo:isDraft:graph" INTEGER, "nmo:isRead" INTEGER, "nmo:isRead:graph"
INTEGER, "nmo:isSent" INTEGER, "nmo:isSent:graph" INTEGER,
"nmo:isEmergency" INTEGER, "nmo:isEmergency:graph" INTEGER,
"nmo:htmlMessageContent" TEXT COLLATE NOCASE,
"nmo:htmlMessageContent:graph" INTEGER, "nmo:messageId" TEXT COLLATE
NOCASE, "nmo:messageId:graph" INTEGER, "nmo:messageSubject" TEXT
COLLATE NOCASE, "nmo:messageSubject:graph" INTEGER,
"nmo:receivedDate" INTEGER, "nmo:receivedDate:graph" INTEGER,
"nmo:receivedDate:localDate" INTEGER, "nmo:receivedDate:localTime"
INTEGER, "nmo:replyTo" INTEGER, "nmo:replyTo:graph" INTEGER,
"nmo:sender" INTEGER, "nmo:sender:graph" INTEGER, "nmo:conversation"
INTEGER, "nmo:conversation:graph" INTEGER, "nmo:communicationChannel"
INTEGER, "nmo:communicationChannel:graph" INTEGER,
"nmo:deliveryStatus" INTEGER, "nmo:deliveryStatus:graph" INTEGER,
"nmo:reportDelivery" INTEGER, "nmo:reportDelivery:graph" INTEGER,
"nmo:sentWithReportRead" INTEGER, "nmo:sentWithReportRead:graph"
INTEGER, "nmo:reportReadStatus" INTEGER, "nmo:reportReadStatus:graph"
INTEGER, "nmo:mustAnswerReportRead" INTEGER,
"nmo:mustAnswerReportRead:graph" INTEGER, "nmo:mmsId" TEXT COLLATE
NOCASE, "nmo:mmsId:graph" INTEGER);
CREATE TABLE "nmo:MessageHeader" (ID INTEGER NOT NULL PRIMARY KEY,
"nmo:headerName" TEXT COLLATE NOCASE, "nmo:headerName:graph" INTEGER,
"nmo:headerValue" TEXT COLLATE NOCASE, "nmo:headerValue:graph"
INTEGER);
CREATE TABLE "nmo:Message_nmo:bcc" (ID INTEGER NOT NULL, "nmo:bcc"
INTEGER NOT NULL, "nmo:bcc:graph" INTEGER);
CREATE TABLE "nmo:Message_nmo:cc" (ID INTEGER NOT NULL, "nmo:cc"
INTEGER NOT NULL, "nmo:cc:graph" INTEGER);
CREATE TABLE "nmo:Message_nmo:hasAttachment" (ID INTEGER NOT NULL,
"nmo:hasAttachment" INTEGER NOT NULL, "nmo:hasAttachment:graph"
INTEGER);
CREATE TABLE "nmo:Message_nmo:inReplyTo" (ID INTEGER NOT NULL,
"nmo:inReplyTo" INTEGER NOT NULL, "nmo:inReplyTo:graph" INTEGER);
CREATE TABLE "nmo:Message_nmo:messageHeader" (ID INTEGER NOT NULL,
"nmo:messageHeader" INTEGER NOT NULL, "nmo:messageHeader:graph"
INTEGER);
CREATE TABLE "nmo:Message_nmo:recipient" (ID INTEGER NOT NULL,
"nmo:recipient" INTEGER NOT NULL, "nmo:recipient:graph" INTEGER);
CREATE TABLE "nmo:Message_nmo:references" (ID INTEGER NOT NULL,
"nmo:references" INTEGER NOT NULL, "nmo:references:graph" INTEGER);
CREATE TABLE "nmo:Message_nmo:to" (ID INTEGER NOT NULL, "nmo:to"
INTEGER NOT NULL, "nmo:to:graph" INTEGER);
CREATE TABLE "nmo:MimePart" (ID INTEGER NOT NULL PRIMARY KEY,
"nmo:charSet" TEXT COLLATE NOCASE, "nmo:charSet:graph" INTEGER,
"nmo:contentId" TEXT COLLATE NOCASE, "nmo:contentId:graph" INTEGER,
"nmo:contentTransferEncoding" TEXT COLLATE NOCASE,
"nmo:contentTransferEncoding:graph" INTEGER, "nmo:contentDescription"
TEXT COLLATE NOCASE, "nmo:contentDescription:graph" INTEGER,
"nmo:contentDisposition" TEXT COLLATE NOCASE,
"nmo:contentDisposition:graph" INTEGER);
CREATE TABLE "nmo:MimePart_nmo:mimeHeader" (ID INTEGER NOT NULL,
"nmo:mimeHeader" INTEGER NOT NULL, "nmo:mimeHeader:graph" INTEGER);
CREATE TABLE "nmo:Multipart" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nmo:Multipart_nmo:partBoundary" (ID INTEGER NOT NULL,
"nmo:partBoundary" TEXT NOT NULL, "nmo:partBoundary:graph" INTEGER);
CREATE TABLE "nmo:PermanentChannel" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nmo:PhoneMessage" (ID INTEGER NOT NULL PRIMARY KEY,
"nmo:fromVCard" INTEGER, "nmo:fromVCard:graph" INTEGER, "nmo:encoding"
TEXT COLLATE NOCASE, "nmo:encoding:graph" INTEGER,
"nmo:phoneMessageId" INTEGER, "nmo:phoneMessageId:graph" INTEGER,
"nmo:validityPeriod" INTEGER, "nmo:validityPeriod:graph" INTEGER);
CREATE TABLE "nmo:PhoneMessageFolder" (ID INTEGER NOT NULL PRIMARY
KEY, "nmo:phoneMessageFolderId" TEXT COLLATE NOCASE,
"nmo:phoneMessageFolderId:graph" INTEGER);
CREATE TABLE "nmo:PhoneMessageFolder_nmo:containsPhoneMessage" (ID
INTEGER NOT NULL, "nmo:containsPhoneMessage" INTEGER NOT NULL,
"nmo:containsPhoneMessage:graph" INTEGER);
CREATE TABLE "nmo:PhoneMessageFolder_nmo:containsPhoneMessageFolder"
(ID INTEGER NOT NULL, "nmo:containsPhoneMessageFolder" INTEGER NOT
NULL, "nmo:containsPhoneMessageFolder:graph" INTEGER);
CREATE TABLE "nmo:PhoneMessage_nmo:toVCard" (ID INTEGER NOT NULL,
"nmo:toVCard" INTEGER NOT NULL, "nmo:toVCard:graph" INTEGER);
CREATE TABLE "nmo:ReportReadStatus" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nmo:SMSMessage" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nmo:TransientChannel" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nmo:VOIPCall" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "nrl:InverseFunctionalProperty" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "osinfo:Installer" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "poi:ObjectOfInterest" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "rdf:Property" (ID INTEGER NOT NULL PRIMARY KEY,
"rdfs:domain" INTEGER, "rdfs:domain:graph" INTEGER, "rdfs:range"
INTEGER, "rdfs:range:graph" INTEGER, "tracker:indexed" INTEGER,
"tracker:indexed:graph" INTEGER, "tracker:secondaryIndex" INTEGER,
"tracker:secondaryIndex:graph" INTEGER, "tracker:fulltextIndexed"
INTEGER, "tracker:fulltextIndexed:graph" INTEGER,
"tracker:fulltextNoLimit" INTEGER, "tracker:fulltextNoLimit:graph"
INTEGER, "tracker:transient" INTEGER, "tracker:transient:graph"
INTEGER, "tracker:weight" INTEGER, "tracker:weight:graph" INTEGER,
"tracker:defaultValue" TEXT COLLATE NOCASE,
"tracker:defaultValue:graph" INTEGER, "nrl:maxCardinality" INTEGER,
"nrl:maxCardinality:graph" INTEGER, "tracker:writeback" INTEGER,
"tracker:writeback:graph" INTEGER, "tracker:forceJournal" INTEGER,
"tracker:forceJournal:graph" INTEGER);
CREATE TABLE "rdf:Property_rdfs:subPropertyOf" (ID INTEGER NOT NULL,
"rdfs:subPropertyOf" INTEGER NOT NULL, "rdfs:subPropertyOf:graph"
INTEGER);
CREATE TABLE "rdfs:Class" (ID INTEGER NOT NULL PRIMARY KEY,
"tracker:notify" INTEGER, "tracker:notify:graph" INTEGER);
CREATE TABLE "rdfs:Class_rdfs:subClassOf" (ID INTEGER NOT NULL,
"rdfs:subClassOf" INTEGER NOT NULL, "rdfs:subClassOf:graph" INTEGER);
CREATE TABLE "rdfs:Class_tracker:domainIndex" (ID INTEGER NOT NULL,
"tracker:domainIndex" INTEGER NOT NULL, "tracker:domainIndex:graph"
INTEGER);
CREATE TABLE "rdfs:Literal" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "rdfs:Resource" (ID INTEGER NOT NULL PRIMARY KEY,
Available INTEGER NOT NULL, "rdfs:comment" TEXT COLLATE NOCASE,
"rdfs:comment:graph" INTEGER, "rdfs:label" TEXT COLLATE NOCASE,
"rdfs:label:graph" INTEGER, "tracker:added" INTEGER,
"tracker:added:graph" INTEGER, "tracker:added:localDate" INTEGER,
"tracker:added:localTime" INTEGER, "tracker:modified" INTEGER,
"tracker:modified:graph" INTEGER, "tracker:damaged" INTEGER,
"tracker:damaged:graph" INTEGER, "dc:title" TEXT COLLATE NOCASE,
"dc:title:graph" INTEGER, "dc:creator" TEXT COLLATE NOCASE,
"dc:creator:graph" INTEGER, "dc:subject" TEXT COLLATE NOCASE,
"dc:subject:graph" INTEGER, "dc:description" TEXT COLLATE NOCASE,
"dc:description:graph" INTEGER, "dc:publisher" TEXT COLLATE NOCASE,
"dc:publisher:graph" INTEGER, "dc:type" TEXT COLLATE NOCASE,
"dc:type:graph" INTEGER, "dc:format" TEXT COLLATE NOCASE,
"dc:format:graph" INTEGER, "dc:identifier" TEXT COLLATE NOCASE,
"dc:identifier:graph" INTEGER, "dc:language" TEXT COLLATE NOCASE,
"dc:language:graph" INTEGER, "dc:coverage" TEXT COLLATE NOCASE,
"dc:coverage:graph" INTEGER, "dc:rights" TEXT COLLATE NOCASE,
"dc:rights:graph" INTEGER, "nao:identifier" TEXT COLLATE NOCASE,
"nao:identifier:graph" INTEGER, "nao:numericRating" REAL,
"nao:numericRating:graph" INTEGER, "nao:lastModified" INTEGER,
"nao:lastModified:graph" INTEGER, "nao:lastModified:localDate"
INTEGER, "nao:lastModified:localTime" INTEGER);
CREATE TABLE "rdfs:Resource_dc:contributor" (ID INTEGER NOT NULL,
"dc:contributor" TEXT NOT NULL, "dc:contributor:graph" INTEGER);
CREATE TABLE "rdfs:Resource_dc:date" (ID INTEGER NOT NULL, "dc:date"
INTEGER NOT NULL, "dc:date:graph" INTEGER, "dc:date:localDate" INTEGER
NOT NULL, "dc:date:localTime" INTEGER NOT NULL);
CREATE TABLE "rdfs:Resource_dc:relation" (ID INTEGER NOT NULL,
"dc:relation" TEXT NOT NULL, "dc:relation:graph" INTEGER);
CREATE TABLE "rdfs:Resource_dc:source" (ID INTEGER NOT NULL,
"dc:source" INTEGER NOT NULL, "dc:source:graph" INTEGER);
CREATE TABLE "rdfs:Resource_nao:deprecated" (ID INTEGER NOT NULL,
"nao:deprecated" INTEGER NOT NULL, "nao:deprecated:graph" INTEGER);
CREATE TABLE "rdfs:Resource_nao:hasTag" (ID INTEGER NOT NULL,
"nao:hasTag" INTEGER NOT NULL, "nao:hasTag:graph" INTEGER);
CREATE TABLE "rdfs:Resource_nao:isRelated" (ID INTEGER NOT NULL,
"nao:isRelated" INTEGER NOT NULL, "nao:isRelated:graph" INTEGER);
CREATE TABLE "rdfs:Resource_rdf:type" (ID INTEGER NOT NULL, "rdf:type"
INTEGER NOT NULL, "rdf:type:graph" INTEGER);
CREATE TABLE "scal:AccessLevel" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "scal:AttendanceStatus" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "scal:Attendee" (ID INTEGER NOT NULL PRIMARY KEY,
"scal:attendanceStatus" INTEGER, "scal:attendanceStatus:graph"
INTEGER, "scal:attendeeRole" INTEGER, "scal:attendeeRole:graph"
INTEGER, "scal:attendeeContact" INTEGER, "scal:attendeeContact:graph"
INTEGER, "scal:rsvp" INTEGER, "scal:rsvp:graph" INTEGER,
"scal:calendarUserType" INTEGER, "scal:calendarUserType:graph"
INTEGER);
CREATE TABLE "scal:AttendeeRole" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "scal:Attendee_scal:delegated-from" (ID INTEGER NOT NULL,
"scal:delegated-from" INTEGER NOT NULL, "scal:delegated-from:graph"
INTEGER);
CREATE TABLE "scal:Attendee_scal:delegated-to" (ID INTEGER NOT NULL,
"scal:delegated-to" INTEGER NOT NULL, "scal:delegated-to:graph"
INTEGER);
CREATE TABLE "scal:Attendee_scal:member" (ID INTEGER NOT NULL,
"scal:member" INTEGER NOT NULL, "scal:member:graph" INTEGER);
CREATE TABLE "scal:Attendee_scal:sent-by" (ID INTEGER NOT NULL,
"scal:sent-by" INTEGER NOT NULL, "scal:sent-by:graph" INTEGER);
CREATE TABLE "scal:Calendar" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "scal:CalendarAlarm" (ID INTEGER NOT NULL PRIMARY KEY,
"scal:alarmOffset" INTEGER, "scal:alarmOffset:graph" INTEGER);
CREATE TABLE "scal:CalendarAlarm_scal:alarmAttendee" (ID INTEGER NOT
NULL, "scal:alarmAttendee" INTEGER NOT NULL,
"scal:alarmAttendee:graph" INTEGER);
CREATE TABLE "scal:CalendarItem" (ID INTEGER NOT NULL PRIMARY KEY,
"scal:textLocation" INTEGER, "scal:textLocation:graph" INTEGER,
"scal:resources" TEXT COLLATE NOCASE, "scal:resources:graph" INTEGER,
"scal:transparency" INTEGER, "scal:transparency:graph" INTEGER,
"scal:calendarItemAlarm" INTEGER, "scal:calendarItemAlarm:graph"
INTEGER, "scal:start" INTEGER, "scal:start:graph" INTEGER, "scal:end"
INTEGER, "scal:end:graph" INTEGER, "scal:isAllDay" INTEGER,
"scal:isAllDay:graph" INTEGER, "scal:priority" INTEGER,
"scal:priority:graph" INTEGER, "scal:rdate" INTEGER,
"scal:rdate:graph" INTEGER, "scal:exceptionRDate" INTEGER,
"scal:exceptionRDate:graph" INTEGER);
CREATE TABLE "scal:CalendarItem_scal:access" (ID INTEGER NOT NULL,
"scal:access" INTEGER NOT NULL, "scal:access:graph" INTEGER);
CREATE TABLE "scal:CalendarItem_scal:attachment" (ID INTEGER NOT NULL,
"scal:attachment" INTEGER NOT NULL, "scal:attachment:graph" INTEGER);
CREATE TABLE "scal:CalendarItem_scal:attendee" (ID INTEGER NOT NULL,
"scal:attendee" INTEGER NOT NULL, "scal:attendee:graph" INTEGER);
CREATE TABLE "scal:CalendarItem_scal:belongsToCalendar" (ID INTEGER
NOT NULL, "scal:belongsToCalendar" INTEGER NOT NULL,
"scal:belongsToCalendar:graph" INTEGER);
CREATE TABLE "scal:CalendarItem_scal:contact" (ID INTEGER NOT NULL,
"scal:contact" INTEGER NOT NULL, "scal:contact:graph" INTEGER);
CREATE TABLE "scal:CalendarItem_scal:rrule" (ID INTEGER NOT NULL,
"scal:rrule" INTEGER NOT NULL, "scal:rrule:graph" INTEGER);
CREATE TABLE "scal:CalendarUserType" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "scal:Event" (ID INTEGER NOT NULL PRIMARY KEY,
"scal:eventStatus" INTEGER, "scal:eventStatus:graph" INTEGER);
CREATE TABLE "scal:EventStatus" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "scal:Journal" (ID INTEGER NOT NULL PRIMARY KEY,
"scal:journalStatus" INTEGER, "scal:journalStatus:graph" INTEGER);
CREATE TABLE "scal:JournalStatus" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "scal:RSVPValues" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "scal:RecurrenceRule" (ID INTEGER NOT NULL PRIMARY KEY,
"scal:recurrencePattern" TEXT COLLATE NOCASE,
"scal:recurrencePattern:graph" INTEGER, "scal:recurrenceStartDate"
INTEGER, "scal:recurrenceStartDate:graph" INTEGER, "scal:exception"
INTEGER, "scal:exception:graph" INTEGER);
CREATE TABLE "scal:TimePoint" (ID INTEGER NOT NULL PRIMARY KEY,
"scal:dateTime" INTEGER, "scal:dateTime:graph" INTEGER,
"scal:dateTime:localDate" INTEGER, "scal:dateTime:localTime" INTEGER,
"scal:TimeZone" TEXT COLLATE NOCASE, "scal:TimeZone:graph" INTEGER);
CREATE TABLE "scal:Todo" (ID INTEGER NOT NULL PRIMARY KEY,
"scal:todoStatus" INTEGER, "scal:todoStatus:graph" INTEGER, "scal:due"
INTEGER, "scal:due:graph" INTEGER, "scal:completed" INTEGER,
"scal:completed:graph" INTEGER, "scal:percentComplete" INTEGER,
"scal:percentComplete:graph" INTEGER);
CREATE TABLE "scal:TodoStatus" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "scal:TransparencyValues" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "slo:GeoLocation" (ID INTEGER NOT NULL PRIMARY KEY,
"slo:latitude" REAL, "slo:latitude:graph" INTEGER, "slo:longitude"
REAL, "slo:longitude:graph" INTEGER, "slo:verticalAccuracy" REAL,
"slo:verticalAccuracy:graph" INTEGER, "slo:horizontalAccuracy" REAL,
"slo:horizontalAccuracy:graph" INTEGER, "slo:altitude" REAL,
"slo:altitude:graph" INTEGER, "slo:boundingLatitudeMin" REAL,
"slo:boundingLatitudeMin:graph" INTEGER, "slo:boundingLatitudeMax"
REAL, "slo:boundingLatitudeMax:graph" INTEGER,
"slo:boundingLongitudeMin" REAL, "slo:boundingLongitudeMin:graph"
INTEGER, "slo:boundingLongitudeMax" REAL,
"slo:boundingLongitudeMax:graph" INTEGER, "slo:radius" REAL,
"slo:radius:graph" INTEGER, "slo:timestamp" INTEGER,
"slo:timestamp:graph" INTEGER, "slo:timestamp:localDate" INTEGER,
"slo:timestamp:localTime" INTEGER, "slo:postalAddress" INTEGER,
"slo:postalAddress:graph" INTEGER);
CREATE TABLE "slo:Landmark" (ID INTEGER NOT NULL PRIMARY KEY,
"slo:iconUrl" INTEGER, "slo:iconUrl:graph" INTEGER);
CREATE TABLE "slo:LandmarkCategory" (ID INTEGER NOT NULL PRIMARY KEY,
"slo:isRemovable" INTEGER, "slo:isRemovable:graph" INTEGER,
"slo:categoryIconUrl" INTEGER, "slo:categoryIconUrl:graph" INTEGER);
CREATE TABLE "slo:Landmark_slo:belongsToCategory" (ID INTEGER NOT
NULL, "slo:belongsToCategory" INTEGER NOT NULL,
"slo:belongsToCategory:graph" INTEGER);
CREATE TABLE "slo:Landmark_slo:hasContact" (ID INTEGER NOT NULL,
"slo:hasContact" INTEGER NOT NULL, "slo:hasContact:graph" INTEGER);
CREATE TABLE "slo:Route" (ID INTEGER NOT NULL PRIMARY KEY,
"slo:startTime" INTEGER, "slo:startTime:graph" INTEGER,
"slo:startTime:localDate" INTEGER, "slo:startTime:localTime" INTEGER,
"slo:endTime" INTEGER, "slo:endTime:graph" INTEGER,
"slo:endTime:localDate" INTEGER, "slo:endTime:localTime" INTEGER);
CREATE TABLE "slo:Route_slo:routeDetails" (ID INTEGER NOT NULL,
"slo:routeDetails" TEXT NOT NULL, "slo:routeDetails:graph" INTEGER);
CREATE TABLE "tracker:Namespace" (ID INTEGER NOT NULL PRIMARY KEY,
"tracker:prefix" TEXT COLLATE NOCASE, "tracker:prefix:graph"
INTEGER);
CREATE TABLE "tracker:Ontology" (ID INTEGER NOT NULL PRIMARY KEY);
CREATE TABLE "tracker:Volume" (ID INTEGER NOT NULL PRIMARY KEY,
"tracker:isMounted" INTEGER, "tracker:isMounted:graph" INTEGER,
"tracker:unmountDate" INTEGER, "tracker:unmountDate:graph" INTEGER,
"tracker:unmountDate:localDate" INTEGER,
"tracker:unmountDate:localTime" INTEGER, "tracker:mountPoint" INTEGER,
"tracker:mountPoint:graph" INTEGER, "tracker:isRemovable" INTEGER,
"tracker:isRemovable:graph" INTEGER, "tracker:isOptical" INTEGER,
"tracker:isOptical:graph" INTEGER);
CREATE UNIQUE INDEX "mfo:FeedMessage_mfo:enclosureList_ID_ID" ON
"mfo:FeedMessage_mfo:enclosureList" (ID, "mfo:enclosureList");
CREATE UNIQUE INDEX "mlo:GeoBoundingBox_mlo:bbNorthWest_ID_ID" ON
"mlo:GeoBoundingBox_mlo:bbNorthWest" (ID, "mlo:bbNorthWest");
CREATE UNIQUE INDEX "mlo:GeoBoundingBox_mlo:bbSouthEast_ID_ID" ON
"mlo:GeoBoundingBox_mlo:bbSouthEast" (ID, "mlo:bbSouthEast");
CREATE INDEX "mlo:GeoLocation_mlo:asBoundingBox_ID" ON
"mlo:GeoLocation_mlo:asBoundingBox" (ID);
CREATE UNIQUE INDEX "mlo:GeoLocation_mlo:asBoundingBox_ID_ID" ON
"mlo:GeoLocation_mlo:asBoundingBox" ("mlo:asBoundingBox", ID);
CREATE INDEX "mlo:GeoLocation_mlo:asGeoPoint_ID" ON
"mlo:GeoLocation_mlo:asGeoPoint" (ID);
CREATE UNIQUE INDEX "mlo:GeoLocation_mlo:asGeoPoint_ID_ID" ON
"mlo:GeoLocation_mlo:asGeoPoint" ("mlo:asGeoPoint", ID);
CREATE INDEX "mlo:GeoLocation_mlo:asPostalAddress_ID" ON
"mlo:GeoLocation_mlo:asPostalAddress" (ID);
CREATE UNIQUE INDEX "mlo:GeoLocation_mlo:asPostalAddress_ID_ID" ON
"mlo:GeoLocation_mlo:asPostalAddress" ("mlo:asPostalAddress", ID);
CREATE UNIQUE INDEX "mlo:GeoPoint_mlo:address_ID_ID" ON
"mlo:GeoPoint_mlo:address" (ID, "mlo:address");
CREATE UNIQUE INDEX "mlo:GeoPoint_mlo:altitude_ID_ID" ON
"mlo:GeoPoint_mlo:altitude" (ID, "mlo:altitude");
CREATE UNIQUE INDEX "mlo:GeoPoint_mlo:city_ID_ID" ON
"mlo:GeoPoint_mlo:city" (ID, "mlo:city");
CREATE UNIQUE INDEX "mlo:GeoPoint_mlo:country_ID_ID" ON
"mlo:GeoPoint_mlo:country" (ID, "mlo:country");
CREATE UNIQUE INDEX "mlo:GeoPoint_mlo:latitude_ID_ID" ON
"mlo:GeoPoint_mlo:latitude" (ID, "mlo:latitude");
CREATE UNIQUE INDEX "mlo:GeoPoint_mlo:longitude_ID_ID" ON
"mlo:GeoPoint_mlo:longitude" (ID, "mlo:longitude");
CREATE UNIQUE INDEX "mlo:GeoPoint_mlo:state_ID_ID" ON
"mlo:GeoPoint_mlo:state" (ID, "mlo:state");
CREATE UNIQUE INDEX "mlo:GeoPoint_mlo:timestamp_ID_ID" ON
"mlo:GeoPoint_mlo:timestamp" (ID, "mlo:timestamp");
CREATE UNIQUE INDEX "mlo:GeoSphere_mlo:radius_ID_ID" ON
"mlo:GeoSphere_mlo:radius" (ID, "mlo:radius");
CREATE UNIQUE INDEX "mlo:LandmarkCategory_mlo:isRemovable_ID_ID" ON
"mlo:LandmarkCategory_mlo:isRemovable" (ID, "mlo:isRemovable");
CREATE UNIQUE INDEX "mlo:Landmark_mlo:belongsToCategory_ID_ID" ON
"mlo:Landmark_mlo:belongsToCategory" (ID, "mlo:belongsToCategory");
CREATE UNIQUE INDEX "mlo:Landmark_mlo:poiLocation_ID_ID" ON
"mlo:Landmark_mlo:poiLocation" (ID, "mlo:poiLocation");
CREATE UNIQUE INDEX "mlo:LocationBoundingBox_mlo:boxEastLimit_ID_ID"
ON "mlo:LocationBoundingBox_mlo:boxEastLimit" (ID,
"mlo:boxEastLimit");
CREATE UNIQUE INDEX "mlo:LocationBoundingBox_mlo:boxNorthLimit_ID_ID"
ON "mlo:LocationBoundingBox_mlo:boxNorthLimit" (ID,
"mlo:boxNorthLimit");
CREATE UNIQUE INDEX
"mlo:LocationBoundingBox_mlo:boxSouthWestCorner_ID_ID" ON
"mlo:LocationBoundingBox_mlo:boxSouthWestCorner" (ID,
"mlo:boxSouthWestCorner");
CREATE UNIQUE INDEX
"mlo:LocationBoundingBox_mlo:boxVerticalLimit_ID_ID" ON
"mlo:LocationBoundingBox_mlo:boxVerticalLimit" (ID,
"mlo:boxVerticalLimit");
CREATE UNIQUE INDEX "mlo:Route_mlo:endTime_ID_ID" ON
"mlo:Route_mlo:endTime" (ID, "mlo:endTime");
CREATE UNIQUE INDEX "mlo:Route_mlo:routeDetails_ID_ID" ON
"mlo:Route_mlo:routeDetails" (ID, "mlo:routeDetails");
CREATE UNIQUE INDEX "mlo:Route_mlo:startTime_ID_ID" ON
"mlo:Route_mlo:startTime" (ID, "mlo:startTime");
CREATE UNIQUE INDEX "mto:Transfer_mto:transferList_ID_ID" ON
"mto:Transfer_mto:transferList" (ID, "mto:transferList");
CREATE UNIQUE INDEX "mto:Transfer_mto:transferPrivacyLevel_ID_ID" ON
"mto:Transfer_mto:transferPrivacyLevel" (ID,
"mto:transferPrivacyLevel");
CREATE UNIQUE INDEX "mto:UploadTransfer_mto:transferCategory_ID_ID" ON
"mto:UploadTransfer_mto:transferCategory" (ID,
"mto:transferCategory");
CREATE UNIQUE INDEX "nao:Tag_tracker:isDefaultTag_ID_ID" ON
"nao:Tag_tracker:isDefaultTag" (ID, "tracker:isDefaultTag");
CREATE UNIQUE INDEX "nao:Tag_tracker:tagRelatedTo_ID_ID" ON
"nao:Tag_tracker:tagRelatedTo" (ID, "tracker:tagRelatedTo");
CREATE UNIQUE INDEX "ncal:Alarm_ncal:action_ID_ID" ON
"ncal:Alarm_ncal:action" (ID, "ncal:action");
CREATE UNIQUE INDEX "ncal:BydayRulePart_ncal:bydayModifier_ID_ID" ON
"ncal:BydayRulePart_ncal:bydayModifier" (ID, "ncal:bydayModifier");
CREATE UNIQUE INDEX "ncal:BydayRulePart_ncal:bydayWeekday_ID_ID" ON
"ncal:BydayRulePart_ncal:bydayWeekday" (ID, "ncal:bydayWeekday");
CREATE UNIQUE INDEX "ncal:Calendar_ncal:component_ID_ID" ON
"ncal:Calendar_ncal:component" (ID, "ncal:component");
CREATE UNIQUE INDEX "ncal:Freebusy_ncal:freebusy_ID_ID" ON
"ncal:Freebusy_ncal:freebusy" (ID, "ncal:freebusy");
CREATE UNIQUE INDEX "ncal:RecurrenceRule_ncal:byday_ID_ID" ON
"ncal:RecurrenceRule_ncal:byday" (ID, "ncal:byday");
CREATE UNIQUE INDEX "ncal:RecurrenceRule_ncal:byhour_ID_ID" ON
"ncal:RecurrenceRule_ncal:byhour" (ID, "ncal:byhour");
CREATE UNIQUE INDEX "ncal:RecurrenceRule_ncal:byminute_ID_ID" ON
"ncal:RecurrenceRule_ncal:byminute" (ID, "ncal:byminute");
CREATE UNIQUE INDEX "ncal:RecurrenceRule_ncal:bymonth_ID_ID" ON
"ncal:RecurrenceRule_ncal:bymonth" (ID, "ncal:bymonth");
CREATE UNIQUE INDEX "ncal:RecurrenceRule_ncal:bymonthday_ID_ID" ON
"ncal:RecurrenceRule_ncal:bymonthday" (ID, "ncal:bymonthday");
CREATE UNIQUE INDEX "ncal:RecurrenceRule_ncal:bysecond_ID_ID" ON
"ncal:RecurrenceRule_ncal:bysecond" (ID, "ncal:bysecond");
CREATE UNIQUE INDEX "ncal:RecurrenceRule_ncal:bysetpos_ID_ID" ON
"ncal:RecurrenceRule_ncal:bysetpos" (ID, "ncal:bysetpos");
CREATE UNIQUE INDEX "ncal:RecurrenceRule_ncal:byweekno_ID_ID" ON
"ncal:RecurrenceRule_ncal:byweekno" (ID, "ncal:byweekno");
CREATE UNIQUE INDEX "ncal:RecurrenceRule_ncal:byyearday_ID_ID" ON
"ncal:RecurrenceRule_ncal:byyearday" (ID, "ncal:byyearday");
CREATE UNIQUE INDEX "ncal:UnionParentClass_ncal:attach_ID_ID" ON
"ncal:UnionParentClass_ncal:attach" (ID, "ncal:attach");
CREATE UNIQUE INDEX "ncal:UnionParentClass_ncal:attendee_ID_ID" ON
"ncal:UnionParentClass_ncal:attendee" (ID, "ncal:attendee");
CREATE UNIQUE INDEX "ncal:UnionParentClass_ncal:categories_ID_ID" ON
"ncal:UnionParentClass_ncal:categories" (ID, "ncal:categories");
CREATE UNIQUE INDEX "ncal:UnionParentClass_ncal:exdate_ID_ID" ON
"ncal:UnionParentClass_ncal:exdate" (ID, "ncal:exdate");
CREATE UNIQUE INDEX "ncal:UnionParentClass_ncal:exrule_ID_ID" ON
"ncal:UnionParentClass_ncal:exrule" (ID, "ncal:exrule");
CREATE UNIQUE INDEX "ncal:UnionParentClass_ncal:hasAlarm_ID_ID" ON
"ncal:UnionParentClass_ncal:hasAlarm" (ID, "ncal:hasAlarm");
CREATE UNIQUE INDEX "ncal:UnionParentClass_ncal:ncalRelation_ID_ID" ON
"ncal:UnionParentClass_ncal:ncalRelation" (ID, "ncal:ncalRelation");
CREATE UNIQUE INDEX "ncal:UnionParentClass_ncal:rdate_ID_ID" ON
"ncal:UnionParentClass_ncal:rdate" (ID, "ncal:rdate");
CREATE UNIQUE INDEX "ncal:UnionParentClass_ncal:relatedToChild_ID_ID"
ON "ncal:UnionParentClass_ncal:relatedToChild" (ID,
"ncal:relatedToChild");
CREATE UNIQUE INDEX "ncal:UnionParentClass_ncal:relatedToParent_ID_ID"
ON "ncal:UnionParentClass_ncal:relatedToParent" (ID,
"ncal:relatedToParent");
CREATE UNIQUE INDEX "ncal:UnionParentClass_ncal:resources_ID_ID" ON
"ncal:UnionParentClass_ncal:resources" (ID, "ncal:resources");
CREATE UNIQUE INDEX "ncal:UnionParentClass_ncal:rrule_ID_ID" ON
"ncal:UnionParentClass_ncal:rrule" (ID, "ncal:rrule");
CREATE UNIQUE INDEX "nco:Affiliation_nco:title_ID_ID" ON
"nco:Affiliation_nco:title" (ID, "nco:title");
CREATE UNIQUE INDEX "nco:ContactList_nco:containsContact_ID_ID" ON
"nco:ContactList_nco:containsContact" (ID, "nco:containsContact");
CREATE UNIQUE INDEX "nco:Contact_ncal:anniversary_ID_ID" ON
"nco:Contact_ncal:anniversary" (ID, "ncal:anniversary");
CREATE UNIQUE INDEX "nco:Contact_ncal:birthday_ID_ID" ON
"nco:Contact_ncal:birthday" (ID, "ncal:birthday");
CREATE UNIQUE INDEX "nco:Contact_nco:belongsToGroup_ID_ID" ON
"nco:Contact_nco:belongsToGroup" (ID, "nco:belongsToGroup");
CREATE UNIQUE INDEX "nco:Contact_nco:note_ID_ID" ON
"nco:Contact_nco:note" (ID, "nco:note");
CREATE UNIQUE INDEX "nco:Contact_scal:anniversary_ID_ID" ON
"nco:Contact_scal:anniversary" (ID, "scal:anniversary");
CREATE UNIQUE INDEX "nco:Contact_scal:birthday_ID_ID" ON
"nco:Contact_scal:birthday" (ID, "scal:birthday");
CREATE UNIQUE INDEX "nco:IMAccount_nco:hasIMContact_ID_ID" ON
"nco:IMAccount_nco:hasIMContact" (ID, "nco:hasIMContact");
CREATE UNIQUE INDEX "nco:IMAddress_nco:imCapability_ID_ID" ON
"nco:IMAddress_nco:imCapability" (ID, "nco:imCapability");
CREATE UNIQUE INDEX "nco:PersonContact_nco:hasAffiliation_ID_ID" ON
"nco:PersonContact_nco:hasAffiliation" (ID, "nco:hasAffiliation");
CREATE INDEX "nco:PersonContact_nco:nameFamily" ON "nco:PersonContact"
("nco:nameFamily");
CREATE INDEX "nco:PhoneNumber_nco:phoneNumber" ON "nco:PhoneNumber"
("nco:phoneNumber");
CREATE UNIQUE INDEX "nco:Role_nco:blogUrl_ID_ID" ON
"nco:Role_nco:blogUrl" (ID, "nco:blogUrl");
CREATE UNIQUE INDEX "nco:Role_nco:foafUrl_ID_ID" ON
"nco:Role_nco:foafUrl" (ID, "nco:foafUrl");
CREATE UNIQUE INDEX "nco:Role_nco:hasContactMedium_ID_ID" ON
"nco:Role_nco:hasContactMedium" (ID, "nco:hasContactMedium");
CREATE INDEX "nco:Role_nco:hasEmailAddress_ID" ON
"nco:Role_nco:hasEmailAddress" (ID);
CREATE UNIQUE INDEX "nco:Role_nco:hasEmailAddress_ID_ID" ON
"nco:Role_nco:hasEmailAddress" ("nco:hasEmailAddress", ID);
CREATE UNIQUE INDEX "nco:Role_nco:hasIMAddress_ID_ID" ON
"nco:Role_nco:hasIMAddress" (ID, "nco:hasIMAddress");
CREATE UNIQUE INDEX "nco:Role_nco:hasPhoneNumber_ID_ID" ON
"nco:Role_nco:hasPhoneNumber" (ID, "nco:hasPhoneNumber");
CREATE INDEX "nco:Role_nco:hasPostalAddress_ID" ON
"nco:Role_nco:hasPostalAddress" (ID);
CREATE UNIQUE INDEX "nco:Role_nco:hasPostalAddress_ID_ID" ON
"nco:Role_nco:hasPostalAddress" ("nco:hasPostalAddress", ID);
CREATE UNIQUE INDEX "nco:Role_nco:url_ID_ID" ON "nco:Role_nco:url"
(ID, "nco:url");
CREATE UNIQUE INDEX "nco:Role_nco:websiteUrl_ID_ID" ON
"nco:Role_nco:websiteUrl" (ID, "nco:websiteUrl");
CREATE UNIQUE INDEX
"nfo:BookmarkFolder_nfo:containsBookmarkFolder_ID_ID" ON
"nfo:BookmarkFolder_nfo:containsBookmarkFolder" (ID,
"nfo:containsBookmarkFolder");
CREATE UNIQUE INDEX "nfo:BookmarkFolder_nfo:containsBookmark_ID_ID" ON
"nfo:BookmarkFolder_nfo:containsBookmark" (ID,
"nfo:containsBookmark");
CREATE INDEX "nfo:FileDataObject_nfo:fileLastModified" ON
"nfo:FileDataObject" ("nfo:fileLastModified");
CREATE UNIQUE INDEX "nfo:Image_nfo:depicts_ID_ID" ON
"nfo:Image_nfo:depicts" (ID, "nfo:depicts");
CREATE UNIQUE INDEX "nfo:Image_nfo:hasRegionOfInterest_ID_ID" ON
"nfo:Image_nfo:hasRegionOfInterest" (ID, "nfo:hasRegionOfInterest");
CREATE UNIQUE INDEX "nfo:MediaList_nfo:hasMediaFileListEntry_ID_ID" ON
"nfo:MediaList_nfo:hasMediaFileListEntry" (ID,
"nfo:hasMediaFileListEntry");
CREATE UNIQUE INDEX "nfo:MediaList_nfo:mediaListEntry_ID_ID" ON
"nfo:MediaList_nfo:mediaListEntry" (ID, "nfo:mediaListEntry");
CREATE UNIQUE INDEX "nfo:Media_mtp:hidden_ID_ID" ON
"nfo:Media_mtp:hidden" (ID, "mtp:hidden");
CREATE UNIQUE INDEX "nfo:Media_nmm:alternativeMedia_ID_ID" ON
"nfo:Media_nmm:alternativeMedia" (ID, "nmm:alternativeMedia");
CREATE INDEX "nfo:Visual_nie:contentCreated" ON "nfo:Visual"
("nie:contentCreated");
CREATE UNIQUE INDEX "nid3:ID3Audio_nid3:leadArtist_ID_ID" ON
"nid3:ID3Audio_nid3:leadArtist" (ID, "nid3:leadArtist");
CREATE UNIQUE INDEX "nie:DataObject_nie:dataSource_ID_ID" ON
"nie:DataObject_nie:dataSource" (ID, "nie:dataSource");
CREATE UNIQUE INDEX "nie:DataObject_nie:isPartOf_ID_ID" ON
"nie:DataObject_nie:isPartOf" (ID, "nie:isPartOf");
CREATE INDEX "nie:DataObject_nie:url" ON "nie:DataObject" ("nie:url");
CREATE INDEX "nie:InformationElement_mlo:location_ID" ON
"nie:InformationElement_mlo:location" (ID);
CREATE UNIQUE INDEX "nie:InformationElement_mlo:location_ID_ID" ON
"nie:InformationElement_mlo:location" ("mlo:location", ID);
CREATE UNIQUE INDEX "nie:InformationElement_nao:hasProperty_ID_ID" ON
"nie:InformationElement_nao:hasProperty" (ID, "nao:hasProperty");
CREATE UNIQUE INDEX "nie:InformationElement_nco:contributor_ID_ID" ON
"nie:InformationElement_nco:contributor" (ID, "nco:contributor");
CREATE UNIQUE INDEX "nie:InformationElement_nco:creator_ID_ID" ON
"nie:InformationElement_nco:creator" (ID, "nco:creator");
CREATE UNIQUE INDEX "nie:InformationElement_nie:hasLogicalPart_ID_ID"
ON "nie:InformationElement_nie:hasLogicalPart" (ID,
"nie:hasLogicalPart");
CREATE UNIQUE INDEX "nie:InformationElement_nie:hasPart_ID_ID" ON
"nie:InformationElement_nie:hasPart" (ID, "nie:hasPart");
CREATE UNIQUE INDEX
"nie:InformationElement_nie:informationElementDate_ID_ID" ON
"nie:InformationElement_nie:informationElementDate" (ID,
"nie:informationElementDate");
CREATE UNIQUE INDEX "nie:InformationElement_nie:isLogicalPartOf_ID_ID"
ON "nie:InformationElement_nie:isLogicalPartOf" (ID,
"nie:isLogicalPartOf");
CREATE UNIQUE INDEX "nie:InformationElement_nie:keyword_ID_ID" ON
"nie:InformationElement_nie:keyword" (ID, "nie:keyword");
CREATE UNIQUE INDEX "nie:InformationElement_nie:relatedTo_ID_ID" ON
"nie:InformationElement_nie:relatedTo" (ID, "nie:relatedTo");
CREATE INDEX "nie:InformationElement_slo:location" ON
"nie:InformationElement" ("slo:location");
CREATE INDEX "nmm:Artist_nmm:artistName" ON "nmm:Artist" ("nmm:artistName");
CREATE INDEX "nmm:MusicAlbum_nie:title" ON "nmm:MusicAlbum" ("nie:title");
CREATE UNIQUE INDEX "nmm:MusicAlbum_nmm:albumArtist_ID_ID" ON
"nmm:MusicAlbum_nmm:albumArtist" (ID, "nmm:albumArtist");
CREATE INDEX "nmm:MusicPiece_nie:title" ON "nmm:MusicPiece" ("nie:title");
CREATE UNIQUE INDEX "nmm:MusicPiece_nmm:lyrics_ID_ID" ON
"nmm:MusicPiece_nmm:lyrics" (ID, "nmm:lyrics");
CREATE INDEX "nmm:MusicPiece_nmm:musicAlbum" ON "nmm:MusicPiece"
("nmm:musicAlbum");
CREATE INDEX "nmm:MusicPiece_nmm:performer" ON "nmm:MusicPiece"
("nmm:performer");
CREATE UNIQUE INDEX "nmm:RadioStation_nmm:carrier_ID_ID" ON
"nmm:RadioStation_nmm:carrier" (ID, "nmm:carrier");
CREATE UNIQUE INDEX "nmm:Video_mtp:scantype_ID_ID" ON
"nmm:Video_mtp:scantype" (ID, "mtp:scantype");
CREATE UNIQUE INDEX "nmm:Video_nmm:director_ID_ID" ON
"nmm:Video_nmm:director" (ID, "nmm:director");
CREATE UNIQUE INDEX "nmm:Video_nmm:leadActor_ID_ID" ON
"nmm:Video_nmm:leadActor" (ID, "nmm:leadActor");
CREATE UNIQUE INDEX "nmm:Video_nmm:subtitle_ID_ID" ON
"nmm:Video_nmm:subtitle" (ID, "nmm:subtitle");
CREATE INDEX "nmo:Call_nmo:sentDate" ON "nmo:Call" ("nmo:sentDate");
CREATE INDEX "nmo:CommunicationChannel_nmo:hasParticipant_ID" ON
"nmo:CommunicationChannel_nmo:hasParticipant" (ID);
CREATE UNIQUE INDEX
"nmo:CommunicationChannel_nmo:hasParticipant_ID_ID" ON
"nmo:CommunicationChannel_nmo:hasParticipant" ("nmo:hasParticipant",
ID);
CREATE INDEX "nmo:CommunicationChannel_nmo:lastMessageDate" ON
"nmo:CommunicationChannel" ("nmo:lastMessageDate");
CREATE UNIQUE INDEX "nmo:Email_nmo:contentMimeType_ID_ID" ON
"nmo:Email_nmo:contentMimeType" (ID, "nmo:contentMimeType");
CREATE UNIQUE INDEX "nmo:Message_nmo:bcc_ID_ID" ON
"nmo:Message_nmo:bcc" (ID, "nmo:bcc");
CREATE UNIQUE INDEX "nmo:Message_nmo:cc_ID_ID" ON "nmo:Message_nmo:cc"
(ID, "nmo:cc");
CREATE INDEX "nmo:Message_nmo:communicationChannel" ON "nmo:Message"
("nmo:communicationChannel", "nmo:receivedDate");
CREATE INDEX "nmo:Message_nmo:conversation" ON "nmo:Message"
("nmo:conversation");
CREATE INDEX "nmo:Message_nmo:from" ON "nmo:Message" ("nmo:from");
CREATE UNIQUE INDEX "nmo:Message_nmo:hasAttachment_ID_ID" ON
"nmo:Message_nmo:hasAttachment" (ID, "nmo:hasAttachment");
CREATE UNIQUE INDEX "nmo:Message_nmo:inReplyTo_ID_ID" ON
"nmo:Message_nmo:inReplyTo" (ID, "nmo:inReplyTo");
CREATE UNIQUE INDEX "nmo:Message_nmo:messageHeader_ID_ID" ON
"nmo:Message_nmo:messageHeader" (ID, "nmo:messageHeader");
CREATE UNIQUE INDEX "nmo:Message_nmo:recipient_ID_ID" ON
"nmo:Message_nmo:recipient" (ID, "nmo:recipient");
CREATE UNIQUE INDEX "nmo:Message_nmo:references_ID_ID" ON
"nmo:Message_nmo:references" (ID, "nmo:references");
CREATE INDEX "nmo:Message_nmo:sender" ON "nmo:Message" ("nmo:sender");
CREATE INDEX "nmo:Message_nmo:sentDate" ON "nmo:Message" ("nmo:sentDate");
CREATE INDEX "nmo:Message_nmo:to_ID" ON "nmo:Message_nmo:to" (ID);
CREATE UNIQUE INDEX "nmo:Message_nmo:to_ID_ID" ON "nmo:Message_nmo:to"
("nmo:to", ID);
CREATE UNIQUE INDEX "nmo:MimePart_nmo:mimeHeader_ID_ID" ON
"nmo:MimePart_nmo:mimeHeader" (ID, "nmo:mimeHeader");
CREATE UNIQUE INDEX "nmo:Multipart_nmo:partBoundary_ID_ID" ON
"nmo:Multipart_nmo:partBoundary" (ID, "nmo:partBoundary");
CREATE UNIQUE INDEX
"nmo:PhoneMessageFolder_nmo:containsPhoneMessageFolder_ID_ID" ON
"nmo:PhoneMessageFolder_nmo:containsPhoneMessageFolder" (ID,
"nmo:containsPhoneMessageFolder");
CREATE UNIQUE INDEX
"nmo:PhoneMessageFolder_nmo:containsPhoneMessage_ID_ID" ON
"nmo:PhoneMessageFolder_nmo:containsPhoneMessage" (ID,
"nmo:containsPhoneMessage");
CREATE UNIQUE INDEX "nmo:PhoneMessage_nmo:toVCard_ID_ID" ON
"nmo:PhoneMessage_nmo:toVCard" (ID, "nmo:toVCard");
CREATE UNIQUE INDEX "rdf:Property_rdfs:subPropertyOf_ID_ID" ON
"rdf:Property_rdfs:subPropertyOf" (ID, "rdfs:subPropertyOf");
CREATE UNIQUE INDEX "rdfs:Class_rdfs:subClassOf_ID_ID" ON
"rdfs:Class_rdfs:subClassOf" (ID, "rdfs:subClassOf");
CREATE UNIQUE INDEX "rdfs:Class_tracker:domainIndex_ID_ID" ON
"rdfs:Class_tracker:domainIndex" (ID, "tracker:domainIndex");
CREATE UNIQUE INDEX "rdfs:Resource_dc:contributor_ID_ID" ON
"rdfs:Resource_dc:contributor" (ID, "dc:contributor");
CREATE UNIQUE INDEX "rdfs:Resource_dc:date_ID_ID" ON
"rdfs:Resource_dc:date" (ID, "dc:date");
CREATE UNIQUE INDEX "rdfs:Resource_dc:relation_ID_ID" ON
"rdfs:Resource_dc:relation" (ID, "dc:relation");
CREATE UNIQUE INDEX "rdfs:Resource_dc:source_ID_ID" ON
"rdfs:Resource_dc:source" (ID, "dc:source");
CREATE UNIQUE INDEX "rdfs:Resource_nao:deprecated_ID_ID" ON
"rdfs:Resource_nao:deprecated" (ID, "nao:deprecated");
CREATE INDEX "rdfs:Resource_nao:hasTag_ID" ON "rdfs:Resource_nao:hasTag" (ID);
CREATE UNIQUE INDEX "rdfs:Resource_nao:hasTag_ID_ID" ON
"rdfs:Resource_nao:hasTag" ("nao:hasTag", ID);
CREATE UNIQUE INDEX "rdfs:Resource_nao:isRelated_ID_ID" ON
"rdfs:Resource_nao:isRelated" (ID, "nao:isRelated");
CREATE UNIQUE INDEX "rdfs:Resource_rdf:type_ID_ID" ON
"rdfs:Resource_rdf:type" (ID, "rdf:type");
CREATE INDEX "rdfs:Resource_tracker:added" ON "rdfs:Resource" ("tracker:added");
CREATE UNIQUE INDEX "scal:Attendee_scal:delegated-from_ID_ID" ON
"scal:Attendee_scal:delegated-from" (ID, "scal:delegated-from");
CREATE UNIQUE INDEX "scal:Attendee_scal:delegated-to_ID_ID" ON
"scal:Attendee_scal:delegated-to" (ID, "scal:delegated-to");
CREATE UNIQUE INDEX "scal:Attendee_scal:member_ID_ID" ON
"scal:Attendee_scal:member" (ID, "scal:member");
CREATE UNIQUE INDEX "scal:Attendee_scal:sent-by_ID_ID" ON
"scal:Attendee_scal:sent-by" (ID, "scal:sent-by");
CREATE UNIQUE INDEX "scal:CalendarAlarm_scal:alarmAttendee_ID_ID" ON
"scal:CalendarAlarm_scal:alarmAttendee" (ID, "scal:alarmAttendee");
CREATE UNIQUE INDEX "scal:CalendarItem_scal:access_ID_ID" ON
"scal:CalendarItem_scal:access" (ID, "scal:access");
CREATE UNIQUE INDEX "scal:CalendarItem_scal:attachment_ID_ID" ON
"scal:CalendarItem_scal:attachment" (ID, "scal:attachment");
CREATE UNIQUE INDEX "scal:CalendarItem_scal:attendee_ID_ID" ON
"scal:CalendarItem_scal:attendee" (ID, "scal:attendee");
CREATE UNIQUE INDEX "scal:CalendarItem_scal:belongsToCalendar_ID_ID"
ON "scal:CalendarItem_scal:belongsToCalendar" (ID,
"scal:belongsToCalendar");
CREATE UNIQUE INDEX "scal:CalendarItem_scal:contact_ID_ID" ON
"scal:CalendarItem_scal:contact" (ID, "scal:contact");
CREATE UNIQUE INDEX "scal:CalendarItem_scal:rrule_ID_ID" ON
"scal:CalendarItem_scal:rrule" (ID, "scal:rrule");
CREATE INDEX "slo:GeoLocation_slo:postalAddress" ON "slo:GeoLocation"
("slo:postalAddress");
CREATE UNIQUE INDEX "slo:Landmark_slo:belongsToCategory_ID_ID" ON
"slo:Landmark_slo:belongsToCategory" (ID, "slo:belongsToCategory");
CREATE UNIQUE INDEX "slo:Landmark_slo:hasContact_ID_ID" ON
"slo:Landmark_slo:hasContact" (ID, "slo:hasContact");
CREATE UNIQUE INDEX "slo:Route_slo:routeDetails_ID_ID" ON
"slo:Route_slo:routeDetails" (ID, "slo:routeDetails");

EXPLAIN SELECT "1_u", (SELECT "nco:fullname" FROM "nco:Contact" WHERE
ID = "1_u") COLLATE NOCASE, (SELECT "nco:nameFamily" FROM
"nco:PersonContact" WHERE ID = "1_u") COLLATE NOCASE, (SELECT
"nco:nameGiven" FROM "nco:PersonContact" WHERE ID = "1_u")
COLLATE NOCASE, (SELECT "nco:nameAdditional" FROM
"nco:PersonContact" WHERE ID = "1_u") COLLATE NOCASE, (SELECT
"nco:nameHonorificPrefix" FROM "nco:PersonContact" WHERE ID =
"1_u") COLLATE NOCASE, (SELECT "nco:nameHonorificSuffix" FROM
"nco:PersonContact" WHERE ID = "1_u") COLLATE NOCASE, (SELECT
"nco:nickname" FROM "nco:Contact" WHERE ID = "1_u") COLLATE
NOCASE, strftime("%s",(SELECT "nco:birthDate" FROM
"nco:Contact" WHERE ID = "1_u")), (SELECT "nie:url" FROM
"nie:DataObject" WHERE ID = (SELECT "nco:photo" FROM
"nco:Contact" WHERE ID = "1_u")) COLLATE NOCASE, (SELECT
GROUP_CONCAT("2_u"||? COLLATE NOCASE||COALESCE((SELECT
"nco:imProtocol" FROM "nco:IMAddress" WHERE ID = "3_u") COLLATE
NOCASE, ? COLLATE NOCASE)||? COLLATE NOCASE||COALESCE((SELECT
"nco:imID" FROM "nco:IMAddress" WHERE ID = "3_u") COLLATE
NOCASE, ? COLLATE NOCASE)||? COLLATE NOCASE||COALESCE((SELECT
"nco:imNickname" FROM "nco:IMAddress" WHERE ID = "3_u") COLLATE
NOCASE, ? COLLATE NOCASE), '\n') FROM (SELECT
"nco:PersonContact_nco:hasAffiliation2"."nco:hasAffiliation" AS
"2_u", "nco:Role_nco:hasIMAddress3"."nco:hasIMAddress" AS
"3_u" FROM "nco:PersonContact_nco:hasAffiliation" AS
"nco:PersonContact_nco:hasAffiliation2",
"nco:Role_nco:hasIMAddress" AS "nco:Role_nco:hasIMAddress3" WHERE
"1_u" = "nco:PersonContact_nco:hasAffiliation2"."ID" AND
"nco:PersonContact_nco:hasAffiliation2"."nco:hasAffiliation" =
"nco:Role_nco:hasIMAddress3"."ID")), (SELECT
GROUP_CONCAT("2_u"||? COLLATE NOCASE||(SELECT "nco:phoneNumber"
FROM "nco:PhoneNumber" WHERE ID = "4_u") COLLATE NOCASE, '\n')
FROM (SELECT "nco:PersonContact_nco:hasAffiliation4"."nco:hasAffiliation"
AS "2_u", "nco:Role_nco:hasPhoneNumber5"."nco:hasPhoneNumber" AS
"4_u" FROM "nco:PersonContact_nco:hasAffiliation" AS
"nco:PersonContact_nco:hasAffiliation4",
"nco:Role_nco:hasPhoneNumber" AS "nco:Role_nco:hasPhoneNumber5"
WHERE "1_u" = "nco:PersonContact_nco:hasAffiliation4"."ID" AND
"nco:PersonContact_nco:hasAffiliation4"."nco:hasAffiliation" =
"nco:Role_nco:hasPhoneNumber5"."ID")), (SELECT
GROUP_CONCAT("2_u"||? COLLATE NOCASE||(SELECT "nco:emailAddress"
FROM "nco:EmailAddress" WHERE ID = "5_u") COLLATE NOCASE, ',')
FROM (SELECT "nco:PersonContact_nco:hasAffiliation6"."nco:hasAffiliation"
AS "2_u", "nco:Role_nco:hasEmailAddress7"."nco:hasEmailAddress"
AS "5_u" FROM "nco:PersonContact_nco:hasAffiliation" AS
"nco:PersonContact_nco:hasAffiliation6",
"nco:Role_nco:hasEmailAddress" AS "nco:Role_nco:hasEmailAddress7"
WHERE "1_u" = "nco:PersonContact_nco:hasAffiliation6"."ID" AND
"nco:PersonContact_nco:hasAffiliation6"."nco:hasAffiliation" =
"nco:Role_nco:hasEmailAddress7"."ID")), (SELECT
GROUP_CONCAT("2_u"||? COLLATE NOCASE||COALESCE((SELECT
GROUP_CONCAT((SELECT Uri FROM Resource WHERE ID =
"nco:blogUrl"),',') FROM "nco:Role_nco:blogUrl" WHERE ID =
"2_u"), ? COLLATE NOCASE)||? COLLATE NOCASE||COALESCE((SELECT
GROUP_CONCAT((SELECT Uri FROM Resource WHERE ID =
"nco:websiteUrl"),',') FROM "nco:Role_nco:websiteUrl" WHERE ID =
"2_u"), ? COLLATE NOCASE)||? COLLATE NOCASE||COALESCE((SELECT
GROUP_CONCAT((SELECT Uri FROM Resource WHERE ID = "nco:url"),',')
FROM "nco:Role_nco:url" WHERE ID = "2_u"), ? COLLATE NOCASE),
'\n') FROM (SELECT
"nco:PersonContact_nco:hasAffiliation8"."nco:hasAffiliation" AS
"2_u" FROM "nco:PersonContact_nco:hasAffiliation" AS
"nco:PersonContact_nco:hasAffiliation8" WHERE "1_u" =
"nco:PersonContact_nco:hasAffiliation8"."ID")), (SELECT
GROUP_CONCAT("6_u", ',') FROM (SELECT
"rdfs:Resource_nao:hasTag9"."nao:hasTag" AS "6_u" FROM
"rdfs:Resource_nao:hasTag" AS "rdfs:Resource_nao:hasTag9" WHERE
"1_u" = "rdfs:Resource_nao:hasTag9"."ID")), (SELECT Uri FROM
Resource WHERE ID = "1_u"), (SELECT GROUP_CONCAT("2_u"||? COLLATE
NOCASE||COALESCE((SELECT "nco:role" FROM "nco:Affiliation" WHERE
ID = "2_u") COLLATE NOCASE, ? COLLATE NOCASE)||? COLLATE
NOCASE||COALESCE((SELECT "nco:department" FROM "nco:Affiliation"
WHERE ID = "2_u") COLLATE NOCASE, ? COLLATE NOCASE)||? COLLATE
NOCASE||COALESCE((SELECT GROUP_CONCAT("nco:title",',') FROM
"nco:Affiliation_nco:title" WHERE ID = "2_u"), ? COLLATE NOCASE),
'\n') FROM (SELECT
"nco:PersonContact_nco:hasAffiliation10"."nco:hasAffiliation" AS
"2_u" FROM "nco:PersonContact_nco:hasAffiliation" AS
"nco:PersonContact_nco:hasAffiliation10" WHERE "1_u" =
"nco:PersonContact_nco:hasAffiliation10"."ID")), (SELECT
GROUP_CONCAT("nco:note",',') FROM "nco:Contact_nco:note" WHERE ID
= "1_u"), (SELECT "nco:gender" FROM "nco:PersonContact" WHERE ID
= "1_u"), (SELECT GROUP_CONCAT("2_u"||? COLLATE
NOCASE||COALESCE((SELECT "nco:pobox" FROM "nco:PostalAddress"
WHERE ID = "7_u") COLLATE NOCASE, ? COLLATE NOCASE)||? COLLATE
NOCASE||COALESCE((SELECT "nco:district" FROM "nco:PostalAddress"
WHERE ID = "7_u") COLLATE NOCASE, ? COLLATE NOCASE)||? COLLATE
NOCASE||COALESCE((SELECT "nco:county" FROM "nco:PostalAddress"
WHERE ID = "7_u") COLLATE NOCASE, ? COLLATE NOCASE)||? COLLATE
NOCASE||COALESCE((SELECT "nco:locality" FROM "nco:PostalAddress"
WHERE ID = "7_u") COLLATE NOCASE, ? COLLATE NOCASE)||? COLLATE
NOCASE||COALESCE((SELECT "nco:postalcode" FROM
"nco:PostalAddress" WHERE ID = "7_u") COLLATE NOCASE, ? COLLATE
NOCASE)||? COLLATE NOCASE||COALESCE((SELECT "nco:streetAddress"
FROM "nco:PostalAddress" WHERE ID = "7_u") COLLATE NOCASE, ?
COLLATE NOCASE)||? COLLATE NOCASE||COALESCE((SELECT Uri FROM
Resource WHERE ID = (SELECT "nco:addressLocation" FROM
"nco:PostalAddress" WHERE ID = "7_u")), ? COLLATE NOCASE)||?
COLLATE NOCASE||COALESCE((SELECT "nco:extendedAddress" FROM
"nco:PostalAddress" WHERE ID = "7_u") COLLATE NOCASE, ? COLLATE
NOCASE)||? COLLATE NOCASE||COALESCE((SELECT "nco:country" FROM
"nco:PostalAddress" WHERE ID = "7_u") COLLATE NOCASE, ? COLLATE
NOCASE)||? COLLATE NOCASE||COALESCE((SELECT "nco:region" FROM
"nco:PostalAddress" WHERE ID = "7_u") COLLATE NOCASE, ? COLLATE
NOCASE), '\n') FROM (SELECT
"nco:PersonContact_nco:hasAffiliation11"."nco:hasAffiliation" AS
"2_u", "nco:Role_nco:hasPostalAddress12"."nco:hasPostalAddress"
AS "7_u" FROM "nco:PersonContact_nco:hasAffiliation" AS
"nco:PersonContact_nco:hasAffiliation11",
"nco:Role_nco:hasPostalAddress" AS
"nco:Role_nco:hasPostalAddress12" WHERE "1_u" =
"nco:PersonContact_nco:hasAffiliation11"."ID" AND
"nco:PersonContact_nco:hasAffiliation11"."nco:hasAffiliation" =
"nco:Role_nco:hasPostalAddress12"."ID")), (SELECT
GROUP_CONCAT("10_u" COLLATE NOCASE, ',') FROM (SELECT
"nie:InformationElement_nao:hasProperty13"."nao:hasProperty" AS
"8_u", "nao:Property14"."nao:propertyName" AS "9_u",
"nao:Property14"."nao:propertyValue" AS "10_u" FROM
"nie:InformationElement_nao:hasProperty" AS
"nie:InformationElement_nao:hasProperty13", "nao:Property" AS
"nao:Property14" WHERE "1_u" =
"nie:InformationElement_nao:hasProperty13"."ID" AND
"nie:InformationElement_nao:hasProperty13"."nao:hasProperty" =
"nao:Property14"."ID" AND "9_u" IS NOT NULL AND "10_u" IS NOT
NULL AND ("9_u" COLLATE NOCASE = ? COLLATE NOCASE))) FROM (SELECT
"nco:PersonContact1"."ID" AS "1_u" FROM "nco:PersonContact" AS
"nco:PersonContact1") ORDER BY "1_u";
  }
} {/.* Goto .*/}


finish_test

Changes to test/shell1.test.

170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
...
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
...
574
575
576
577
578
579
580












581
582
583
584
585
586
587
  list $rc \
       [regexp {Error: missing argument for option: -nullvalue} $res]
} {1 1}

# -version             show SQLite version
do_test shell1-1.16.1 {
  set x [catchcmd "-version test.db" ""]
  regexp {0 \{3.\d.\d+ 20\d\d-[01]\d-\d\d \d\d:\d\d:\d\d [0-9a-f]+\}} $x 
} 1

#----------------------------------------------------------------------------
# Test cases shell1-2.*: Basic "dot" command token parsing.
#

# check first token handling
do_test shell1-2.1.1 {
................................................................................
  # too many arguments
  catchcmd "test.db" ".bail OFF BAD"
} {1 {Error: unknown command or invalid arguments:  "bail". Enter ".help" for help}}

# .databases             List names and files of attached databases
do_test shell1-3.3.1 {
  catchcmd "-csv test.db" ".databases"
} {/0 +.*main +.*test.db.*/}
do_test shell1-3.3.2 {
  # too many arguments
  catchcmd "test.db" ".databases BAD"
} {1 {Error: unknown command or invalid arguments:  "databases". Enter ".help" for help}}

# .dump ?TABLE? ...      Dump the database in an SQL text format
#                          If TABLE specified, only dump tables matching
................................................................................
  catchcmd "test.db" ".schema FOO"
} {0 {}}
do_test shell1-3.21.3 {
  # too many arguments
  catchcmd "test.db" ".schema FOO BAD"
} {1 {Error: unknown command or invalid arguments:  "schema". Enter ".help" for help}}













# .separator STRING      Change separator used by output mode and .import
do_test shell1-3.22.1 {
  catchcmd "test.db" ".separator"
} {1 {Error: unknown command or invalid arguments:  "separator". Enter ".help" for help}}
do_test shell1-3.22.2 {
  catchcmd "test.db" ".separator FOO"
} {0 {}}







|
<







 







|







 







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







170
171
172
173
174
175
176
177

178
179
180
181
182
183
184
...
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
...
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
  list $rc \
       [regexp {Error: missing argument for option: -nullvalue} $res]
} {1 1}

# -version             show SQLite version
do_test shell1-1.16.1 {
  set x [catchcmd "-version test.db" ""]
} {/3.[0-9.]+ 20\d\d-[01]\d-\d\d \d\d:\d\d:\d\d [0-9a-f]+/}


#----------------------------------------------------------------------------
# Test cases shell1-2.*: Basic "dot" command token parsing.
#

# check first token handling
do_test shell1-2.1.1 {
................................................................................
  # too many arguments
  catchcmd "test.db" ".bail OFF BAD"
} {1 {Error: unknown command or invalid arguments:  "bail". Enter ".help" for help}}

# .databases             List names and files of attached databases
do_test shell1-3.3.1 {
  catchcmd "-csv test.db" ".databases"
} "/0 +.*main +[string map {/ .} [string range [pwd] 0 10]].*/"
do_test shell1-3.3.2 {
  # too many arguments
  catchcmd "test.db" ".databases BAD"
} {1 {Error: unknown command or invalid arguments:  "databases". Enter ".help" for help}}

# .dump ?TABLE? ...      Dump the database in an SQL text format
#                          If TABLE specified, only dump tables matching
................................................................................
  catchcmd "test.db" ".schema FOO"
} {0 {}}
do_test shell1-3.21.3 {
  # too many arguments
  catchcmd "test.db" ".schema FOO BAD"
} {1 {Error: unknown command or invalid arguments:  "schema". Enter ".help" for help}}

do_test shell1-3.21.4 {
  catchcmd "test.db" {
     CREATE TABLE t1(x);
     CREATE VIEW v2 AS SELECT x+1 AS y FROM t1;
     CREATE VIEW v1 AS SELECT y+1 FROM v2;
  }
  catchcmd "test.db" ".schema"
} {0 {CREATE TABLE t1(x);
CREATE VIEW v2 AS SELECT x+1 AS y FROM t1;
CREATE VIEW v1 AS SELECT y+1 FROM v2;}}
db eval {DROP VIEW v1; DROP VIEW v2; DROP TABLE t1;}

# .separator STRING      Change separator used by output mode and .import
do_test shell1-3.22.1 {
  catchcmd "test.db" ".separator"
} {1 {Error: unknown command or invalid arguments:  "separator". Enter ".help" for help}}
do_test shell1-3.22.2 {
  catchcmd "test.db" ".separator FOO"
} {0 {}}

Changes to test/subquery.test.

372
373
374
375
376
377
378






































379
380
381
382
383
384
385
                  GROUP BY c.x
                 HAVING avg(a.y) > avg(c.y))
      FROM t34 AS a
     GROUP BY a.x
     ORDER BY a.x;
  }
} {106 4.5 0 1 107 4.0 1 0}








































#------------------------------------------------------------------
# These tests - subquery-4.* - use the TCL statement cache to try 
# and expose bugs to do with re-using statements that have been 
# passed to sqlite3_reset().
#







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







372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
                  GROUP BY c.x
                 HAVING avg(a.y) > avg(c.y))
      FROM t34 AS a
     GROUP BY a.x
     ORDER BY a.x;
  }
} {106 4.5 0 1 107 4.0 1 0}

do_test subquery-3.5.1 {
  execsql {
    CREATE TABLE t35a(x); INSERT INTO t35a VALUES(1),(2),(3);
    CREATE TABLE t35b(y); INSERT INTO t35b VALUES(98), (99);
    SELECT max((SELECT avg(y) FROM t35b)) FROM t35a;
  }
} {98.5}
do_test subquery-3.5.2 {
  execsql {
    SELECT max((SELECT count(y) FROM t35b)) FROM t35a;
  }
} {2}
do_test subquery-3.5.3 {
  execsql {
    SELECT max((SELECT count() FROM t35b)) FROM t35a;
  }
} {2}
do_test subquery-3.5.4 {
  catchsql {
    SELECT max((SELECT count(x) FROM t35b)) FROM t35a;
  }
} {1 {misuse of aggregate: count()}}
do_test subquery-3.5.5 {
  catchsql {
    SELECT max((SELECT count(x) FROM t35b)) FROM t35a;
  }
} {1 {misuse of aggregate: count()}}
do_test subquery-3.5.6 {
  catchsql {
    SELECT max((SELECT a FROM (SELECT count(x) AS a FROM t35b))) FROM t35a;
  }
} {1 {misuse of aggregate: count()}}
do_test subquery-3.5.7 {
  execsql {
    SELECT max((SELECT a FROM (SELECT count(y) AS a FROM t35b))) FROM t35a;
  }
} {2}


#------------------------------------------------------------------
# These tests - subquery-4.* - use the TCL statement cache to try 
# and expose bugs to do with re-using statements that have been 
# passed to sqlite3_reset().
#