/ Check-in [c0b90d75]
Login

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

Overview
Comment:Improved error messages on the RTREE virtual table. Make the "fs" virtual table used for testing available on windows.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c0b90d75a86b01f7fafec755cbe046c14d725341
User & Date: drh 2013-01-17 17:05:28
Context
2013-01-17
17:20
Enhance the query planner to exploit transitivity of join constraints. check-in: 38852f15 user: drh tags: trunk
17:05
Improved error messages on the RTREE virtual table. Make the "fs" virtual table used for testing available on windows. check-in: c0b90d75 user: drh tags: trunk
03:18
Enhance RTree virtual table creation error messages that involve the getNodeSize() function. Closed-Leaf check-in: 652233d6 user: mistachkin tags: rtreeErrMsg
2013-01-16
20:33
Fix the activate_extensions pragma so that it is a no-op when the required argument is omitted. check-in: 6195ebd8 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Makefile.msc.

   674    674     $(TOP)\src\test_autoext.c \
   675    675     $(TOP)\src\test_async.c \
   676    676     $(TOP)\src\test_backup.c \
   677    677     $(TOP)\src\test_btree.c \
   678    678     $(TOP)\src\test_config.c \
   679    679     $(TOP)\src\test_demovfs.c \
   680    680     $(TOP)\src\test_devsym.c \
          681  +  $(TOP)\src\test_fs.c \
   681    682     $(TOP)\src\test_func.c \
   682    683     $(TOP)\src\test_fuzzer.c \
   683    684     $(TOP)\src\test_hexio.c \
   684    685     $(TOP)\src\test_init.c \
   685    686     $(TOP)\src\test_intarray.c \
   686    687     $(TOP)\src\test_journal.c \
   687    688     $(TOP)\src\test_malloc.c \

Changes to ext/rtree/rtree.c.

  3045   3045   ** This ensures that each node is stored on a single database page. If the 
  3046   3046   ** database page-size is so large that more than RTREE_MAXCELLS entries 
  3047   3047   ** would fit in a single node, use a smaller node-size.
  3048   3048   */
  3049   3049   static int getNodeSize(
  3050   3050     sqlite3 *db,                    /* Database handle */
  3051   3051     Rtree *pRtree,                  /* Rtree handle */
  3052         -  int isCreate                    /* True for xCreate, false for xConnect */
         3052  +  int isCreate,                   /* True for xCreate, false for xConnect */
         3053  +  char **pzErr                    /* OUT: Error message, if any */
  3053   3054   ){
  3054   3055     int rc;
  3055   3056     char *zSql;
  3056   3057     if( isCreate ){
  3057   3058       int iPageSize = 0;
  3058   3059       zSql = sqlite3_mprintf("PRAGMA %Q.page_size", pRtree->zDb);
  3059   3060       rc = getIntFromStmt(db, zSql, &iPageSize);
  3060   3061       if( rc==SQLITE_OK ){
  3061   3062         pRtree->iNodeSize = iPageSize-64;
  3062   3063         if( (4+pRtree->nBytesPerCell*RTREE_MAXCELLS)<pRtree->iNodeSize ){
  3063   3064           pRtree->iNodeSize = 4+pRtree->nBytesPerCell*RTREE_MAXCELLS;
  3064   3065         }
         3066  +    }else{
         3067  +      *pzErr = sqlite3_mprintf("%s", sqlite3_errmsg(db));
  3065   3068       }
  3066   3069     }else{
  3067   3070       zSql = sqlite3_mprintf(
  3068   3071           "SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1",
  3069   3072           pRtree->zDb, pRtree->zName
  3070   3073       );
  3071   3074       rc = getIntFromStmt(db, zSql, &pRtree->iNodeSize);
         3075  +    if( rc!=SQLITE_OK ){
         3076  +      *pzErr = sqlite3_mprintf("%s", sqlite3_errmsg(db));
         3077  +    }
  3072   3078     }
  3073   3079   
  3074   3080     sqlite3_free(zSql);
  3075   3081     return rc;
  3076   3082   }
  3077   3083   
  3078   3084   /* 
................................................................................
  3128   3134     pRtree->nDim = (argc-4)/2;
  3129   3135     pRtree->nBytesPerCell = 8 + pRtree->nDim*4*2;
  3130   3136     pRtree->eCoordType = eCoordType;
  3131   3137     memcpy(pRtree->zDb, argv[1], nDb);
  3132   3138     memcpy(pRtree->zName, argv[2], nName);
  3133   3139   
  3134   3140     /* Figure out the node size to use. */
  3135         -  rc = getNodeSize(db, pRtree, isCreate);
         3141  +  rc = getNodeSize(db, pRtree, isCreate, pzErr);
  3136   3142   
  3137   3143     /* Create/Connect to the underlying relational database schema. If
  3138   3144     ** that is successful, call sqlite3_declare_vtab() to configure
  3139   3145     ** the r-tree table schema.
  3140   3146     */
  3141   3147     if( rc==SQLITE_OK ){
  3142   3148       if( (rc = rtreeSqlInit(pRtree, db, argv[1], argv[2], isCreate)) ){

Changes to src/test_fs.c.

    33     33   #include "sqliteInt.h"
    34     34   #include "tcl.h"
    35     35   
    36     36   #include <stdlib.h>
    37     37   #include <string.h>
    38     38   #include <sys/types.h>
    39     39   #include <sys/stat.h>
    40         -#include <unistd.h>
    41     40   #include <fcntl.h>
           41  +
           42  +#if SQLITE_OS_UNIX
           43  +# include <unistd.h>
           44  +#endif
           45  +#if SQLITE_OS_WIN
           46  +# include <io.h>
           47  +#endif
    42     48   
    43     49   #ifndef SQLITE_OMIT_VIRTUALTABLE
    44     50   
    45     51   typedef struct fs_vtab fs_vtab;
    46     52   typedef struct fs_cursor fs_cursor;
    47     53   
    48     54   /*