/ Changes On Branch rtreeErrMsg
Login

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

Changes In Branch rtreeErrMsg Excluding Merge-Ins

This is equivalent to a diff from dd473cae5b to 652233d646

2013-01-17
17:05
Improved error messages on the RTREE virtual table. Make the "fs" virtual table used for testing available on windows. (check-in: c0b90d75a8 user: drh tags: trunk)
03:18
Enhance RTree virtual table creation error messages that involve the getNodeSize() function. (Closed-Leaf check-in: 652233d646 user: mistachkin tags: rtreeErrMsg)
03:18
Make the 'fs' virtual table module portable to Windows. (Closed-Leaf check-in: dd473cae5b user: mistachkin tags: fsVfsWin)
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: 6195ebd833 user: drh tags: trunk)

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)) ){