void QTrackerDirectSyncResult::runQuery() { if (statementType() == QSparqlQuery::AskStatement || statementType() == QSparqlQuery::SelectStatement) { selectQuery(); } else if (statementType() == QSparqlQuery::InsertStatement || statementType() == QSparqlQuery::DeleteStatement) { updateQuery(); } }
void IB_Statement::prepareNoInputNoOutput (const IB_STRING sqlString) { //david jencks 2-4-2001 sqlLog(sqlString);// logging all sql statements if (!stmtHandle_) open (); if (isc_dsql_prepare (status_->vector(), transaction_->trHandleP(), &stmtHandle_, 0, sqlString, // CJL-IB6 add SQLDialect support, and obsolete sqldaVersion connection_->attachmentSQLDialect_, // sqldaVersion__, // CJL-IB6 end NULL)) throw new IB_SQLException (IB_SQLException::engine__default_0__, status_); prepared_ = IB_TRUE; stmtType_ = statementType (); // Its harmless to delete a NULL pointer. delete resultSet_; resultSet_ = NULL; }
/** Change the sorting order/text definition. It should be always called when there is not an iteration started in persistence layer. @param aTextDef the new text definition to be used in the view session. */ void CCntPplViewSession::ChangeSortOrderL(const CContactTextDef& aTextDef) { //Cleanup the cached Prepare statement as the sort order will be changed Cancel(); CleanupCachedPrepareStatement(); //Copy the text definition CContactTextDef* textDef = CContactTextDef::NewLC(); const TInt KTextDefCount = aTextDef.Count(); for (TInt index = 0; index < KTextDefCount; ++index) { textDef->AppendL(TContactTextDefItem(aTextDef.At(index).iFieldType)); } // Create select statement on contact table TCntSqlStatementType statementType(ESelect, KSqlContactTableName()); CCntSqlStatement* sqlSmt = TSqlProvider::GetSqlStatementL(statementType); CleanupStack::PushL(sqlSmt); // Always select id, type flags. sqlSmt->SetParamL(KContactId(), KSpace()); sqlSmt->SetParamL(KContactTypeFlags(), KSpace()); //Go through text definition to construct select statement. TBool isFastAccessOnly = ETrue; for(TInt ii = 0; ii < KTextDefCount; ++ii) { const TDesC& KColunmName = TCntPersistenceUtility::GetFastAccessColumnNameById(aTextDef.At(ii).iFieldType.iUid); if(KColunmName.Length() > 0) { sqlSmt->SetParamL(KColunmName, KSpace()); } else { isFastAccessOnly = EFalse; } } if(!isFastAccessOnly) { //Fields in text blob are needed, add text fields header and //text blob columns in the select statement. sqlSmt->SetParamL(KContactTextFieldHeader(), KSpace()); sqlSmt->SetParamL(KContactTextFields(), KSpace()); } CleanupStack::Pop(2, textDef); // sqlSmt, textDef. delete iCntSqlStatement; iCntSqlStatement = sqlSmt; delete iTextDef; iTextDef = textDef; iIsFastAccessFieldsOnly = isFastAccessOnly; }
IB_ResultSet* IB_Statement::prepareNoInput (const IB_STRING sqlString, const IB_SSHORT16 suggestedResultCols, const IB_SSHORT16 maxFieldSize) { //david jencks 2-4-2001 sqlLog(sqlString); // logg all sql statements if (!stmtHandle_) open (); // If sqldaOut_ is already allocated, reuse it. // Otherwise, allocate space for a suggestedResultCols item select list. // If more space is needed, allocate more later. if (!sqldaOut_) sqldaOut_ = (XSQLDA *) malloc (XSQLDA_LENGTH(suggestedResultCols)); if (!sqldaOut_) throw new IB_SQLException (IB_SQLException::outOfMemory__, IB_SQLException::outOfMemoryException__); sqldaOut_->version = sqldaVersion__; sqldaOut_->sqln = suggestedResultCols; if (isc_dsql_prepare (status_->vector(), transaction_->trHandleP(), &stmtHandle_, 0, sqlString, // CJL-IB6 add SQLDialect support, and obsolete sqldaVersion connection_->attachmentSQLDialect_, // sqldaVersion__, // CJL-IB6 end sqldaOut_)) throw new IB_SQLException (IB_SQLException::engine__default_0__, status_); prepared_ = IB_TRUE; IB_SSHORT16 actualResultCols = sqldaOut_->sqld; stmtType_ = statementType (); // If its a non-select, just return. if (!actualResultCols) { return NULL; } // Check that actual number of result cols is not greater than allocated suggestedInputCols. // Realloc if necessary. if (sqldaOut_->sqln < actualResultCols) { sqldaOut_ = (XSQLDA *) realloc (sqldaOut_, XSQLDA_LENGTH (actualResultCols)); sqldaOut_->version = sqldaVersion__; sqldaOut_->sqln = actualResultCols; } // !!! MOVE THIS UP INSIDE IF STATEMENT // Describe the output sqlvars if (isc_dsql_describe (status_->vector(), &stmtHandle_, // CJL-IB6 add SQLDialect support, and obsolete sqldaVersion connection_->attachmentSQLDialect_, // sqldaVersion__, // CJL-IB6 end sqldaOut_)) throw new IB_SQLException (IB_SQLException::engine__default_0__, status_); // Its harmless to delete a NULL pointer. delete resultSet_; // Must always realloc since record size may change. // !!! future enhancement - make this a realloc resultSet_ = new IB_ResultSet (this, maxFieldSize); return resultSet_; }