本文整理汇总了C++中OGRFieldDefn::IsDefaultDriverSpecific方法的典型用法代码示例。如果您正苦于以下问题:C++ OGRFieldDefn::IsDefaultDriverSpecific方法的具体用法?C++ OGRFieldDefn::IsDefaultDriverSpecific怎么用?C++ OGRFieldDefn::IsDefaultDriverSpecific使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OGRFieldDefn
的用法示例。
在下文中一共展示了OGRFieldDefn::IsDefaultDriverSpecific方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RunDeferedCreationIfNecessary
OGRErr OGRCARTODBTableLayer::RunDeferedCreationIfNecessary()
{
if( !bDeferedCreation )
return OGRERR_NONE;
bDeferedCreation = FALSE;
CPLString osSQL;
osSQL.Printf("CREATE TABLE %s ( %s SERIAL,",
OGRCARTODBEscapeIdentifier(osName).c_str(),
osFIDColName.c_str());
int nSRID = 0;
OGRwkbGeometryType eGType = GetGeomType();
if( eGType != wkbNone )
{
CPLString osGeomType = OGRToOGCGeomType(eGType);
if( wkbHasZ(eGType) )
osGeomType += "Z";
OGRCartoDBGeomFieldDefn *poFieldDefn =
(OGRCartoDBGeomFieldDefn *)poFeatureDefn->GetGeomFieldDefn(0);
nSRID = poFieldDefn->nSRID;
osSQL += CPLSPrintf("%s GEOMETRY(%s, %d)%s, %s GEOMETRY(%s, %d),",
"the_geom",
osGeomType.c_str(),
nSRID,
(!poFieldDefn->IsNullable()) ? " NOT NULL" : "",
"the_geom_webmercator",
osGeomType.c_str(),
3857);
}
for( int i = 0; i < poFeatureDefn->GetFieldCount(); i++ )
{
OGRFieldDefn* poFieldDefn = poFeatureDefn->GetFieldDefn(i);
if( strcmp(poFieldDefn->GetNameRef(), osFIDColName) != 0 )
{
osSQL += OGRCARTODBEscapeIdentifier(poFieldDefn->GetNameRef());
osSQL += " ";
osSQL += OGRPGCommonLayerGetType(*poFieldDefn, FALSE, TRUE);
if( !poFieldDefn->IsNullable() )
osSQL += " NOT NULL";
if( poFieldDefn->GetDefault() != NULL && !poFieldDefn->IsDefaultDriverSpecific() )
{
osSQL += " DEFAULT ";
osSQL += poFieldDefn->GetDefault();
}
osSQL += ",";
}
}
osSQL += CPLSPrintf("PRIMARY KEY (%s) )", osFIDColName.c_str());
CPLString osSeqName(OGRCARTODBEscapeIdentifier(CPLSPrintf("%s_%s_seq",
osName.c_str(), osFIDColName.c_str())));
osSQL += ";";
osSQL += CPLSPrintf("DROP SEQUENCE IF EXISTS %s CASCADE", osSeqName.c_str());
osSQL += ";";
osSQL += CPLSPrintf("CREATE SEQUENCE %s START 1", osSeqName.c_str());
osSQL += ";";
osSQL += CPLSPrintf("ALTER TABLE %s ALTER COLUMN %s SET DEFAULT nextval('%s')",
OGRCARTODBEscapeIdentifier(osName).c_str(),
osFIDColName.c_str(), osSeqName.c_str());
json_object* poObj = poDS->RunSQL(osSQL);
if( poObj == NULL )
return OGRERR_FAILURE;
json_object_put(poObj);
if( bCartoDBify )
{
if( nSRID != 4326 )
{
if( eGType != wkbNone )
{
CPLError(CE_Warning, CPLE_AppDefined,
"Cannot register table in dashboard with "
"cdb_cartodbfytable() since its SRS is not EPSG:4326");
}
}
else
{
if( poDS->GetCurrentSchema() == "public" )
osSQL.Printf("SELECT cdb_cartodbfytable('%s')",
OGRCARTODBEscapeLiteral(osName).c_str());
else
osSQL.Printf("SELECT cdb_cartodbfytable('%s', '%s')",
OGRCARTODBEscapeLiteral(poDS->GetCurrentSchema()).c_str(),
OGRCARTODBEscapeLiteral(osName).c_str());
poObj = poDS->RunSQL(osSQL);
if( poObj == NULL )
return OGRERR_FAILURE;
json_object_put(poObj);
}
}
return OGRERR_NONE;
//.........这里部分代码省略.........