Select to view content in your preferred language

DATE queries crash

4972
3
01-06-2014 12:32 PM
PaulAustin
Regular Contributor
A query with a date such as the following crash applications. Mac OS X Mavericks. Haven't tested on windows.

SELECT OBJECTID FROM TABLE WHERE DATE_FIELD < date '2013-09-01'

C  [libsystem_c.dylib+0x5b6dd]  strtok_r+0x66
C  [libfgdbunixrtl.dylib+0x5d8c]  _Z13GetLocaleInfojjPwi+0x50c
C  [libfgdbunixrtl.dylib+0x1fa31]  _Z14VarDateFromStrPwjjPd+0xe1
C  [libfgdbunixrtl.dylib+0x26190]  _Z19VariantChangeTypeExP10tagVARIANTS0_jtt+0x3130
C  [libFileGDBAPI.dylib+0x86f67]  _ZN6SqlLex7GetDateEPPwRiRdS0_+0x237
C  [libFileGDBAPI.dylib+0x89cc6]  _ZN8SqlParse12ParseLiteralEPPwRiRP7SqlNodeS0_+0x11c
C  [libFileGDBAPI.dylib+0x8a7d8]  _ZN8SqlParse12ParsePrimaryEPPwRiRP7SqlNodeS0_b+0x3a
C  [libFileGDBAPI.dylib+0x8bfb8]  _ZN8SqlParse11ParseFactorEPPwRiRP7SqlNodeS0_b+0x1ee
C  [libFileGDBAPI.dylib+0x8c0fe]  _ZN8SqlParse9ParseTermEPPwRiRP7SqlNodeS0_b+0x4a
C  [libFileGDBAPI.dylib+0x8aa26]  _ZN8SqlParse15ParseExpressionEPPwRiRP7SqlNodeS0_b+0x4a
C  [libFileGDBAPI.dylib+0x8d0e8]  _ZN8SqlParse14ParsePredicateEPPwRiRP7SqlNodeS0_+0x788
C  [libFileGDBAPI.dylib+0x8db3d]  _ZN8SqlParse19ParseBooleanPrimaryEPPwRiRP7SqlNodeS0_+0xb7
C  [libFileGDBAPI.dylib+0x8dd0b]  _ZN8SqlParse18ParseBooleanFactorEPPwRiRP7SqlNodeS0_+0x69
C  [libFileGDBAPI.dylib+0x8de0a]  _ZN8SqlParse16ParseBooleanTermEPPwRiRP7SqlNodeS0_+0x46
C  [libFileGDBAPI.dylib+0x8dbaa]  _ZN8SqlParse20ParseSearchConditionEPPwRiRP7SqlNodeS0_+0x46
C  [libFileGDBAPI.dylib+0x8dae6]  _ZN8SqlParse19ParseBooleanPrimaryEPPwRiRP7SqlNodeS0_+0x60
C  [libFileGDBAPI.dylib+0x8dd0b]  _ZN8SqlParse18ParseBooleanFactorEPPwRiRP7SqlNodeS0_+0x69
C  [libFileGDBAPI.dylib+0x8de0a]  _ZN8SqlParse16ParseBooleanTermEPPwRiRP7SqlNodeS0_+0x46
C  [libFileGDBAPI.dylib+0x8dbaa]  _ZN8SqlParse20ParseSearchConditionEPPwRiRP7SqlNodeS0_+0x46
C  [libFileGDBAPI.dylib+0x8df21]  _ZN8SqlParse10ParseWhereEPPwRiRP12SqlNodeWhereS0_+0x1f
C  [libFileGDBAPI.dylib+0x8af1b]  _ZN8SqlParse11ParseSelectEPPwRiRP12SqlStatementS0_+0x10d
C  [libFileGDBAPI.dylib+0x8f064]  _ZN8SqlParse14ParseStatementEPPwRiRP12SqlStatementS0_+0x34
C  [libFileGDBAPI.dylib+0x8f19d]  _ZN8SqlParse17ParseSqlStatementERK6StringPP12SqlStatement+0x53
C  [libFileGDBAPI.dylib+0xf1c5b]  _ZN10SqlCommand14CreateInstanceEP7CatalogRK6StringPPS_+0x3b
C  [libFileGDBAPI.dylib+0x1610]  _ZNK10FileGDBAPI11Geodatabase10ExecuteSQLERKSbIwSt11char_traitsIwESaIwEEbRNS_8EnumRowsE+0x5c
C  [libEsriFileGdbJni-x86_64-macosx.dylib+0x2b76b]  _ZL28FileGDBAPI_Geodatabase_queryPN10FileGDBAPI11GeodatabaseERKSbIwSt11char_traitsIwESaIwEEb+0x6b
C
3 Replies
LanceShipman
Esri Regular Contributor
The query works as expected on Windows. I'll enter a bug and we will verify that it is working with Mac OS X Mavericks in the next release.
0 Kudos
RavenKopelman
Deactivated User

Hi Lance, is this still under investigation?  I'm happy to provide more details if it helps.

0 Kudos
RavenKopelman
Deactivated User

As of 1.4 the crash still appears on Linux (Ubuntu 14.04).  Here is a simple repro application:

#include <FileGDBAPI.h>

int main(int, char**)

{

  FileGDBAPI::Geodatabase geodb;

  fgdbError result = FileGDBAPI::OpenGeodatabase(L"seed.gdb", geodb);

  if (FAILED(result))

  {

      printf("Error: FileGDBAPI::OpenGeodatabase(L\"seed.gdb\", geodb)\n");

      return 1;

  }

  FileGDBAPI::Table currTable;

  result = geodb.OpenTable(L"\\update_by_match_columns", currTable);

  if (FAILED(result))

  {

      printf("Error: geodb.OpenTable(L\"\\\\update_by_match_columns\", currTable)\n");

      return 1;

  }

  FileGDBAPI::EnumRows currRows;

  result = currTable.Search(L"*", L"date_attr = DATE '2015-01-01 00:00:00'", true, currRows);

  return 0;

}

#0 strtok () at ../sysdeps/x86_64/strtok.S:186

#1 0x00007fa703aa0581 in GetLocaleInfo(unsigned int, unsigned int, wchar_t*, int) () from /git/fme-1/install/fmecore/libfgdbunixrtl.so

#2 0x00007fa703ad0450 in VarDateFromStr(wchar_t*, unsigned int, unsigned int, double*) () from /git/fme-1/install/fmecore/libfgdbunixrtl.so

#3 0x00007fa703ad54d4 in VariantChangeTypeEx(tagVARIANT*, tagVARIANT*, unsigned int, unsigned short, unsigned short) ()

  from /git/fme-1/install/fmecore/libfgdbunixrtl.so

#4 0x00007fa704a37bbd in SqlLex::GetDatetime(wchar_t**, int&, double&, wchar_t*, esriSQLDatetimeType&) () from /git/fme-1/install/fmecore/libFileGDBAPI.so

#5 0x00007fa704a38126 in SqlParse::ParseLiteral(wchar_t**, int&, SqlNode*&, wchar_t*) () from /git/fme-1/install/fmecore/libFileGDBAPI.so

#6 0x00007fa704a3b740 in SqlParse::ParsePrimary(wchar_t**, int&, SqlNode*&, wchar_t*) () from /git/fme-1/install/fmecore/libFileGDBAPI.so

#7 0x00007fa704a3ba2d in SqlParse::ParseFactor(wchar_t**, int&, SqlNode*&, wchar_t*) () from /git/fme-1/install/fmecore/libFileGDBAPI.so

#8 0x00007fa704a3bd7f in SqlParse::ParseTerm(wchar_t**, int&, SqlNode*&, wchar_t*) () from /git/fme-1/install/fmecore/libFileGDBAPI.so

#9 0x00007fa704a3c0ff in SqlParse::ParseExpression(wchar_t**, int&, SqlNode*&, wchar_t*) () from /git/fme-1/install/fmecore/libFileGDBAPI.so

#10 0x00007fa704a3e69d in SqlParse::ParsePredicate(wchar_t**, int&, SqlNode*&, wchar_t*) () from /git/fme-1/install/fmecore/libFileGDBAPI.so

#11 0x00007fa704a3f6f9 in SqlParse::ParseBooleanPrimary(wchar_t**, int&, SqlNode*&, wchar_t*) () from /git/fme-1/install/fmecore/libFileGDBAPI.so

#12 0x00007fa704a3f7e7 in SqlParse::ParseBooleanFactor(wchar_t**, int&, SqlNode*&, wchar_t*) () from /git/fme-1/install/fmecore/libFileGDBAPI.so

#13 0x00007fa704a3f91f in SqlParse::ParseBooleanTerm(wchar_t**, int&, SqlNode*&, wchar_t*) () from /git/fme-1/install/fmecore/libFileGDBAPI.so

#14 0x00007fa704a3faa1 in SqlParse::ParseSearchCondition(wchar_t**, int&, SqlNode*&, wchar_t*) () from /git/fme-1/install/fmecore/libFileGDBAPI.so

#15 0x00007fa704a3fbec in SqlParse::ParseWhere(wchar_t**, int&, SqlNodeWhere*&, wchar_t*) () from /git/fme-1/install/fmecore/libFileGDBAPI.so

#16 0x00007fa704a3da9e in SqlParse::ParseSelect(wchar_t**, int&, SqlStatement*&, wchar_t*) () from /git/fme-1/install/fmecore/libFileGDBAPI.so

#17 0x00007fa704a40461 in SqlParse::ParseStatement(wchar_t**, int&, SqlStatement*&, wchar_t*) () from /git/fme-1/install/fmecore/libFileGDBAPI.so

#18 0x00007fa704a40602 in SqlParse::ParseSqlStatement(String const&, SqlStatement**) () from /git/fme-1/install/fmecore/libFileGDBAPI.so

#19 0x00007fa704af9a67 in SqlCommand::CreateInstance(Catalog*, String const&, SqlCommand**) () from /git/fme-1/install/fmecore/libFileGDBAPI.so

#20 0x00007fa704988442 in FileGDBAPI::Geodatabase::ExecuteSQL(std::basic_string wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, bool, FileGDBAPI::EnumRows&) const () from /git/fme-1/install/fmecore/libFileGDBAPI.so

#21 0x00007fa704998669 in FileGDBAPI::Table::Search(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, bool, FileGDBAPI::EnumRows&) () from /git/fme-1/install/fmecore/libFileGDBAPI.so

#22 0x0000000000400cf0 in main ()

  at ../../formats/filegdb/repro/strtok_crash.cpp:23

0 Kudos