Debian Codegraph @

ogr/ogrsf_frmts/oci/ogrocidrivercore.cpp

raw
1 /******************************************************************************
2 *
3 * Project: Oracle Spatial Driver
4 * Purpose: Implementation of the OGROCIDriver class.
5 * Author: Frank Warmerdam, [email protected]
6 *
7 ******************************************************************************
8 * Copyright (c) 2002, Frank Warmerdam <[email protected]>
9 *
10 * SPDX-License-Identifier: MIT
11 ****************************************************************************/
12
13 #include "gdal_frmts.h"
14
15 #ifdef PLUGIN_FILENAME
16 #include "gdalplugindriverproxy.h"
17 #endif
18
19 #include "ogrsf_frmts.h"
20
21 #include "ogrocidrivercore.h"
22
23 /************************************************************************/
24 /* OGROCIDriverIdentify() */
25 /************************************************************************/
26
27 int OGROCIDriverIdentify(GDALOpenInfo *poOpenInfo)
28
29 {
30 return STARTS_WITH_CI(poOpenInfo->pszFilename, "OCI:");
31 }
32
33 /************************************************************************/
34 /* OGROCIDriverSetCommonMetadata() */
35 /************************************************************************/
36
37 void OGROCIDriverSetCommonMetadata(GDALDriver *poDriver)
38 {
39 poDriver->SetDescription(DRIVER_NAME);
40 poDriver->SetMetadataItem(GDAL_DMD_LONGNAME, "Oracle Spatial");
41 poDriver->SetMetadataItem(GDAL_DMD_HELPTOPIC, "drivers/vector/oci.html");
42 poDriver->SetMetadataItem(GDAL_DCAP_VECTOR, "YES");
43 poDriver->SetMetadataItem(GDAL_DCAP_CREATE_LAYER, "YES");
44 poDriver->SetMetadataItem(GDAL_DCAP_DELETE_LAYER, "YES");
45 poDriver->SetMetadataItem(GDAL_DCAP_CREATE_FIELD, "YES");
46 poDriver->SetMetadataItem(GDAL_DCAP_Z_GEOMETRIES, "YES");
47 poDriver->SetMetadataItem(GDAL_DMD_CONNECTION_PREFIX, "OCI:");
48 poDriver->SetMetadataItem(
49 GDAL_DMD_OPENOPTIONLIST,
50 "<OpenOptionList>"
51 " <Option name='DBNAME' type='string' description='Database name'/>"
52 " <Option name='USER' type='string' description='User name'/>"
53 " <Option name='PASSWORD' type='string' description='Password'/>"
54 " <Option name='TABLES' type='string' description='Restricted set of "
55 "tables to list (comma separated)'/>"
56 " <Option name='WORKSPACE' type='string' description='Workspace'/>"
57 " <Option name='MULTI_LOAD' type='boolean' description='If enabled "
58 "new features will be created in groups of 100 per SQL INSERT command' "
59 "default='YES'/>"
60 " <Option name='MULTI_LOAD_COUNT' type='int' description='Number of "
61 "items for a group INSERT' default='100'/>"
62 " <Option name='FIRST_ID' type='int' description='First id value to "
63 "be used on append'/>"
64 "</OpenOptionList>");
65
66 poDriver->SetMetadataItem(
67 GDAL_DS_LAYER_CREATIONOPTIONLIST,
68 "<LayerCreationOptionList>"
69 " <Option name='LAUNDER' type='boolean' description='Whether layer "
70 "and field names will be laundered' default='NO'/>"
71 " <Option name='PRECISION' type='boolean' description='Whether fields "
72 "created should keep the width and precision' default='YES'/>"
73 " <Option name='OVERWRITE' type='boolean' description='Whether to "
74 "overwrite an existing table with the layer name to be created' "
75 "default='NO'/>"
76 " <Option name='TRUNCATE' type='boolean' description='Whether to "
77 "truncate an existing table' default='NO'/>"
78 " <Option name='SPATIAL_INDEX' type='boolean' description='Whether to "
79 "create a spatial index' default='YES' deprecated_alias='INDEX'/>"
80 " <Option name='INDEX_PARAMETERS' type='string' description='Creation "
81 "parameters when the spatial index is created'/>"
82 " <Option name='ADD_LAYER_GTYPE' type='boolean' description='May be "
83 "set to NO to disable the constraints on the geometry type in the "
84 "spatial index' default='YES'/>"
85 " <Option name='MULTI_LOAD' type='boolean' description='If enabled "
86 "new features will be created in groups of 100 per SQL INSERT command' "
87 "default='YES'/>"
88 " <Option name='MULTI_LOAD_COUNT' type='int' description='Number of "
89 "items for a group INSERT' default='100'/>"
90 " <Option name='DEFAULT_STRING_SIZE' type='int' description='Default "
91 "string column size' default='4000'/>"
92 " <Option name='LOADER_FILE' type='string' description='If this "
93 "option is set, all feature information will be written to a file "
94 "suitable for use with SQL*Loader'/>"
95 " <Option name='DIM' type='integer' description='Set to 2 to force "
96 "the geometries to be 2D, or 3 to be 2.5D' default='3'/>"
97 " <Option name='GEOMETRY_NAME' type='string' description='Name of "
98 "geometry column.' default='ORA_GEOMETRY'/>"
99 " <Option name='GEOMETRY_NULLABLE' type='boolean' "
100 "description='Whether the values of the geometry column can be NULL' "
101 "default='YES'/>"
102 " <Option name='DIMINFO_X' type='string' description='xmin,xmax,xres "
103 "values to control the X dimension info written into the "
104 "USER_SDO_GEOM_METADATA table'/>"
105 " <Option name='DIMINFO_Y' type='string' description='ymin,ymax,yres "
106 "values to control the Y dimension info written into the "
107 "USER_SDO_GEOM_METADATA table'/>"
108 " <Option name='DIMINFO_Z' type='string' description='zmin,zmax,zres "
109 "values to control the Z dimension info written into the "
110 "USER_SDO_GEOM_METADATA table'/>"
111 " <Option name='SRID' type='int' description='Forced SRID of the "
112 "layer'/>"
113 " <Option name='FIRST_ID' type='int' description='First id value'/>"
114 " <Option name='NO_LOGGING' type='boolean' description='Create table "
115 "with no_logging parameters' default='NO'/>"
116 " <Option name='TIMESTAMP_WITH_TIME_ZONE' type='boolean' description='"
117 "Whether DateTime fields should be created with TIMESTAMP WITH TIME "
118 "ZONE Oracle type (otherwise without timezone)'/>"
119 "</LayerCreationOptionList>");
120
121 poDriver->SetMetadataItem(GDAL_DMD_CREATIONFIELDDATATYPES,
122 "Integer Integer64 Real String Date DateTime");
123 poDriver->SetMetadataItem(GDAL_DCAP_NOTNULL_FIELDS, "YES");
124 poDriver->SetMetadataItem(GDAL_DCAP_DEFAULT_FIELDS, "YES");
125 poDriver->SetMetadataItem(GDAL_DCAP_NOTNULL_GEOMFIELDS, "YES");
126 poDriver->SetMetadataItem(GDAL_DCAP_MULTIPLE_VECTOR_LAYERS, "YES");
127 poDriver->SetMetadataItem(GDAL_DMD_SUPPORTED_SQL_DIALECTS,
128 "NATIVE OGRSQL SQLITE");
129
130 poDriver->pfnIdentify = OGROCIDriverIdentify;
131 poDriver->SetMetadataItem(GDAL_DCAP_OPEN, "YES");
132 poDriver->SetMetadataItem(GDAL_DCAP_CREATE, "YES");
133
134 poDriver->SetMetadataItem(GDAL_DCAP_UPDATE, "YES");
135 poDriver->SetMetadataItem(GDAL_DMD_UPDATE_ITEMS, "Features");
136 }
137
138 /************************************************************************/
139 /* DeclareDeferredOGROCIPlugin() */
140 /************************************************************************/
141
142 #ifdef PLUGIN_FILENAME
143 void DeclareDeferredOGROCIPlugin()
144 {
145 if (GDALGetDriverByName(DRIVER_NAME) != nullptr)
146 {
147 return;
148 }
149 auto poDriver = new GDALPluginDriverProxy(PLUGIN_FILENAME);
150 #ifdef PLUGIN_INSTALLATION_MESSAGE
151 poDriver->SetMetadataItem(GDAL_DMD_PLUGIN_INSTALLATION_MESSAGE,
152 PLUGIN_INSTALLATION_MESSAGE);
153 #endif
154 OGROCIDriverSetCommonMetadata(poDriver);
155 GetGDALDriverManager()->DeclareDeferredPluginDriver(poDriver);
156 }
157 #endif