So currently I am trying to work on having the same table within several different datasets as a structure similar to the following.
GdbManagement.gdb
--CA_CANADA (dataset)
----Polygon (table)
----Polyline (table)
----Multipoint (table)
--GB_UNITED_KINGDOM (dataset)
----Polygon (table)
----Polyline (table)
----Multipoint (table)
... and so on.
The three tables are true duplicates at creation, but eventually will contain different data, but I am having a problem with creating the same table in a different dataset. I have tried to close and open on each iteration, define the table once, and shorting the name, which all have failed. So I am looking for some help to get past this issue. Any help is appreciated.
Current code I am using for testing (the single table is just a test that it doesn't currently create the table a second time).
<SPAN class="keyword token">using</SPAN> <SPAN class="keyword token">namespace</SPAN> std<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">using</SPAN> <SPAN class="keyword token">namespace</SPAN> FileGDBAPI<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">int</SPAN> <SPAN class="token function">main</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
fgdbError hr<SPAN class="punctuation token">;</SPAN>
wstring errorText<SPAN class="punctuation token">;</SPAN>
Geodatabase geodatabase<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">(</SPAN>hr <SPAN class="operator token">=</SPAN> <SPAN class="token function">CreateGeodatabase</SPAN><SPAN class="punctuation token">(</SPAN>L<SPAN class="string token">"../GeodatabaseManagement/GdbManagement.gdb"</SPAN><SPAN class="punctuation token">,</SPAN> geodatabase<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">!=</SPAN> S_OK<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
wcout <SPAN class="operator token"><<</SPAN> <SPAN class="string token">"An error occurred while creating the geodatabase."</SPAN> <SPAN class="operator token"><<</SPAN> endl<SPAN class="punctuation token">;</SPAN>
ErrorInfo<SPAN class="operator token">::</SPAN><SPAN class="token function">GetErrorDescription</SPAN><SPAN class="punctuation token">(</SPAN>hr<SPAN class="punctuation token">,</SPAN> errorText<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
wcout <SPAN class="operator token"><<</SPAN> errorText <SPAN class="operator token"><<</SPAN> <SPAN class="string token">"("</SPAN> <SPAN class="operator token"><<</SPAN> hr <SPAN class="operator token"><<</SPAN> <SPAN class="string token">")."</SPAN> <SPAN class="operator token"><<</SPAN> endl<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">return</SPAN> <SPAN class="operator token">-</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="token function">CloseGeodatabase</SPAN><SPAN class="punctuation token">(</SPAN>geodatabase<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
SpatialReference spatialReference<SPAN class="punctuation token">;</SPAN>
spatialReference<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetSpatialReferenceID</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="number token">4326</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
spatialReference<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetSpatialReferenceText</SPAN><SPAN class="punctuation token">(</SPAN>L<SPAN class="string token">"GEOGCS[\"WGS84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]]"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
string inCountries<SPAN class="punctuation token">[</SPAN><SPAN class="number token">5</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="string token">"CA_CANADA"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"GB_UNITED_KINGDOM"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"US_UNITED_STATES"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"JA_JAPAN"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"CN_CHINA"</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">// Create the geometryDef</SPAN>
GeometryDef geometryDef<SPAN class="punctuation token">;</SPAN>
geometryDef<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetGeometryType</SPAN><SPAN class="punctuation token">(</SPAN>geometryPolyline<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
geometryDef<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetSpatialReference</SPAN><SPAN class="punctuation token">(</SPAN>spatialReference<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
geometryDef<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetHasZ</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="token boolean">false</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">//Set to true if the feature class is to be Z enabled. Defaults to FALSE.</SPAN>
geometryDef<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetHasM</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="token boolean">false</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">//Set to true if the feature class is to be M enabled. Defaults to FALSE.</SPAN>
<SPAN class="comment token">// Create the field def for the table.</SPAN>
std<SPAN class="operator token">::</SPAN>vector<SPAN class="operator token"><</SPAN>FieldDef<SPAN class="operator token">></SPAN> fieldDefs<SPAN class="punctuation token">;</SPAN>
FieldDef fieldDef1<SPAN class="punctuation token">;</SPAN>
fieldDef1<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetName</SPAN><SPAN class="punctuation token">(</SPAN>L<SPAN class="string token">"OBJECTID"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
fieldDef1<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetType</SPAN><SPAN class="punctuation token">(</SPAN>fieldTypeOID<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
fieldDef1<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetIsNullable</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="token boolean">false</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
fieldDefs<SPAN class="punctuation token">.</SPAN><SPAN class="token function">push_back</SPAN><SPAN class="punctuation token">(</SPAN>fieldDef1<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
FieldDef fieldDef2<SPAN class="punctuation token">;</SPAN>
fieldDef2<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetName</SPAN><SPAN class="punctuation token">(</SPAN>L<SPAN class="string token">"Shape"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
fieldDef2<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetType</SPAN><SPAN class="punctuation token">(</SPAN>fieldTypeGeometry<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
fieldDef2<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetIsNullable</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="token boolean">true</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
fieldDef2<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetGeometryDef</SPAN><SPAN class="punctuation token">(</SPAN>geometryDef<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
fieldDefs<SPAN class="punctuation token">.</SPAN><SPAN class="token function">push_back</SPAN><SPAN class="punctuation token">(</SPAN>fieldDef2<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
FieldDef fieldDef3<SPAN class="punctuation token">;</SPAN>
fieldDef3<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetName</SPAN><SPAN class="punctuation token">(</SPAN>L<SPAN class="string token">"StopID"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
fieldDef3<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetType</SPAN><SPAN class="punctuation token">(</SPAN>fieldTypeInteger<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
fieldDef3<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetIsNullable</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="token boolean">true</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
fieldDef3<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetAlias</SPAN><SPAN class="punctuation token">(</SPAN>L<SPAN class="string token">"Stop Identifier"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
fieldDefs<SPAN class="punctuation token">.</SPAN><SPAN class="token function">push_back</SPAN><SPAN class="punctuation token">(</SPAN>fieldDef3<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
FieldDef fieldDef4<SPAN class="punctuation token">;</SPAN>
fieldDef4<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetName</SPAN><SPAN class="punctuation token">(</SPAN>L<SPAN class="string token">"StopType"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
fieldDef4<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetType</SPAN><SPAN class="punctuation token">(</SPAN>fieldTypeSmallInteger<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
fieldDef4<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetIsNullable</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="token boolean">true</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
fieldDefs<SPAN class="punctuation token">.</SPAN><SPAN class="token function">push_back</SPAN><SPAN class="punctuation token">(</SPAN>fieldDef4<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
FieldDef fieldDef5<SPAN class="punctuation token">;</SPAN>
fieldDef5<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetName</SPAN><SPAN class="punctuation token">(</SPAN>L<SPAN class="string token">"Test_Value"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
fieldDef5<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetType</SPAN><SPAN class="punctuation token">(</SPAN>fieldTypeString<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
fieldDef5<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetIsNullable</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="token boolean">true</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
fieldDef5<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetAlias</SPAN><SPAN class="punctuation token">(</SPAN>L<SPAN class="string token">"This is a test"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
fieldDef5<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetLength</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="number token">4000</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
fieldDefs<SPAN class="punctuation token">.</SPAN><SPAN class="token function">push_back</SPAN><SPAN class="punctuation token">(</SPAN>fieldDef5<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">for</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">int</SPAN> i <SPAN class="operator token">=</SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">;</SPAN> i <SPAN class="operator token"><</SPAN> <SPAN class="number token">5</SPAN><SPAN class="punctuation token">;</SPAN> i<SPAN class="operator token">++</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">(</SPAN>hr <SPAN class="operator token">=</SPAN> <SPAN class="token function">OpenGeodatabase</SPAN><SPAN class="punctuation token">(</SPAN>L<SPAN class="string token">"../GeodatabaseManagement/GdbManagement.gdb"</SPAN><SPAN class="punctuation token">,</SPAN> geodatabase<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">!=</SPAN> S_OK<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
wcout <SPAN class="operator token"><<</SPAN> <SPAN class="string token">"An error occurred while opening the geodatabase."</SPAN> <SPAN class="operator token"><<</SPAN> endl<SPAN class="punctuation token">;</SPAN>
ErrorInfo<SPAN class="operator token">::</SPAN><SPAN class="token function">GetErrorDescription</SPAN><SPAN class="punctuation token">(</SPAN>hr<SPAN class="punctuation token">,</SPAN> errorText<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
wcout <SPAN class="operator token"><<</SPAN> errorText <SPAN class="operator token"><<</SPAN> <SPAN class="string token">"("</SPAN> <SPAN class="operator token"><<</SPAN> hr <SPAN class="operator token"><<</SPAN> <SPAN class="string token">")."</SPAN> <SPAN class="operator token"><<</SPAN> endl<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">return</SPAN> <SPAN class="operator token">-</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
string country <SPAN class="operator token">=</SPAN> <SPAN class="string token">"\\"</SPAN> <SPAN class="operator token">+</SPAN> inCountries<SPAN class="punctuation token">[</SPAN>i<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">;</SPAN>
wstring wide_string <SPAN class="operator token">=</SPAN> <SPAN class="token function">wstring</SPAN><SPAN class="punctuation token">(</SPAN>country<SPAN class="punctuation token">.</SPAN><SPAN class="token function">begin</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> country<SPAN class="punctuation token">.</SPAN><SPAN class="token function">end</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">const</SPAN> <SPAN class="keyword token">wchar_t</SPAN><SPAN class="operator token">*</SPAN> result <SPAN class="operator token">=</SPAN> wide_string<SPAN class="punctuation token">.</SPAN><SPAN class="token function">c_str</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">(</SPAN>hr <SPAN class="operator token">=</SPAN> geodatabase<SPAN class="punctuation token">.</SPAN><SPAN class="token function">CreateFeatureDataset</SPAN><SPAN class="punctuation token">(</SPAN>result<SPAN class="punctuation token">,</SPAN> spatialReference<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">!=</SPAN> S_OK<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
wcout <SPAN class="operator token"><<</SPAN> <SPAN class="string token">"An error occurred while creating the geodatabase!"</SPAN> <SPAN class="operator token"><<</SPAN> endl<SPAN class="punctuation token">;</SPAN>
ErrorInfo<SPAN class="operator token">::</SPAN><SPAN class="token function">GetErrorDescription</SPAN><SPAN class="punctuation token">(</SPAN>hr<SPAN class="punctuation token">,</SPAN> errorText<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
wcout <SPAN class="operator token"><<</SPAN> errorText <SPAN class="operator token"><<</SPAN> <SPAN class="string token">"("</SPAN> <SPAN class="operator token"><<</SPAN> hr <SPAN class="operator token"><<</SPAN> <SPAN class="string token">")."</SPAN> <SPAN class="operator token"><<</SPAN> endl<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">return</SPAN> <SPAN class="operator token">-</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="comment token">// Create the table.</SPAN>
Table table<SPAN class="punctuation token">;</SPAN>
country <SPAN class="operator token">=</SPAN> <SPAN class="string token">"\\"</SPAN> <SPAN class="operator token">+</SPAN> inCountries<SPAN class="punctuation token">[</SPAN>i<SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">+</SPAN> <SPAN class="string token">"\\Test"</SPAN><SPAN class="punctuation token">;</SPAN>
wide_string <SPAN class="operator token">=</SPAN> <SPAN class="token function">wstring</SPAN><SPAN class="punctuation token">(</SPAN>country<SPAN class="punctuation token">.</SPAN><SPAN class="token function">begin</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> country<SPAN class="punctuation token">.</SPAN><SPAN class="token function">end</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
result <SPAN class="operator token">=</SPAN> wide_string<SPAN class="punctuation token">.</SPAN><SPAN class="token function">c_str</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">(</SPAN>hr <SPAN class="operator token">=</SPAN> geodatabase<SPAN class="punctuation token">.</SPAN><SPAN class="token function">CreateTable</SPAN><SPAN class="punctuation token">(</SPAN>result<SPAN class="punctuation token">,</SPAN> fieldDefs<SPAN class="punctuation token">,</SPAN> L<SPAN class="string token">"DEFAULTS"</SPAN><SPAN class="punctuation token">,</SPAN> table<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">!=</SPAN> S_OK<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
wcout <SPAN class="operator token"><<</SPAN> <SPAN class="string token">"An error occurred while creating the table."</SPAN> <SPAN class="operator token"><<</SPAN> endl<SPAN class="punctuation token">;</SPAN>
ErrorInfo<SPAN class="operator token">::</SPAN><SPAN class="token function">GetErrorDescription</SPAN><SPAN class="punctuation token">(</SPAN>hr<SPAN class="punctuation token">,</SPAN> errorText<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
wcout <SPAN class="operator token"><<</SPAN> errorText <SPAN class="operator token"><<</SPAN> <SPAN class="string token">"("</SPAN> <SPAN class="operator token"><<</SPAN> hr <SPAN class="operator token"><<</SPAN> <SPAN class="string token">")."</SPAN> <SPAN class="operator token"><<</SPAN> endl<SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">//return -1;</SPAN>
<SPAN class="punctuation token">}</SPAN>
wcout <SPAN class="operator token"><<</SPAN> <SPAN class="string token">"The table has been created."</SPAN> <SPAN class="operator token"><<</SPAN> endl<SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">//Compact the geodatabase.Recomended after bulk updates.</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">(</SPAN>hr <SPAN class="operator token">=</SPAN> geodatabase<SPAN class="punctuation token">.</SPAN><SPAN class="token function">CompactDatabase</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">!=</SPAN> S_OK<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
wcout <SPAN class="operator token"><<</SPAN> <SPAN class="string token">"An error occurred while compacting the geodatabase."</SPAN> <SPAN class="operator token"><<</SPAN> endl<SPAN class="punctuation token">;</SPAN>
ErrorInfo<SPAN class="operator token">::</SPAN><SPAN class="token function">GetErrorDescription</SPAN><SPAN class="punctuation token">(</SPAN>hr<SPAN class="punctuation token">,</SPAN> errorText<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
wcout <SPAN class="operator token"><<</SPAN> errorText <SPAN class="operator token"><<</SPAN> <SPAN class="string token">"("</SPAN> <SPAN class="operator token"><<</SPAN> hr <SPAN class="operator token"><<</SPAN> <SPAN class="string token">")."</SPAN> <SPAN class="operator token"><<</SPAN> endl<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">return</SPAN> <SPAN class="operator token">-</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="comment token">// Close the geodatabase before the delete.</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">(</SPAN>hr <SPAN class="operator token">=</SPAN> <SPAN class="token function">CloseGeodatabase</SPAN><SPAN class="punctuation token">(</SPAN>geodatabase<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">!=</SPAN> S_OK<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
wcout <SPAN class="operator token"><<</SPAN> <SPAN class="string token">"An error occurred while closing the geodatabase."</SPAN> <SPAN class="operator token"><<</SPAN> endl<SPAN class="punctuation token">;</SPAN>
ErrorInfo<SPAN class="operator token">::</SPAN><SPAN class="token function">GetErrorDescription</SPAN><SPAN class="punctuation token">(</SPAN>hr<SPAN class="punctuation token">,</SPAN> errorText<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
wcout <SPAN class="operator token"><<</SPAN> errorText <SPAN class="operator token"><<</SPAN> <SPAN class="string token">"("</SPAN> <SPAN class="operator token"><<</SPAN> hr <SPAN class="operator token"><<</SPAN> <SPAN class="string token">")."</SPAN> <SPAN class="operator token"><<</SPAN> endl<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">return</SPAN> <SPAN class="operator token">-</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="keyword token">return</SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>