本文整理汇总了C++中StatementHandle::numRows方法的典型用法代码示例。如果您正苦于以下问题:C++ StatementHandle::numRows方法的具体用法?C++ StatementHandle::numRows怎么用?C++ StatementHandle::numRows使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StatementHandle
的用法示例。
在下文中一共展示了StatementHandle::numRows方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BaseAdaptor_genericCount
int BaseAdaptor_genericCount(BaseAdaptor *ba, char *constraint) {
char *qStr = NULL;
if ((qStr = (char *)calloc(655500,sizeof(char))) == NULL) {
fprintf(stderr,"Failed allocating qStr\n");
return 0;
}
qStr[0] = '\0';
BaseAdaptor_generateSql(ba, constraint, countCols, qStr);
StatementHandle *sth = ba->prepare(ba,qStr,strlen(qStr));
sth->execute(sth);
if (sth->numRows(sth) != 1) {
fprintf(stderr, "genericCount didn't return a row - bye!\n");
return 0;
}
ResultRow *row = sth->fetchRow(sth);
int count = row->getLongAt(row, 0);
free(qStr);
return count;
}
示例2: sprintf
// Switch to passing two element array to fill in as an argument, so don't have to allocate it
IDType *IntronSupportingEvidenceAdaptor_fetchFlankingExonIds(IntronSupportingEvidenceAdaptor *isea, IntronSupportingEvidence *ise, Transcript *transcript, IDType *flanks) {
char qStr[1024];
sprintf(qStr,"SELECT previous_exon_id, next_exon_id "
"FROM transcript_intron_supporting_evidence "
"WHERE transcript_id ="IDFMTSTR" and intron_supporting_evidence_id ="IDFMTSTR,
Transcript_getDbID(transcript), IntronSupportingEvidence_getDbID(ise));
StatementHandle *sth = isea->prepare((BaseAdaptor *)isea,qStr,strlen(qStr));
sth->execute(sth);
if (sth->numRows(sth) == 0) {
return NULL;
}
ResultRow *row = sth->fetchRow(sth);
flanks[0] = row->getLongLongAt(row, 0);
flanks[1] = row->getLongLongAt(row, 1);
sth->finish(sth);
return flanks;
}
示例3: IntronSupportingEvidenceAdaptor_store
// This method was a mess - tidied and rearranged
IDType IntronSupportingEvidenceAdaptor_store(IntronSupportingEvidenceAdaptor *isea, IntronSupportingEvidence *sf) {
if (sf == NULL) {
fprintf(stderr,"sf is NULL in IntronSupportingEvidenceAdaptor_store\n");
exit(1);
}
Class_assertType(CLASS_INTRONSUPPORTINGEVIDENCE, sf->objectType);
DBAdaptor *db = isea->dba;
AnalysisAdaptor *analysisAdaptor = DBAdaptor_getAnalysisAdaptor(db);
if (IntronSupportingEvidence_isStored(sf, db)) {
fprintf(stderr,"ISE already stored\n");
return IntronSupportingEvidence_getDbID(sf);
}
Analysis *analysis = IntronSupportingEvidence_getAnalysis(sf);
if (!Analysis_isStored(analysis, db)) {
AnalysisAdaptor_store(analysisAdaptor, analysis);
}
IDType analysisId = Analysis_getDbID(analysis);
// Think the above is equivalent to this horror
//my $analysis_id = $analysis->is_stored($db) ? $analysis->dbID() : $db->get_AnalysisAdaptor()->store($analysis);
/* No transfer (see GeneAdaptor for why)
my $seq_region_id;
($sf, $seq_region_id) = $self->_pre_store($sf);
*/
IDType seqRegionId = BaseFeatureAdaptor_preStore((BaseFeatureAdaptor *)isea, (SeqFeature*)sf);
char qStr[1024];
sprintf(qStr, "INSERT IGNORE INTO intron_supporting_evidence "
"(analysis_id, seq_region_id, seq_region_start, seq_region_end, seq_region_strand, hit_name, score, score_type, is_splice_canonical) "
"VALUES ("IDFMTSTR","IDFMTSTR",%ld,%ld,%d,'%s',%f,'%s',%d)",
analysisId,
seqRegionId,
IntronSupportingEvidence_getSeqRegionStart((SeqFeature*)sf),
IntronSupportingEvidence_getSeqRegionEnd((SeqFeature*)sf),
IntronSupportingEvidence_getSeqRegionStrand((SeqFeature*)sf),
IntronSupportingEvidence_getHitName(sf),
IntronSupportingEvidence_getScore(sf),
IntronSupportingEvidence_getScoreType(sf),
IntronSupportingEvidence_getIsSpliceCanonical(sf));
StatementHandle *sth = isea->prepare((BaseAdaptor *)isea,qStr,strlen(qStr));
sth->execute(sth);
IDType sfId = sth->getInsertId(sth);
sth->finish(sth);
if (!sfId) {
sprintf(qStr,"SELECT intron_supporting_evidence_id "
"FROM intron_supporting_evidence "
"WHERE analysis_id = "IDFMTSTR
" AND seq_region_id = "IDFMTSTR
" AND seq_region_start = %ld"
" AND seq_region_end = %ld"
" AND seq_region_strand = %d"
" AND hit_name = '%s'",
analysisId,
seqRegionId,
IntronSupportingEvidence_getSeqRegionStart((SeqFeature*)sf),
IntronSupportingEvidence_getSeqRegionEnd((SeqFeature*)sf),
IntronSupportingEvidence_getSeqRegionStrand((SeqFeature*)sf),
IntronSupportingEvidence_getHitName(sf));
sth = isea->prepare((BaseAdaptor *)isea,qStr,strlen(qStr));
sth->execute(sth);
if (sth->numRows(sth) > 0) {
ResultRow *row = sth->fetchRow(sth);
sfId = row->getLongLongAt(row, 0);
}
sth->finish(sth);
}
IntronSupportingEvidence_setAdaptor((SeqFeature*)sf, (BaseAdaptor*)isea);
IntronSupportingEvidence_setDbID(sf, sfId);
return IntronSupportingEvidence_getDbID(sf);
}