| 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Project: OpenGIS Simple Features Reference Implementation |
| 4 | * Purpose: Definition of classes and functions used by SQLite and GPKG drivers |
| 5 | * Author: Even Rouault <even dot rouault at spatialys.com> |
| 6 | * |
| 7 | ****************************************************************************** |
| 8 | * Copyright (c) 2021, Even Rouault <even dot rouault at spatialys.com> |
| 9 | * |
| 10 | * SPDX-License-Identifier: MIT |
| 11 | ****************************************************************************/ |
| 12 | |
| 13 | #ifndef OGR_SQLITE_BASE_H_INCLUDED |
| 14 | #define OGR_SQLITE_BASE_H_INCLUDEDcxx . . $ `ogr/ogrsf_frmts/sqlite/ogrsqlitebase.h:14:9`! |
| 15 | |
| 16 | #include "cpl_vsi.h"cxx . . $ `<file>/port/cpl_vsi.h`/ |
| 17 | #include "cpl_string.h"cxx . . $ `<file>/port/cpl_string.h`/ |
| 18 | #include "gdal_pam.h"cxx . . $ `<file>/gcore/gdal_pam.h`/ |
| 19 | #include "ogrsf_frmts.h"cxx . . $ `<file>/ogr/ogrsf_frmts/ogrsf_frmts.h`/ |
| 20 | |
| 21 | #include <sqlite3.h> |
| 22 | |
| 23 | // to avoid -Wold-style-cast with some compilers |
| 24 | #undef SQLITE_TRANSIENTcxx . . $ `<external>/2400532043262193228/sqlite3.h:6430:9`! |
| 25 | #define SQLITE_TRANSIENTcxx . . $ `ogr/ogrsf_frmts/sqlite/ogrsqlitebase.h:25:9`! reinterpret_cast<sqlite3_destructor_type>(-1) |
| 26 | |
| 27 | #include <map> |
| 28 | #include <utility> |
| 29 | #include <vector> |
| 30 | |
| 31 | /************************************************************************/ |
| 32 | /* Format used to store geometry data in the database. */ |
| 33 | /************************************************************************/ |
| 34 | |
| 35 | enum OGRSQLiteGeomFormatcxx . . $ OGRSQLiteGeomFormat# |
| 36 | { |
| 37 | OSGF_WKTcxx . . $ OSGF_WKT., |
| 38 | OSGF_WKBcxx . . $ OSGF_WKB., |
| 39 | OSGF_FGFcxx . . $ OSGF_FGF., |
| 40 | OSGF_SpatiaLitecxx . . $ OSGF_SpatiaLite., |
| 41 | OSGF_Unknowncxx . . $ OSGF_Unknown., |
| 42 | }; |
| 43 | |
| 44 | /************************************************************************/ |
| 45 | /* OGRSQLiteGeomFieldDefn */ |
| 46 | /************************************************************************/ |
| 47 | |
| 48 | class OGRSQLiteGeomFieldDefncxx . . $ OGRSQLiteGeomFieldDefn# final : public OGRGeomFieldDefncxx . . $ OGRGeomFieldDefn# |
| 49 | { |
| 50 | public: |
| 51 | OGRSQLiteGeomFieldDefncxx . . $ OGRSQLiteGeomFieldDefn#OGRSQLiteGeomFieldDefn(34d26762b42c433a).(const char *pszNameIn, int iGeomColIn) |
| 52 | : OGRGeomFieldDefncxx . . $ OGRGeomFieldDefn#(pszNameIn, wkbUnknown), m_iColcxx . . $ OGRSQLiteGeomFieldDefn#m_iCol.(iGeomColIn) |
| 53 | { |
| 54 | } |
| 55 | |
| 56 | ~cxx . . $ OGRSQLiteGeomFieldDefn#`~OGRSQLiteGeomFieldDefn`(ced63f7c635d850d).OGRSQLiteGeomFieldDefncxx . . $ OGRSQLiteGeomFieldDefn#() override; |
| 57 | |
| 58 | int m_nSRSIdcxx . . $ OGRSQLiteGeomFieldDefn#m_nSRSId. = -1; |
| 59 | int m_iColcxx . . $ OGRSQLiteGeomFieldDefn#m_iCol.; /* ordinal of geometry field in SQL statement */ |
| 60 | bool m_bTriedAsSpatiaLitecxx . . $ OGRSQLiteGeomFieldDefn#m_bTriedAsSpatiaLite. = false; |
| 61 | OGRSQLiteGeomFormatcxx . . $ OGRSQLiteGeomFormat# m_eGeomFormatcxx . . $ OGRSQLiteGeomFieldDefn#m_eGeomFormat. = OSGF_Unknowncxx . . $ OSGF_Unknown.; |
| 62 | OGREnvelope m_oCachedExtentcxx . . $ OGRSQLiteGeomFieldDefn#m_oCachedExtent.{}; |
| 63 | bool m_bCachedExtentIsValidcxx . . $ OGRSQLiteGeomFieldDefn#m_bCachedExtentIsValid. = false; |
| 64 | bool m_bHasSpatialIndexcxx . . $ OGRSQLiteGeomFieldDefn#m_bHasSpatialIndex. = false; |
| 65 | bool m_bHasCheckedSpatialIndexTablecxx . . $ OGRSQLiteGeomFieldDefn#m_bHasCheckedSpatialIndexTable. = false; |
| 66 | stdcxx . . $ std/::vector<stdcxx . . $ std/::pair<CPLString, CPLString>> m_aosDisabledTriggerscxx . . $ OGRSQLiteGeomFieldDefn#m_aosDisabledTriggers.{}; |
| 67 | }; |
| 68 | |
| 69 | /************************************************************************/ |
| 70 | /* OGRSQLiteFeatureDefn */ |
| 71 | /************************************************************************/ |
| 72 | |
| 73 | class OGRSQLiteFeatureDefncxx . . $ OGRSQLiteFeatureDefn# final : public OGRFeatureDefncxx . . $ OGRFeatureDefn# |
| 74 | { |
| 75 | public: |
| 76 | explicit OGRSQLiteFeatureDefncxx . . $ OGRSQLiteFeatureDefn#OGRSQLiteFeatureDefn(85c52e162fed56f9).(const char *pszName = nullptr) |
| 77 | : OGRFeatureDefncxx . . $ OGRFeatureDefn#(pszName) |
| 78 | { |
| 79 | SetGeomTypecxx . . $ OGRFeatureDefn#SetGeomType(f47ce3f1fe923726).(wkbNone); |
| 80 | } |
| 81 | |
| 82 | ~cxx . . $ OGRSQLiteFeatureDefn#`~OGRSQLiteFeatureDefn`(ced63f7c635d850d).OGRSQLiteFeatureDefncxx . . $ OGRSQLiteFeatureDefn#() override; |
| 83 | |
| 84 | OGRSQLiteGeomFieldDefncxx . . $ OGRSQLiteGeomFieldDefn# *myGetGeomFieldDefncxx . . $ OGRSQLiteFeatureDefn#myGetGeomFieldDefn(ec9cd2a304585a8).(int i) |
| 85 | { |
| 86 | return cpl::down_cast<OGRSQLiteGeomFieldDefncxx . . $ OGRSQLiteGeomFieldDefn# *>(GetGeomFieldDefncxx . . $ OGRFeatureDefn#GetGeomFieldDefn(39768c424f32bab2).(i)); |
| 87 | } |
| 88 | |
| 89 | const OGRSQLiteGeomFieldDefncxx . . $ OGRSQLiteGeomFieldDefn# *myGetGeomFieldDefncxx . . $ OGRSQLiteFeatureDefn#myGetGeomFieldDefn(a6fbfac5cf1a5b8e).(int i) const |
| 90 | { |
| 91 | return cpl::down_cast<const OGRSQLiteGeomFieldDefncxx . . $ OGRSQLiteGeomFieldDefn# *>( |
| 92 | GetGeomFieldDefncxx . . $ OGRFeatureDefn#GetGeomFieldDefn(801b12ff899738d8).(i)); |
| 93 | } |
| 94 | }; |
| 95 | |
| 96 | /************************************************************************/ |
| 97 | /* IOGRSQLiteGetSpatialWhere */ |
| 98 | /************************************************************************/ |
| 99 | |
| 100 | class IOGRSQLiteGetSpatialWherecxx . . $ IOGRSQLiteGetSpatialWhere# /* non final */ |
| 101 | { |
| 102 | public: |
| 103 | virtual ~cxx . . $ IOGRSQLiteGetSpatialWhere#`~IOGRSQLiteGetSpatialWhere`(49f6e7a06ebc5aa8).IOGRSQLiteGetSpatialWherecxx . . $ IOGRSQLiteGetSpatialWhere#(); |
| 104 | |
| 105 | virtual bool HasFastSpatialFiltercxx . . $ IOGRSQLiteGetSpatialWhere#HasFastSpatialFilter(83c267b20bac841a).(int iGeomCol) = 0; |
| 106 | virtual CPLString GetSpatialWherecxx . . $ IOGRSQLiteGetSpatialWhere#GetSpatialWhere(ac3cefc8daf1e661).(int iGeomCol, |
| 107 | OGRGeometrycxx . . $ OGRGeometry# *poFilterGeom) = 0; |
| 108 | }; |
| 109 | |
| 110 | /************************************************************************/ |
| 111 | /* OGRSQLiteBaseDataSource */ |
| 112 | /************************************************************************/ |
| 113 | |
| 114 | /* Used by both OGRSQLiteDataSource and OGRGeoPackageDataSource */ |
| 115 | class OGRSQLiteBaseDataSourcecxx . . $ OGRSQLiteBaseDataSource# CPL_NON_FINALcxx . . $ `port/cpl_port.h:1094:9`! : public GDALPamDatasetcxx . . $ GDALPamDataset# |
| 116 | { |
| 117 | protected: |
| 118 | char *m_pszFilenamecxx . . $ OGRSQLiteBaseDataSource#m_pszFilename. = nullptr; |
| 119 | stdcxx . . $ std/::string |
| 120 | m_osFilenameForSQLiteOpencxx . . $ OGRSQLiteBaseDataSource#m_osFilenameForSQLiteOpen.{}; // generally m_pszFilename, but can be |
| 121 | // also file:{m_pszFilename}?nolock=1 |
| 122 | bool m_bNoLockcxx . . $ OGRSQLiteBaseDataSource#m_bNoLock. = false; |
| 123 | stdcxx . . $ std/::string |
| 124 | m_osFinalFilenamecxx . . $ OGRSQLiteBaseDataSource#m_osFinalFilename.{}; // use when generating a network hosted file with |
| 125 | // CPL_VSIL_USE_TEMP_FILE_FOR_RANDOM_WRITE=YES |
| 126 | bool m_bCallUndeclareFileNotToOpencxx . . $ OGRSQLiteBaseDataSource#m_bCallUndeclareFileNotToOpen. = false; |
| 127 | |
| 128 | sqlite3 *hDBcxx . . $ OGRSQLiteBaseDataSource#hDB. = nullptr; |
| 129 | |
| 130 | sqlite3_vfs *pMyVFScxx . . $ OGRSQLiteBaseDataSource#pMyVFS. = nullptr; |
| 131 | |
| 132 | VSILFILE *fpMainFilecxx . . $ OGRSQLiteBaseDataSource#fpMainFile. = |
| 133 | nullptr; /* Set by the VFS layer when it opens the DB */ |
| 134 | /* Must *NOT* be closed by the datasource explicitly. */ |
| 135 | |
| 136 | bool OpenOrCreateDBcxx . . $ OGRSQLiteBaseDataSource#OpenOrCreateDB(636f4aecd7c651f4).(int flags, bool bRegisterOGR2SQLiteExtensions, |
| 137 | bool bLoadExtensions); |
| 138 | bool SetSynchronouscxx . . $ OGRSQLiteBaseDataSource#SetSynchronous(c9857a73d68e59ba).(); |
| 139 | bool SetCacheSizecxx . . $ OGRSQLiteBaseDataSource#SetCacheSize(c9857a73d68e59ba).(); |
| 140 | void LoadExtensionscxx . . $ OGRSQLiteBaseDataSource#LoadExtensions(49f6e7a06ebc5aa8).(); |
| 141 | |
| 142 | bool CloseDBcxx . . $ OGRSQLiteBaseDataSource#CloseDB(c9857a73d68e59ba).(); |
| 143 | |
| 144 | stdcxx . . $ std/::mapcxx . . $ std/map#<CPLString, OGREnvelope> oMapSQLEnvelopecxx . . $ OGRSQLiteBaseDataSource#oMapSQLEnvelope.{cxx . . $ std/map#map(49f6e7a06ebc5aa8).}; |
| 145 | |
| 146 | mutable bool m_bHasPopulatedRelationshipscxx . . $ OGRSQLiteBaseDataSource#m_bHasPopulatedRelationships. = false; |
| 147 | mutable stdcxx . . $ std/::mapcxx . . $ std/map#<stdcxx . . $ std/::string, stdcxx . . $ std/::unique_ptr<GDALRelationshipcxx . . $ GDALRelationship#>> |
| 148 | m_osMapRelationshipscxx . . $ OGRSQLiteBaseDataSource#m_osMapRelationships.{cxx . . $ std/map#map(49f6e7a06ebc5aa8).}; |
| 149 | |
| 150 | void *hSpatialiteCtxtcxx . . $ OGRSQLiteBaseDataSource#hSpatialiteCtxt. = nullptr; |
| 151 | bool InitSpatialitecxx . . $ OGRSQLiteBaseDataSource#InitSpatialite(c9857a73d68e59ba).(); |
| 152 | void FinishSpatialitecxx . . $ OGRSQLiteBaseDataSource#FinishSpatialite(49f6e7a06ebc5aa8).(); |
| 153 | |
| 154 | int m_bUserTransactionActivecxx . . $ OGRSQLiteBaseDataSource#m_bUserTransactionActive. = FALSEcxx . . $ `port/cpl_port.h:1180:9`!; |
| 155 | int m_nSoftTransactionLevelcxx . . $ OGRSQLiteBaseDataSource#m_nSoftTransactionLevel. = 0; |
| 156 | stdcxx . . $ std/::vector<stdcxx . . $ std/::string> m_aosSavepointscxx . . $ OGRSQLiteBaseDataSource#m_aosSavepoints.{}; |
| 157 | // The transaction was implicitly started by SAVEPOINT |
| 158 | bool m_bImplicitTransactionOpenedcxx . . $ OGRSQLiteBaseDataSource#m_bImplicitTransactionOpened. = false; |
| 159 | |
| 160 | OGRErr DoTransactionCommandcxx . . $ OGRSQLiteBaseDataSource#DoTransactionCommand(5c4306d8553b3696).(const char *pszCommand); |
| 161 | |
| 162 | bool DealWithOgrSchemaOpenOptioncxx . . $ OGRSQLiteBaseDataSource#DealWithOgrSchemaOpenOption(b7c83bf152ed97ea).(CSLConstListcxx . . $ CSLConstList# papszOpenOptionsIn); |
| 163 | |
| 164 | CPL_DISALLOW_COPY_ASSIGNcxx . . $ `port/cpl_port.h:1101:9`!(OGRSQLiteBaseDataSource) |
| 165 | |
| 166 | public: |
| 167 | OGRSQLiteBaseDataSourcecxx . . $ OGRSQLiteBaseDataSource#OGRSQLiteBaseDataSource(49f6e7a06ebc5aa8).(); |
| 168 | ~cxx . . $ OGRSQLiteBaseDataSource#`~OGRSQLiteBaseDataSource`(ced63f7c635d850d).OGRSQLiteBaseDataSourcecxx . . $ OGRSQLiteBaseDataSource#() override; |
| 169 | |
| 170 | stdcxx . . $ std/::string GetCurrentSavepointcxx . . $ OGRSQLiteBaseDataSource#GetCurrentSavepoint(219584694fe2b248).() const |
| 171 | { |
| 172 | return m_aosSavepointscxx . . $ OGRSQLiteBaseDataSource#m_aosSavepoints..empty() ? "" : m_aosSavepointscxx . . $ OGRSQLiteBaseDataSource#m_aosSavepoints..back(); |
| 173 | } |
| 174 | |
| 175 | stdcxx . . $ std/::string GetFirstSavepointcxx . . $ OGRSQLiteBaseDataSource#GetFirstSavepoint(219584694fe2b248).() const |
| 176 | { |
| 177 | return m_aosSavepointscxx . . $ OGRSQLiteBaseDataSource#m_aosSavepoints..empty() ? "" : m_aosSavepointscxx . . $ OGRSQLiteBaseDataSource#m_aosSavepoints..front(); |
| 178 | } |
| 179 | |
| 180 | bool IsInTransactioncxx . . $ OGRSQLiteBaseDataSource#IsInTransaction(50ce9a9e25b4a850).() const; |
| 181 | |
| 182 | sqlite3 *GetDBcxx . . $ OGRSQLiteBaseDataSource#GetDB(b8c523d2508df5d6).() |
| 183 | { |
| 184 | return hDBcxx . . $ OGRSQLiteBaseDataSource#hDB.; |
| 185 | } |
| 186 | |
| 187 | sqlite3_vfs *GetVFScxx . . $ OGRSQLiteBaseDataSource#GetVFS(2d0fc68366be6c4f).() |
| 188 | { |
| 189 | return pMyVFScxx . . $ OGRSQLiteBaseDataSource#pMyVFS.; |
| 190 | } |
| 191 | |
| 192 | inline bool GetUpdatecxx . . $ OGRSQLiteBaseDataSource#GetUpdate(50ce9a9e25b4a850).() const |
| 193 | { |
| 194 | return eAccesscxx . . $ GDALDataset#eAccess. == GA_Update; |
| 195 | } |
| 196 | |
| 197 | VSILFILE *GetVSILFILEcxx . . $ OGRSQLiteBaseDataSource#GetVSILFILE(f1b5b3131da9da2e).() const |
| 198 | { |
| 199 | return fpMainFilecxx . . $ OGRSQLiteBaseDataSource#fpMainFile.; |
| 200 | } |
| 201 | |
| 202 | void NotifyFileOpenedcxx . . $ OGRSQLiteBaseDataSource#NotifyFileOpened(814a10779a2d8c4e).(const char *pszFilename, VSILFILE *fp); |
| 203 | |
| 204 | const OGREnvelope *GetEnvelopeFromSQLcxx . . $ OGRSQLiteBaseDataSource#GetEnvelopeFromSQL(d4bfeb60a6861b02).(const CPLString &osSQL); |
| 205 | void SetEnvelopeForSQLcxx . . $ OGRSQLiteBaseDataSource#SetEnvelopeForSQL(648ead18ff44b8a5).(const CPLString &osSQL, |
| 206 | const OGREnvelope &oEnvelope); |
| 207 | |
| 208 | virtual stdcxx . . $ std/::pair<OGRLayercxx . . $ OGRLayer# *, IOGRSQLiteGetSpatialWherecxx . . $ IOGRSQLiteGetSpatialWhere# *> |
| 209 | GetLayerWithGetSpatialWhereByNamecxx . . $ OGRSQLiteBaseDataSource#GetLayerWithGetSpatialWhereByName(7a1322eafdda21bb).(const char *pszName) = 0; |
| 210 | |
| 211 | OGRErr AbortSQLcxx . . $ OGRSQLiteBaseDataSource#AbortSQL(b126dc7c1de90089).() override; |
| 212 | bool SetQueryLoggerFunccxx . . $ OGRSQLiteBaseDataSource#SetQueryLoggerFunc(4f3f55768c6dd3a7).(GDALQueryLoggerFunc pfnQueryLoggerFuncIn, |
| 213 | void *poQueryLoggerArgIn) override; |
| 214 | |
| 215 | OGRErr StartTransactioncxx . . $ OGRSQLiteBaseDataSource#StartTransaction(7864480464b09eea).(int bForce = FALSEcxx . . $ `port/cpl_port.h:1180:9`!) override; |
| 216 | OGRErr CommitTransactioncxx . . $ OGRSQLiteBaseDataSource#CommitTransaction(b126dc7c1de90089).() override; |
| 217 | OGRErr RollbackTransactioncxx . . $ OGRSQLiteBaseDataSource#RollbackTransaction(b126dc7c1de90089).() override; |
| 218 | |
| 219 | int TestCapabilitycxx . . $ OGRSQLiteBaseDataSource#TestCapability(78f035161ffa9fe2).(const char *) const override; |
| 220 | |
| 221 | void *GetInternalHandlecxx . . $ OGRSQLiteBaseDataSource#GetInternalHandle(42228c1987407501).(const char *) override; |
| 222 | |
| 223 | OGRErr SoftStartTransactioncxx . . $ OGRSQLiteBaseDataSource#SoftStartTransaction(b126dc7c1de90089).(); |
| 224 | OGRErr SoftCommitTransactioncxx . . $ OGRSQLiteBaseDataSource#SoftCommitTransaction(b126dc7c1de90089).(); |
| 225 | OGRErr SoftRollbackTransactioncxx . . $ OGRSQLiteBaseDataSource#SoftRollbackTransaction(b126dc7c1de90089).(); |
| 226 | OGRErr StartSavepointcxx . . $ OGRSQLiteBaseDataSource#StartSavepoint(7787e0c995c81e02).(const stdcxx . . $ std/::string &osName); |
| 227 | OGRErr ReleaseSavepointcxx . . $ OGRSQLiteBaseDataSource#ReleaseSavepoint(7787e0c995c81e02).(const stdcxx . . $ std/::string &osName); |
| 228 | OGRErr RollbackToSavepointcxx . . $ OGRSQLiteBaseDataSource#RollbackToSavepoint(7787e0c995c81e02).(const stdcxx . . $ std/::string &osName); |
| 229 | |
| 230 | /** |
| 231 | * Execute a SQL transaction command (BEGIN, COMMIT, ROLLBACK, SAVEPOINT) |
| 232 | * @return TRUE if the osSQLCommand was recognized as a transaction command |
| 233 | */ |
| 234 | bool ProcessTransactionSQLcxx . . $ OGRSQLiteBaseDataSource#ProcessTransactionSQL(7c222eea44a24d43).(const stdcxx . . $ std/::string &osSQLCommand); |
| 235 | |
| 236 | OGRErr PragmaCheckcxx . . $ OGRSQLiteBaseDataSource#PragmaCheck(f0be30763a490cce).(const char *pszPragma, const char *pszExpected, |
| 237 | int nRowsExpected); |
| 238 | |
| 239 | virtual void LoadRelationshipscxx . . $ OGRSQLiteBaseDataSource#LoadRelationships(83f5f38750778ac8).() const; |
| 240 | void LoadRelationshipsFromForeignKeyscxx . . $ OGRSQLiteBaseDataSource#LoadRelationshipsFromForeignKeys(31acba07a5ed933e).( |
| 241 | const stdcxx . . $ std/::vector<stdcxx . . $ std/::string> &excludedTables) const; |
| 242 | stdcxx . . $ std/::vector<stdcxx . . $ std/::string> |
| 243 | GetRelationshipNamescxx . . $ OGRSQLiteBaseDataSource#GetRelationshipNames(5023db1d17cccd27).(CSLConstListcxx . . $ CSLConstList# papszOptions = nullptr) const override; |
| 244 | const GDALRelationshipcxx . . $ GDALRelationship# * |
| 245 | GetRelationshipcxx . . $ OGRSQLiteBaseDataSource#GetRelationship(f51fdfc6adf0ee4).(const stdcxx . . $ std/::string &name) const override; |
| 246 | |
| 247 | bool IsSpatialiteLoadedcxx . . $ OGRSQLiteBaseDataSource#IsSpatialiteLoaded(c9857a73d68e59ba).(); |
| 248 | |
| 249 | static int MakeSpatialiteVersionNumbercxx . . $ OGRSQLiteBaseDataSource#MakeSpatialiteVersionNumber(2326284602b0bb2d).(int x, int y, int z) |
| 250 | { |
| 251 | return x * 10000 + y * 100 + z; |
| 252 | } |
| 253 | |
| 254 | int GetSpatialiteVersionNumbercxx . . $ OGRSQLiteBaseDataSource#GetSpatialiteVersionNumber(b126dc7c1de90089).(); |
| 255 | |
| 256 | bool SpatialiteRequiresTrustedSchemaOncxx . . $ OGRSQLiteBaseDataSource#SpatialiteRequiresTrustedSchemaOn(c9857a73d68e59ba).(); |
| 257 | bool AreSpatialiteTriggersSafecxx . . $ OGRSQLiteBaseDataSource#AreSpatialiteTriggersSafe(c9857a73d68e59ba).(); |
| 258 | |
| 259 | // sqlite3_prepare_v2 error logging wrapper |
| 260 | sqlite3_stmt * |
| 261 | prepareSqlcxx . . $ OGRSQLiteBaseDataSource#prepareSql(8b43ff5a900bcb6).(sqlite3 *db, /* Database handle */ |
| 262 | const char *zSql, /* SQL statement, UTF-8 encoded */ |
| 263 | int nByte = -1 /* Maximum length of zSql in bytes. */ |
| 264 | ); |
| 265 | |
| 266 | GDALQueryLoggerFunc pfnQueryLoggerFunccxx . . $ OGRSQLiteBaseDataSource#pfnQueryLoggerFunc. = nullptr; |
| 267 | void *poQueryLoggerArgcxx . . $ OGRSQLiteBaseDataSource#poQueryLoggerArg. = nullptr; |
| 268 | }; |
| 269 | |
| 270 | /************************************************************************/ |
| 271 | /* IOGRSQLiteSelectLayer */ |
| 272 | /************************************************************************/ |
| 273 | |
| 274 | class IOGRSQLiteSelectLayercxx . . $ IOGRSQLiteSelectLayer# /* non final */ |
| 275 | { |
| 276 | public: |
| 277 | virtual ~cxx . . $ IOGRSQLiteSelectLayer#`~IOGRSQLiteSelectLayer`(49f6e7a06ebc5aa8).IOGRSQLiteSelectLayercxx . . $ IOGRSQLiteSelectLayer#(); |
| 278 | |
| 279 | virtual char *&GetAttrQueryStringcxx . . $ IOGRSQLiteSelectLayer#GetAttrQueryString(e724e973b05dab80).() = 0; |
| 280 | virtual OGRFeatureQuerycxx . . $ OGRFeatureQuery# *&GetFeatureQuerycxx . . $ IOGRSQLiteSelectLayer#GetFeatureQuery(5e1e306909aae234).() = 0; |
| 281 | virtual OGRGeometrycxx . . $ OGRGeometry# *&GetFilterGeomcxx . . $ IOGRSQLiteSelectLayer#GetFilterGeom(2467f1a19d14cf75).() = 0; |
| 282 | virtual int &GetIGeomFieldFiltercxx . . $ IOGRSQLiteSelectLayer#GetIGeomFieldFilter(ffa05e89dbf2c50f).() = 0; |
| 283 | virtual const OGRSpatialReferencecxx . . $ OGRSpatialReference# *GetSpatialRefcxx . . $ IOGRSQLiteSelectLayer#GetSpatialRef(8a5496c2eeefaeaf).() const = 0; |
| 284 | virtual const OGRFeatureDefncxx . . $ OGRFeatureDefn# *GetLayerDefncxx . . $ IOGRSQLiteSelectLayer#GetLayerDefn(448b209f43d15bcc).() const = 0; |
| 285 | virtual int InstallFiltercxx . . $ IOGRSQLiteSelectLayer#InstallFilter(fed901b2566802ff).(const OGRGeometrycxx . . $ OGRGeometry# *) = 0; |
| 286 | virtual int HasReadFeaturecxx . . $ IOGRSQLiteSelectLayer#HasReadFeature(b126dc7c1de90089).() = 0; |
| 287 | virtual void BaseResetReadingcxx . . $ IOGRSQLiteSelectLayer#BaseResetReading(49f6e7a06ebc5aa8).() = 0; |
| 288 | virtual OGRFeaturecxx . . $ OGRFeature# *BaseGetNextFeaturecxx . . $ IOGRSQLiteSelectLayer#BaseGetNextFeature(ec9eceddec1d9563).() = 0; |
| 289 | virtual OGRErr BaseSetAttributeFiltercxx . . $ IOGRSQLiteSelectLayer#BaseSetAttributeFilter(5c4306d8553b3696).(const char *pszQuery) = 0; |
| 290 | virtual GIntBigcxx . . $ GIntBig# BaseGetFeatureCountcxx . . $ IOGRSQLiteSelectLayer#BaseGetFeatureCount(9ccc33c3ebad048d).(int bForce) = 0; |
| 291 | virtual int BaseTestCapabilitycxx . . $ IOGRSQLiteSelectLayer#BaseTestCapability(78f035161ffa9fe2).(const char *) const = 0; |
| 292 | virtual OGRErr BaseGetExtentcxx . . $ IOGRSQLiteSelectLayer#BaseGetExtent(ee9c866093418aa0).(int iGeomField, OGREnvelope *psExtent, |
| 293 | bool bForce) = 0; |
| 294 | virtual bool ValidateGeometryFieldIndexForSetSpatialFiltercxx . . $ IOGRSQLiteSelectLayer#ValidateGeometryFieldIndexForSetSpatialFilter(3e8b6914492ea0ea).( |
| 295 | int iGeomField, const OGRGeometrycxx . . $ OGRGeometry# *poGeomIn, bool bIsSelectLayer) = 0; |
| 296 | }; |
| 297 | |
| 298 | /************************************************************************/ |
| 299 | /* OGRSQLiteSelectLayerCommonBehaviour */ |
| 300 | /************************************************************************/ |
| 301 | |
| 302 | class OGRSQLiteSelectLayerCommonBehaviourcxx . . $ OGRSQLiteSelectLayerCommonBehaviour# final |
| 303 | { |
| 304 | OGRSQLiteBaseDataSourcecxx . . $ OGRSQLiteBaseDataSource# *m_poDScxx . . $ OGRSQLiteSelectLayerCommonBehaviour#m_poDS. = nullptr; |
| 305 | IOGRSQLiteSelectLayercxx . . $ IOGRSQLiteSelectLayer# *m_poLayercxx . . $ OGRSQLiteSelectLayerCommonBehaviour#m_poLayer. = nullptr; |
| 306 | |
| 307 | CPLString m_osSQLBasecxx . . $ OGRSQLiteSelectLayerCommonBehaviour#m_osSQLBase.{}; |
| 308 | |
| 309 | bool m_bEmptyLayercxx . . $ OGRSQLiteSelectLayerCommonBehaviour#m_bEmptyLayer. = false; |
| 310 | bool m_bAllowResetReadingEvenIfIndexAtZerocxx . . $ OGRSQLiteSelectLayerCommonBehaviour#m_bAllowResetReadingEvenIfIndexAtZero. = false; |
| 311 | bool m_bSpatialFilterInSQLcxx . . $ OGRSQLiteSelectLayerCommonBehaviour#m_bSpatialFilterInSQL. = true; |
| 312 | |
| 313 | stdcxx . . $ std/::pair<OGRLayercxx . . $ OGRLayer# *, IOGRSQLiteGetSpatialWherecxx . . $ IOGRSQLiteGetSpatialWhere# *> |
| 314 | GetBaseLayercxx . . $ OGRSQLiteSelectLayerCommonBehaviour#GetBaseLayer(c97761bfde786132).(size_t &i) const; |
| 315 | int BuildSQLcxx . . $ OGRSQLiteSelectLayerCommonBehaviour#BuildSQL(b126dc7c1de90089).(); |
| 316 | |
| 317 | CPL_DISALLOW_COPY_ASSIGNcxx . . $ OGRSQLiteSelectLayerCommonBehaviour#(OGRSQLiteSelectLayerCommonBehaviour) |
| 318 | |
| 319 | public: |
| 320 | CPLString m_osSQLCurrentcxx . . $ OGRSQLiteSelectLayerCommonBehaviour#m_osSQLCurrent.{}; |
| 321 | |
| 322 | OGRSQLiteSelectLayerCommonBehaviourcxx . . $ OGRSQLiteSelectLayerCommonBehaviour#OGRSQLiteSelectLayerCommonBehaviour(819bbaa2de7a04a8).(OGRSQLiteBaseDataSourcecxx . . $ OGRSQLiteBaseDataSource# *poDS, |
| 323 | IOGRSQLiteSelectLayercxx . . $ IOGRSQLiteSelectLayer# *poBaseLayer, |
| 324 | const CPLString &osSQL, |
| 325 | bool bEmptyLayer); |
| 326 | |
| 327 | void ResetReadingcxx . . $ OGRSQLiteSelectLayerCommonBehaviour#ResetReading(49f6e7a06ebc5aa8).(); |
| 328 | OGRFeaturecxx . . $ OGRFeature# *GetNextFeaturecxx . . $ OGRSQLiteSelectLayerCommonBehaviour#GetNextFeature(ec9eceddec1d9563).(); |
| 329 | GIntBigcxx . . $ GIntBig# GetFeatureCountcxx . . $ OGRSQLiteSelectLayerCommonBehaviour#GetFeatureCount(9ccc33c3ebad048d).(int); |
| 330 | OGRErr SetSpatialFiltercxx . . $ OGRSQLiteSelectLayerCommonBehaviour#SetSpatialFilter(896393ecef503097).(int iGeomField, const OGRGeometrycxx . . $ OGRGeometry# *); |
| 331 | OGRErr SetAttributeFiltercxx . . $ OGRSQLiteSelectLayerCommonBehaviour#SetAttributeFilter(5c4306d8553b3696).(const char *); |
| 332 | int TestCapabilitycxx . . $ OGRSQLiteSelectLayerCommonBehaviour#TestCapability(78f035161ffa9fe2).(const char *) const; |
| 333 | OGRErr GetExtentcxx . . $ OGRSQLiteSelectLayerCommonBehaviour#GetExtent(ee9c866093418aa0).(int iGeomField, OGREnvelope *psExtent, bool bForce); |
| 334 | }; |
| 335 | |
| 336 | /************************************************************************/ |
| 337 | /* OGRSQLiteSingleFeatureLayer */ |
| 338 | /************************************************************************/ |
| 339 | |
| 340 | class OGRSQLiteSingleFeatureLayercxx . . $ OGRSQLiteSingleFeatureLayer# final : public OGRLayercxx . . $ OGRLayer# |
| 341 | { |
| 342 | private: |
| 343 | int nValcxx . . $ OGRSQLiteSingleFeatureLayer#nVal.; |
| 344 | char *pszValcxx . . $ OGRSQLiteSingleFeatureLayer#pszVal.; |
| 345 | OGRFeatureDefncxx . . $ OGRFeatureDefn# *poFeatureDefncxx . . $ OGRSQLiteSingleFeatureLayer#poFeatureDefn.; |
| 346 | int iNextShapeIdcxx . . $ OGRSQLiteSingleFeatureLayer#iNextShapeId.; |
| 347 | |
| 348 | CPL_DISALLOW_COPY_ASSIGNcxx . . $ OGRSQLiteSingleFeatureLayer#OGRSQLiteSingleFeatureLayer(38ea5afa34008e1).(OGRSQLiteSingleFeatureLayer) |
| 349 | |
| 350 | public: |
| 351 | OGRSQLiteSingleFeatureLayercxx . . $ OGRSQLiteSingleFeatureLayer#OGRSQLiteSingleFeatureLayer(34d26762b42c433a).(const char *pszLayerName, int nVal); |
| 352 | OGRSQLiteSingleFeatureLayercxx . . $ OGRSQLiteSingleFeatureLayer#OGRSQLiteSingleFeatureLayer(2fa786934fe80e24).(const char *pszLayerName, const char *pszVal); |
| 353 | ~cxx . . $ OGRSQLiteSingleFeatureLayer#`~OGRSQLiteSingleFeatureLayer`(ced63f7c635d850d).OGRSQLiteSingleFeatureLayercxx . . $ OGRSQLiteSingleFeatureLayer#() override; |
| 354 | |
| 355 | void ResetReadingcxx . . $ OGRSQLiteSingleFeatureLayer#ResetReading(49f6e7a06ebc5aa8).() override; |
| 356 | OGRFeaturecxx . . $ OGRFeature# *GetNextFeaturecxx . . $ OGRSQLiteSingleFeatureLayer#GetNextFeature(ec9eceddec1d9563).() override; |
| 357 | const OGRFeatureDefncxx . . $ OGRFeatureDefn# *GetLayerDefncxx . . $ OGRSQLiteSingleFeatureLayer#GetLayerDefn(448b209f43d15bcc).() const override; |
| 358 | int TestCapabilitycxx . . $ OGRSQLiteSingleFeatureLayer#TestCapability(78f035161ffa9fe2).(const char *) const override; |
| 359 | }; |
| 360 | |
| 361 | /************************************************************************/ |
| 362 | /* Functions */ |
| 363 | /************************************************************************/ |
| 364 | |
| 365 | OGRErr OGRSQLiteGetSpatialiteGeometryHeadercxx . . $ OGRSQLiteGetSpatialiteGeometryHeader(4f4937f1eb59c564).(const GBytecxx . . $ GByte# *pabyData, int nBytes, |
| 366 | int *pnSRID, |
| 367 | OGRwkbGeometryType *peType, |
| 368 | bool *pbIsEmpty, double *pdfMinX, |
| 369 | double *pdfMinY, double *pdfMaxX, |
| 370 | double *pdfMaxY); |
| 371 | // CPL_DLL just for spatialite_geom_import_fuzzer |
| 372 | OGRErr CPL_DLLcxx . . $ `port/cpl_port.h:295:9`! OGRSQLiteImportSpatiaLiteGeometrycxx . . $ OGRSQLiteImportSpatiaLiteGeometry(5f689a382454ef53).(const GBytecxx . . $ GByte# *, int, |
| 373 | OGRGeometrycxx . . $ OGRGeometry# **, |
| 374 | int *pnSRID = nullptr); |
| 375 | OGRErr OGRSQLiteExportSpatiaLiteGeometrycxx . . $ OGRSQLiteExportSpatiaLiteGeometry(e1962a0cd4885216).(const OGRGeometrycxx . . $ OGRGeometry# *, GInt32cxx . . $ GInt32#, |
| 376 | OGRwkbByteOrder, bool bSpatialite2D, |
| 377 | bool bUseComprGeom, GBytecxx . . $ GByte# **, int *); |
| 378 | #endif // OGR_SQLITE_BASE_H_INCLUDED |