int main(int argc, char **argv) { ok(1, Class_isDescendent(CLASS_OBJECT,CLASS_FEATUREPAIR)); ok(2,!Class_isDescendent(CLASS_FEATURESET,CLASS_OBJECT)); ok(3, Class_isDescendent(CLASS_ENSROOT,CLASS_GENE)); ok(4,!Class_isDescendent(CLASS_STATEMENTHANDLE,CLASS_GENE)); return 0; }
IDType DBEntryAdaptor_exists(DBEntryAdaptor *dbea, DBEntry *dbe) { char qStr[512]; StatementHandle *sth; ResultRow *row; IDType dbID; if (!dbe || !Class_isDescendent(CLASS_DBENTRY, dbe->objectType)) { fprintf(stderr,"Error: arg must be a DBEntry\n"); exit(1); } // NIY Was dbe->external_db instead of dbe->dbname - are they different? // NIY mysql_quote strings sprintf(qStr, "SELECT x.xref_id " " FROM xref x, external_db xdb" " WHERE x.external_db_id = xdb.external_db_id" " AND x.display_label = '%s' " " AND xdb.db_name = '%s'", DBEntry_getDisplayId(dbe), DBEntry_getDbName(dbe)); sth = dbea->prepare((BaseAdaptor *)dbea,qStr,strlen(qStr)); sth->execute(sth); row = sth->fetchRow(sth); if( row == NULL ) { sth->finish(sth); return 0; } dbID = row->getLongLongAt(row,0); sth->finish(sth); return dbID; }