aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/build.c17
-rw-r--r--src/global.c5
-rw-r--r--src/sqliteInt.h13
-rw-r--r--src/vdbe.c2
4 files changed, 24 insertions, 13 deletions
diff --git a/src/build.c b/src/build.c
index b80eef8dc..f2b3d2544 100644
--- a/src/build.c
+++ b/src/build.c
@@ -2606,12 +2606,19 @@ void sqlite3EndTable(
p->tabFlags |= TF_Strict;
for(ii=0; ii<p->nCol; ii++){
Column *pCol = &p->aCol[ii];
- if( pCol->eCType==COLTYPE_CUSTOM && pCol->colFlags & COLFLAG_HASTYPE ){
- sqlite3ErrorMsg(pParse,
- "unknown datatype for %s.%s: \"%s\"",
- p->zName, pCol->zCnName, sqlite3ColumnType(pCol, "")
- );
+ if( pCol->eCType==COLTYPE_CUSTOM ){
+ if( pCol->colFlags & COLFLAG_HASTYPE ){
+ sqlite3ErrorMsg(pParse,
+ "unknown datatype for %s.%s: \"%s\"",
+ p->zName, pCol->zCnName, sqlite3ColumnType(pCol, "")
+ );
+ }else{
+ sqlite3ErrorMsg(pParse, "missing datatype for %s.%s",
+ p->zName, pCol->zCnName);
+ }
return;
+ }else if( pCol->eCType==COLTYPE_ANY ){
+ pCol->affinity = SQLITE_AFF_BLOB;
}
if( (pCol->colFlags & COLFLAG_PRIMKEY)!=0
&& p->iPKey!=ii
diff --git a/src/global.c b/src/global.c
index 091310c93..675cdec23 100644
--- a/src/global.c
+++ b/src/global.c
@@ -364,8 +364,9 @@ const char sqlite3StrBINARY[] = "BINARY";
** sqlite3_column_type() or sqlite3_value_type())
** for each entry in sqlite3StdType[].
*/
-const unsigned char sqlite3StdTypeLen[] = { 4, 3, 7, 4, 4 };
+const unsigned char sqlite3StdTypeLen[] = { 3, 4, 3, 7, 4, 4 };
const char sqlite3StdTypeAffinity[] = {
+ SQLITE_AFF_NUMERIC,
SQLITE_AFF_BLOB,
SQLITE_AFF_INTEGER,
SQLITE_AFF_INTEGER,
@@ -373,6 +374,7 @@ const char sqlite3StdTypeAffinity[] = {
SQLITE_AFF_TEXT
};
const char sqlite3StdTypeMap[] = {
+ 0,
SQLITE_BLOB,
SQLITE_INTEGER,
SQLITE_INTEGER,
@@ -380,6 +382,7 @@ const char sqlite3StdTypeMap[] = {
SQLITE_TEXT
};
const char *sqlite3StdType[] = {
+ "ANY",
"BLOB",
"INT",
"INTEGER",
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 348a41393..5308ca95c 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -2055,12 +2055,13 @@ struct Column {
** Adjust the SQLITE_N_STDTYPE value if adding or removing entries.
*/
#define COLTYPE_CUSTOM 0 /* Type appended to zName */
-#define COLTYPE_BLOB 1
-#define COLTYPE_INT 2
-#define COLTYPE_INTEGER 3
-#define COLTYPE_REAL 4
-#define COLTYPE_TEXT 5
-#define SQLITE_N_STDTYPE 5 /* Number of standard types */
+#define COLTYPE_ANY 1
+#define COLTYPE_BLOB 2
+#define COLTYPE_INT 3
+#define COLTYPE_INTEGER 4
+#define COLTYPE_REAL 5
+#define COLTYPE_TEXT 6
+#define SQLITE_N_STDTYPE 6 /* Number of standard types */
/* Allowed values for Column.colFlags.
**
diff --git a/src/vdbe.c b/src/vdbe.c
index 92d904135..5ac770c05 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -2974,7 +2974,7 @@ case OP_TypeCheck: {
break;
}
default: {
- /* anything goes */
+ /* COLTYPE_ANY. Accept anything. */
break;
}
}