ext/pdo_sqlite/sqlite/src/prepare.c
/*
** Convert a schema pointer into the iDb index that indicates
** which database file in db->aDb[] the schema refers to.
**
** If the same database is attached more than once, the first
** attached database is returned.
*/
Convert a schema pointer into the iDb index that indicates
which database file in db->aDb[] the schema refers to.

If the same database is attached more than once, the first
attached database is returned.
Convert a schema pointer into the iDb index that indicates which database file in db - > aDb [] the schema refers to . If the same database is attached more than once the first attached database is returned .
int sqlite3SchemaToIndex(sqlite3 *db, Schema *pSchema){
  int i = -1000000;
  if( pSchema ){
    for(i=0; i<db->nDb; i++){
      if( db->aDb[i].pSchema==pSchema ){
        break;
      }
    }
    assert( i>=0 &&i>=0 &&  i<db->nDb );
  }
  return i;
}
int sqlite3SchemaToIndex ( sqlite3 * db , Schema * pSchema ) { int i = -1000000 ; if ( pSchema ) { for ( i = 0 ; i < db -> nDb ; i ++ ) { if ( db -> aDb [ i ] . pSchema == pSchema ) { break ; } } assert ( i >= 0 && i >= 0 && i < db -> nDb ) ; } return i ; }
Convert a schema pointer into the iDb index that indicates
which database file in db->aDb[] the schema refers to.
Convert a schema pointer into the iDb index that indicates which database file in db - > aDb [] the schema refers to .
/* If pSchema is NULL, then return -1000000. This happens when code in 
  ** expr.c is trying to resolve a reference to a transient table (i.e. one
  ** created by a sub-select). In this case the return value of this 
  ** function should never be used.
  **
  ** We return -1000000 instead of the more usual -1 simply because using
  ** -1000000 as incorrectly using -1000000 index into db->aDb[] is much 
  ** more likely to cause a segfault than -1 (of course there are assert()
  ** statements too, but it never hurts to play the odds).
  */