bool embeddedResult::fetchLast() { if(!d->driver) return false; if (isForwardOnly()) { // fake this since MySQL can't seek on forward only queries bool success = fetchNext(); // did we move at all? while (fetchNext()) {}; return success; } my_ulonglong numRows; if (d->preparedQuery) { #if MYSQL_VERSION_ID >= 40108 numRows = mysql_stmt_num_rows(d->stmt); #else numRows = 0; #endif } else { numRows = mysql_num_rows(d->result); } if (at() == int(numRows)) return true; if (!numRows) return false; return fetch(numRows - 1); }
bool QMYSQLResult::fetchLast() { if ( isForwardOnly() ) { // fake this since MySQL can't seek on forward only queries bool success = fetchNext(); // did we move at all? while ( fetchNext() ); return success; } my_ulonglong numRows = mysql_num_rows( d->result ); if ( !numRows ) return FALSE; return fetch( numRows - 1 ); }
bool embeddedResult::fetchFirst() { if (at() == 0) return true; if (isForwardOnly()) return (at() == QSql::BeforeFirstRow) ? fetchNext() : false; return fetch(0); }
bool embeddedResult::fetch(int i) { if(!d->driver) return false; if (isForwardOnly()) { // fake a forward seek if (at() < i) { int x = i - at(); while (--x && fetchNext()) {}; return fetchNext(); } else { return false; } } if (at() == i) return true; if (d->preparedQuery) { #if MYSQL_VERSION_ID >= 40108 mysql_stmt_data_seek(d->stmt, i); int nRC = mysql_stmt_fetch(d->stmt); if (nRC) { #ifdef MYSQL_DATA_TRUNCATED if (nRC == 1 || nRC == MYSQL_DATA_TRUNCATED) #else if (nRC == 1) #endif setLastError(qMakeStmtError(QCoreApplication::translate("embeddedResult", "Unable to fetch data"), QSqlError::StatementError, d->stmt)); return false; } #else return false; #endif } else { mysql_data_seek(d->result, i); d->row = mysql_fetch_row(d->result); if (!d->row) return false; } setAt(i); return true; }
bool QMYSQLResult::fetch( int i ) { if ( isForwardOnly() ) { // fake a forward seek if ( at() < i ) { int x = i - at(); while ( --x && fetchNext() ); return fetchNext(); } else { return FALSE; } } if ( at() == i ) return TRUE; mysql_data_seek( d->result, i ); d->row = mysql_fetch_row( d->result ); if ( !d->row ) return FALSE; setAt( i ); return TRUE; }
double SQLiteQuery::executeGetDouble(const std::string &sql) { double val = 0; if (getResult(sql)) { if (fetchNext()) { val = getDouble(); } freeResults(); } return val; }
long SQLiteQuery::executeGetLong(const std::string &sql) { long val = 0; if (getResult(sql)) { if (fetchNext()) { val = getLong(); } freeResults(); } return val; }
const char *SQLiteQuery::executeGetString(const std::string &sql) { m_tempString = ""; if (getResult(sql)) { if (fetchNext()) { m_tempString = getString(); } freeResults(); } return m_tempString.c_str(); }
int draw(cairo_t *cr){ cairo_set_source_rgba(cr, 0,0,1,1); roundedRectangle(cr, x,y,w,h,20); cairo_fill(cr); int64_t xPoint=(0-backLeft)/scale; SpanItr item=leftMostSpan; while(xPoint<w){ cout<<"*"; item->second->draw(cr, xPoint, navBarHeight); xPoint+=item->second->spanWidth; fetchNext(item); }cout<<'.'<<flush; return 1; }
bool ZSqliteCipherCachedResult::fetchLast() { if (d->atEnd) { if (d->forwardOnly) return false; else return fetch(d->cacheCount() - 1); } int i = at(); while (fetchNext()) ++i; /* brute force */ if (d->forwardOnly && at() == QSql::AfterLastRow) { setAt(i); return true; } else { return fetch(i); } }
bool QtSqlCachedResult::fetchLast() { if (at() == QSql::AfterLast) { if (d->forwardOnly) return FALSE; else return fetch(d->rowCacheEnd - 1); } int i = at(); while (fetchNext()) i++; /* brute force */ if (d->forwardOnly && at() == QSql::AfterLast) { setAt(i); return TRUE; } else { return fetch(d->rowCacheEnd - 1); } }
mainwindow::mainwindow(){ currentState=0; hd = new helpdialog; m=new mediaobject; setupUi(this); setWindowTitle("Music Player"); m=new mediaobject; QObject::connect(actionAbout, SIGNAL(triggered()), this, SLOT(helpShow())); QObject::connect(actionExit,SIGNAL(triggered()),this,SLOT(close())); QObject::connect(actionAdd_Files,SIGNAL(triggered()),this,SLOT(addFiles())); QObject::connect(buttonPause,SIGNAL(clicked()),this,SLOT(pauseFile())); QObject::connect(buttonPlay,SIGNAL(clicked()),this,SLOT(playCurrent())); QObject::connect(buttonStop,SIGNAL(clicked()),m->mobj,SLOT(stop())); QObject::connect(m,SIGNAL(currentSourceChanged(Phonon::MediaSource)),this,SLOT(fetchNext(Phonon::MediaSource))); QObject::connect(m->mobj,SIGNAL(aboutToFinish()),this,SLOT(aboutToFinish())); QObject::connect(m->mobj,SIGNAL(stateChanged(Phonon::State,Phonon::State)),this,SLOT(metaStateChanged(Phonon::State,Phonon::State))); seekSlider->setMediaObject(m->mobj); volumeSlider->setAudioOutput(m->audioOutput); show(); // Signal and slots for help -> AboutUs //m->setQueue(list); }
void moveRel(int64_t n){cout<<"N:"<<n<<"\n"; int64_t W; if(n>0){ W=leftMostSpan->second->spanWidth; n+=backLeft; while(n >= W){ n-=W; fetchNext(leftMostSpan); W=leftMostSpan->second->spanWidth; } backLeft=n; } else if(n<0){ n=-n; W=leftMostSpan->second->spanWidth; n += W-backLeft; while(n >= W){ n-=W; fetchPrev(leftMostSpan); W=leftMostSpan->second->spanWidth; } backLeft=W-n; } }
bool QMYSQLResult::fetchFirst() { if ( isForwardOnly() ) // again, fake it return fetchNext(); return fetch( 0 ); }