/ Check-in [d6a9bff6]
Login

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

Overview
Comment:Fix a comment in build.c.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | reuse-schema
Files: files | file ages | folders
SHA3-256: d6a9bff6f5cc52957deffe47fdba1197db111cac110760dec7680f91499a99f1
User & Date: dan 2019-02-25 19:23:01
Wiki:reuse-schema
Context
2019-02-26
15:43
Add the ".shared-schema check|fix DB1 DB2..." command to the shell tool. For checking if a database is eligible to share an in-memory with the main database, and for fixing small problems that prevent it from being so. check-in: 7d8e8a95 user: dan tags: reuse-schema
2019-02-25
19:23
Fix a comment in build.c. check-in: d6a9bff6 user: dan tags: reuse-schema
18:07
Merge latest trunk changes into this branch. check-in: 5c1cf308 user: dan tags: reuse-schema
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/build.c.

   286    286   }
   287    287   #endif
   288    288   
   289    289   /*
   290    290   ** If this database connection was opened with the SQLITE_OPEN_SHARED_SCHEMA
   291    291   ** flag specified, then ensure that the database schema for database iDb
   292    292   ** is loaded. Either by obtaining a Schema object from the schema-pool, or
   293         -** by reading the contents of the sqlite_master table.
          293  +** by reading the contents of the sqlite_master table. Unless it is NULL, 
          294  +** the location indicated by parameter pbUnload is set to 1 if a shared-schema 
          295  +** is loaded.
   294    296   **
   295    297   ** If the database handle was not opened with SQLITE_OPEN_SHARED_SCHEMA, or
   296    298   ** if the schema for database iDb is already loaded, this function is a no-op.
   297    299   **
   298         -** Non-zero is returned if a schema is loaded, or zero if it was already 
   299         -** loaded when this function was called..
          300  +** SQLITE_OK is returned if successful, or an SQLite error code otherwise. If
          301  +** an error code is returned, (*pzErr) may be set to point to a buffer
          302  +** containing an error message. It is the responsibility of the caller to
          303  +** eventually free this buffer using sqlite3_free().
   300    304   */
   301    305   int sqlite3SchemaLoad(sqlite3 *db, int iDb, int *pbUnload, char **pzErr){
   302    306     int rc = SQLITE_OK;
   303    307     if( IsReuseSchema(db) 
   304    308         && DbHasProperty(db, iDb, DB_SchemaLoaded)==0 
   305    309         && (db->init.busy==0 || (iDb!=1 && db->init.iDb==1))
   306    310     ){
   307    311       struct sqlite3InitInfo sv = db->init;
   308    312       memset(&db->init, 0, sizeof(struct sqlite3InitInfo));
   309    313       rc = sqlite3InitOne(db, iDb, pzErr, 0);
   310    314       db->init = sv;
   311         -    if( pbUnload ) *pbUnload = (rc==SQLITE_OK && (iDb!=1));
          315  +    if( pbUnload && rc==SQLITE_OK && iDb!=1 ) *pbUnload = 1;
   312    316     }
   313    317     return rc;
   314    318   }
   315    319   
   316    320   /*
   317    321   ** Locate the in-memory structure that describes a particular database
   318    322   ** table given the name of that table and (optionally) the name of the