Select to view content in your preferred language

Geodatabase::CreateTable and Table::AddField return -2147467259.

4406
8
03-17-2011 09:45 PM
SatoruGUNJI
Esri Contributor
When I tried to create data with Japanese name, Geodatabase::CreateTable returned -2147467259.
I changed values of CatalogPath and Name in samples/TableSchema/Streets.xml into Japanese. And I ran TableSchema project.
I dumped featureClassDef into file with binary mode. The featureClassDef is UTF-8(without BOM). When I tried to use Unicode(UCS-2?), same error code was returned. Table::AddField too.

Does these function support muiti byte(non-English) character?
0 Kudos
8 Replies
LanceShipman
Esri Regular Contributor
When I tried to create data with Japanese name, Geodatabase::CreateTable returned -2147467259.
I changed values of CatalogPath and Name in samples/TableSchema/Streets.xml into Japanese. And I ran TableSchema project.
I dumped featureClassDef into file with binary mode. The featureClassDef is UTF-8(without BOM). When I tried to use Unicode(UCS-2?), same error code was returned. Table::AddField too.

Does these function support muiti byte(non-English) character?


Yes, The CreateTable function does support multibyte characters. Please send me your  XML (lshipman@esri.com).
0 Kudos
SatoruGUNJI
Esri Contributor
Hello lshipman,

Did you test using XML file I had sent?
I tested using File Geodatabase API Beta 3. I could not create data with Japanese name.
0 Kudos
LanceShipman
Esri Regular Contributor
Hello lshipman,

Did you test using XML file I had sent?
I tested using File Geodatabase API Beta 3. I could not create data with Japanese name.


I'm currently testing with your XML file. I'll provide a summary of my findings later today.
0 Kudos
LanceShipman
Esri Regular Contributor
There are two problems. One with the XML. Extent was added as a required tag. It goes just before the SpatialReference. I've included the corrected Streets.xml.

  <LengthFieldName>Shape_Length</LengthFieldName>
  <Extent xsi:nil="true" /> <-- This is new with Beta 3
- <SpatialReference xsi:type="esri:GeographicCoordinateSystem">

With the corrected XML, a file is created, but the name of the table is gibberish.  We have a fix for this which will be in final.
0 Kudos
SatoruGUNJI
Esri Contributor
Thanks!

I found the cause of error.
If the following code exists, Geodatabase::CreateTable function returns -2147467259, when the XML includes Japanese characters.

setlocale(LC_CTYPE, "Japanese");


When I commented out this code, this error was not returned. However, if the locale is not correct, multi-byte character can not be used adequately.
I hope API supports several locales.
0 Kudos
LanceShipman
Esri Regular Contributor
setlocale shouldn't have any effect on the API behavior. With our latest fix I am able to create a table named with Japanese characters without any problems. I don't get an error when I include setlocale or not. We tested on a Japanese locale machine and verified our fix.

The fix will be included in final.
0 Kudos
eykim
by
Emerging Contributor
I'm having a similar issue.

I've modified FeatureDatasets.cpp file in the sample solution to add a field. And this returns the same error number ( -2147467259) and description "General function error." Can you tell me why I'm getting this error?

Thank you.

std::wstring oErrDesc;

std::string oFieldXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
       "<esri:Field xmlns:xsi=\"http://www.w3.org/2001/XMLSchema\" xmlns:esri=\"http://www.esri.com/schemas/ArcGIS/10.1\" xsi:type=\"esri:Field\">" 
       "<Name>StopType2</Name>"
       "<Type>esriFieldTypeSmallInteger</Type>"
       "<IsNullable>true</IsNullable>"
       "<Required>false</Required>"
       "<Editable>true</Editable>"
       "<Length>2</Length>"
       "<Precision>0</Precision>"
       "<Scale>0</Scale>"
       "<AliasName>StopType2</AliasName>"
       "<ModelName>StopType2</ModelName>"
       "</esri:Field>";

    if ((hr = table.AddField(oFieldXML))!= S_OK)
    {
 FileGDBAPI::ErrorInfo::GetErrorDescription(hr, oErrDesc);
    }

0 Kudos
eykim
by
Emerging Contributor
Found out what my problem is: my xml was not correct.

A correct example would be:

std::string oFieldXML =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<esri:Field xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:esri=\"http://www.esri.com/schemas/ArcGIS/10.1\" xsi:type=\"esri:Field\">"
        "<Name>night</Name>"
"<Type>esriFieldTypeString</Type>"
"<IsNullable>true</IsNullable>"
"<Length>256</Length>"
"<Precision>0</Precision>"
"<Scale>0</Scale>"
"<AliasName>day</AliasName>"
"<ModelName>night</ModelName>"
"<DefaultValue xsi:type=\"xs:string\">noon</DefaultValue>"
"</esri:Field>";
0 Kudos