本文整理汇总了C++中ClearStatement函数的典型用法代码示例。如果您正苦于以下问题:C++ ClearStatement函数的具体用法?C++ ClearStatement怎么用?C++ ClearStatement使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ClearStatement函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ClearStatement
OGRErr OGRSQLiteSelectLayer::ResetStatement()
{
int rc;
ClearStatement();
iNextShapeId = 0;
bDoStep = TRUE;
#ifdef DEBUG
CPLDebug( "OGR_SQLITE", "prepare(%s)", poBehaviour->osSQLCurrent.c_str() );
#endif
rc = sqlite3_prepare( poDS->GetDB(), poBehaviour->osSQLCurrent,
static_cast<int>(poBehaviour->osSQLCurrent.size()),
&hStmt, NULL );
if( rc == SQLITE_OK )
{
return OGRERR_NONE;
}
else
{
CPLError( CE_Failure, CPLE_AppDefined,
"In ResetStatement(): sqlite3_prepare(%s):\n %s",
poBehaviour->osSQLCurrent.c_str(), sqlite3_errmsg(poDS->GetDB()) );
hStmt = NULL;
return OGRERR_FAILURE;
}
}
示例2: ClearStatement
OGRErr OGRSQLiteTableLayer::ResetStatement()
{
int rc;
CPLString osSQL;
ClearStatement();
iNextShapeId = 0;
osSQL.Printf( "SELECT _rowid_, * FROM '%s' %s",
pszEscapedTableName,
osWHERE.c_str() );
rc = sqlite3_prepare( poDS->GetDB(), osSQL, osSQL.size(),
&hStmt, NULL );
if( rc == SQLITE_OK )
{
return OGRERR_NONE;
}
else
{
CPLError( CE_Failure, CPLE_AppDefined,
"In ResetStatement(): sqlite3_prepare(%s):\n %s",
osSQL.c_str(), sqlite3_errmsg(poDS->GetDB()) );
hStmt = NULL;
return OGRERR_FAILURE;
}
}
示例3: ClearStatement
OGRFeature *OGRWalkTableLayer::GetFeature( long nFeatureId )
{
if( pszFIDColumn == NULL )
return OGRWalkLayer::GetFeature( nFeatureId );
ClearStatement();
iNextShapeId = nFeatureId;
poStmt = new CPLODBCStatement( poDS->GetSession() );
poStmt->Append( "SELECT * FROM " );
poStmt->Append( poFeatureDefn->GetName() );
poStmt->Append( "Features" );
poStmt->Appendf( " WHERE %s = %ld", pszFIDColumn, nFeatureId );
if( !poStmt->ExecuteSQL() )
{
delete poStmt;
poStmt = NULL;
return NULL;
}
return GetNextRawFeature();
}
示例4: ClearStatement
OGRSQLiteViewLayer::~OGRSQLiteViewLayer()
{
ClearStatement();
CPLFree(pszEscapedTableName);
CPLFree(pszEscapedUnderlyingTableName);
}
示例5: ClearStatement
void OGRDB2SelectLayer::ResetReading()
{
if( iNextShapeId != 0 )
ClearStatement();
OGRDB2Layer::ResetReading();
}
示例6: ClearStatement
void OGRGeomediaSelectLayer::ResetReading()
{
if( iNextShapeId != 0 )
ClearStatement();
OGRGeomediaLayer::ResetReading();
}
示例7: ClearStatement
void OGRMSSQLSpatialSelectLayer::ResetReading()
{
if( iNextShapeId != 0 )
ClearStatement();
OGRMSSQLSpatialLayer::ResetReading();
}
示例8: CPLFree
OGRODBCTableLayer::~OGRODBCTableLayer()
{
CPLFree( pszTableName );
CPLFree( pszSchemaName );
CPLFree( pszQuery );
ClearStatement();
}
示例9: CPLFree
OGRMSSQLSpatialTableLayer::~OGRMSSQLSpatialTableLayer()
{
CPLFree( pszTableName );
CPLFree( pszSchemaName );
CPLFree( pszQuery );
ClearStatement();
}
示例10: ResetStatement
OGRFeature *OGRGeoPackageLayer::GetNextFeature()
{
for( ; TRUE; )
{
OGRFeature *poFeature;
if( m_poQueryStatement == NULL )
{
ResetStatement();
if (m_poQueryStatement == NULL)
return NULL;
}
/* -------------------------------------------------------------------- */
/* Fetch a record (unless otherwise instructed) */
/* -------------------------------------------------------------------- */
if( bDoStep )
{
int rc;
rc = sqlite3_step( m_poQueryStatement );
if( rc != SQLITE_ROW )
{
if ( rc != SQLITE_DONE )
{
sqlite3_reset(m_poQueryStatement);
CPLError( CE_Failure, CPLE_AppDefined,
"In GetNextRawFeature(): sqlite3_step() : %s",
sqlite3_errmsg(m_poDS->GetDB()) );
}
ClearStatement();
return NULL;
}
}
else
bDoStep = TRUE;
poFeature = TranslateFeature(m_poQueryStatement);
if( poFeature == NULL )
return NULL;
if( (m_poFilterGeom == NULL
|| FilterGeometry( poFeature->GetGeomFieldRef(m_iGeomFieldFilter) ) )
&& (m_poAttrQuery == NULL
|| m_poAttrQuery->Evaluate( poFeature )) )
return poFeature;
delete poFeature;
}
}
示例11: EQUAL
OGRErr OGRGeomediaTableLayer::SetAttributeFilter( const char *pszQueryIn )
{
if( (pszQueryIn == NULL && this->pszQuery == NULL)
|| (pszQueryIn != NULL && this->pszQuery != NULL
&& EQUAL(pszQueryIn,this->pszQuery)) )
return OGRERR_NONE;
CPLFree( this->pszQuery );
this->pszQuery = pszQueryIn ? CPLStrdup( pszQueryIn ) : NULL;
ClearStatement();
return OGRERR_NONE;
}
示例12: EQUAL
OGRErr OGRMSSQLSpatialTableLayer::SetAttributeFilter( const char *pszQuery )
{
if( (pszQuery == NULL && this->pszQuery == NULL)
|| (pszQuery != NULL && this->pszQuery != NULL
&& EQUAL(pszQuery,this->pszQuery)) )
return OGRERR_NONE;
CPLFree( this->pszQuery );
this->pszQuery = (pszQuery) ? CPLStrdup( pszQuery ) : NULL;
ClearStatement();
return OGRERR_NONE;
}
示例13: CPLFree
OGRErr OGRPGeoTableLayer::SetAttributeFilter( const char *pszQuery )
{
CPLFree(m_pszAttrQueryString);
m_pszAttrQueryString = (pszQuery) ? CPLStrdup(pszQuery) : NULL;
if( (pszQuery == NULL && this->pszQuery == NULL)
|| (pszQuery != NULL && this->pszQuery != NULL
&& EQUAL(pszQuery,this->pszQuery)) )
return OGRERR_NONE;
CPLFree( this->pszQuery );
this->pszQuery = pszQuery ? CPLStrdup( pszQuery ) : NULL;
ClearStatement();
return OGRERR_NONE;
}
示例14: CPLFree
OGRErr OGRODBCTableLayer::SetAttributeFilter( const char *pszQueryIn )
{
CPLFree(m_pszAttrQueryString);
m_pszAttrQueryString = (pszQueryIn) ? CPLStrdup(pszQueryIn) : NULL;
if( (pszQueryIn == NULL && pszQuery == NULL)
|| (pszQueryIn != NULL && pszQuery != NULL
&& EQUAL(pszQueryIn, pszQuery)) )
return OGRERR_NONE;
CPLFree( pszQuery );
pszQuery = pszQueryIn != NULL ? CPLStrdup( pszQueryIn ) : NULL;
ClearStatement();
return OGRERR_NONE;
}
示例15: GetLayerDefn
OGRErr OGRMSSQLSpatialTableLayer::DeleteFeature( long nFID )
{
GetLayerDefn();
if( pszFIDColumn == NULL )
{
CPLError( CE_Failure, CPLE_AppDefined,
"DeleteFeature() without any FID column." );
return OGRERR_FAILURE;
}
if( nFID == OGRNullFID )
{
CPLError( CE_Failure, CPLE_AppDefined,
"DeleteFeature() with unset FID fails." );
return OGRERR_FAILURE;
}
ClearStatement();
/* -------------------------------------------------------------------- */
/* Drop the record with this FID. */
/* -------------------------------------------------------------------- */
CPLODBCStatement oStatement( poDS->GetSession() );
oStatement.Appendf("DELETE FROM [%s] WHERE [%s] = %ld",
poFeatureDefn->GetName(), pszFIDColumn, nFID);
if( !oStatement.ExecuteSQL() )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Attempt to delete feature with FID %ld failed. %s",
nFID, poDS->GetSession()->GetLastError() );
return OGRERR_FAILURE;
}
return OGRERR_NONE;
}