Skip to content

Commit 2d1fabb

Browse files
Fixed bug with Numeric
1 parent 3337706 commit 2d1fabb

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

sqlite3pp_ez.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,7 @@ namespace sqlite3pp
989989
char str[99] = { 0 };
990990
strcpy_s(str, str_org);
991991
_strupr_s(str);
992+
const std::string str_type = str;
992993
// There's no practical method for handling blob or clob other than the Blob and Clob type, so don't even include them in an option to declare them any other way.
993994
if (strcmp("BLOB", str) == 0)
994995
return "Blob";
@@ -1051,9 +1052,9 @@ namespace sqlite3pp
10511052
return "Date";
10521053
if (strcmp("DATETIME", str) == 0)
10531054
return "Datetime";
1054-
if (strcmp("NUMERIC", str) == 0)
1055+
if (str_type.starts_with("NUMERIC"))
10551056
return "Numeric";
1056-
if (strncmp("DECIMAL", str, 7) == 0)
1057+
if (str_type.starts_with("DECIMAL"))
10571058
return "Decimal";
10581059
if (strcmp("REAL", str) == 0)
10591060
return "Real";
@@ -1067,15 +1068,15 @@ namespace sqlite3pp
10671068
// String types
10681069
if (strcmp("TEXT", str) == 0)
10691070
return "Text";
1070-
if (strncmp("CHARACTER", str, 9) == 0)
1071+
if (str_type.starts_with("CHARACTER"))
10711072
return "Character";
1072-
if (strncmp("VARYING CHARACTER", str, 17) == 0
1073-
|| strncmp("VARCHAR", str, 7) == 0)
1073+
if (str_type.starts_with("VARYING CHARACTER")
1074+
|| str_type.starts_with("VARCHAR"))
10741075
return "Varchar";
1075-
if (strncmp("NATIVE CHARACTER", str, 16) == 0
1076-
|| strncmp("NCHAR", str, 5) == 0)
1076+
if (str_type.starts_with("NATIVE CHARACTER")
1077+
|| str_type.starts_with("NCHAR"))
10771078
return "Nchar";
1078-
if (strncmp("NVARCHAR", str, 8) == 0)
1079+
if (str_type.starts_with("NVARCHAR"))
10791080
return "Nvarchar";
10801081
}
10811082

0 commit comments

Comments
 (0)