On Wed, Jan 25, 2012 at 7:53 AM, John Elrick <[email protected]>wrote:
> I started with the place where iGeneration was being changed and found
> nothing out of the ordinary. I started an examination and noticed the
> following. My "huh?" surrounds the question, why is sqlite3SchemaClear
> being called if pBt is assigned?
>
sqlite3SchemaClear is a destructor. The third parameter to
sqlite3BtreeSchema() is a pointer to the destructor. sqlite3SchemaClear()
is not actually called at this point. Rather, a pointer to
sqlite3SchemaClear() is passed into sqlite3BtreeSchema() and
sqlite3BtreeSchema() then makes arrangements to invoke sqlite3SchemaClear()
at some later time, when the Schema object it has just created gets
destroyed.
>
> SQLITE_PRIVATE Schema *sqlite3SchemaGet(sqlite3 *db, Btree *pBt){
> Schema * p;
> if( pBt ){
> p = (Schema *)sqlite3BtreeSchema(pBt, sizeof(Schema),
> sqlite3SchemaClear);
> }else{
> p = (Schema *)sqlite3DbMallocZero(0, sizeof(Schema));
> }
> if( !p ){
> db->mallocFailed = 1;
> }else if ( 0==p->file_format ){
> sqlite3HashInit(&p->tblHash);
> sqlite3HashInit(&p->idxHash);
> sqlite3HashInit(&p->trigHash);
> sqlite3HashInit(&p->fkeyHash);
> p->enc = SQLITE_UTF8;
> }
> return p;
> }
>
--
D. Richard Hipp
[email protected]
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users