diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2013-12-03 22:59:40 +0100 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2013-12-03 22:59:40 +0100 |
commit | ee2f04450b45515c507e4511c26e48e2b846aa73 (patch) | |
tree | 2c1d9bec56e1268c8c41629ae1dd4f1d8253f471 /storage/connect/tabutil.cpp | |
parent | d240a0418cf6d59fba711f0677f164d9ee881b7e (diff) | |
download | mariadb-git-ee2f04450b45515c507e4511c26e48e2b846aa73.tar.gz |
- Add support for unsigned numeric types
added:
storage/connect/mysql-test/connect/r/unsigned.result
storage/connect/mysql-test/connect/t/unsigned.test
modified:
storage/connect/colblk.cpp
storage/connect/colblk.h
storage/connect/connect.cc
storage/connect/ha_connect.cc
storage/connect/myconn.cpp
storage/connect/mysql-test/connect/r/mysql_discovery.result
storage/connect/mysql-test/connect/r/xml.result
storage/connect/myutil.cpp
storage/connect/myutil.h
storage/connect/plgdbsem.h
storage/connect/tabdos.cpp
storage/connect/tabfix.cpp
storage/connect/tabmysql.cpp
storage/connect/tabutil.cpp
storage/connect/valblk.cpp
storage/connect/valblk.h
storage/connect/value.cpp
storage/connect/value.h
storage/connect/xobject.cpp
storage/connect/xobject.h
Diffstat (limited to 'storage/connect/tabutil.cpp')
-rw-r--r-- | storage/connect/tabutil.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/storage/connect/tabutil.cpp b/storage/connect/tabutil.cpp index fa4c8667a70..8b1b8555f53 100644 --- a/storage/connect/tabutil.cpp +++ b/storage/connect/tabutil.cpp @@ -117,7 +117,7 @@ TABLE_SHARE *GetTableShare(PGLOBAL g, THD *thd, const char *db, /************************************************************************/ /* TabColumns: constructs the result blocks containing all the columns */ -/* of the object table that will be retrieved by GetData commands. */ +/* description of the object table that will be retrieved by discovery.*/ /************************************************************************/ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db, const char *name, bool& info) @@ -128,8 +128,8 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db, static XFLD fldtyp[] = {FLD_NAME, FLD_TYPE, FLD_TYPENAME, FLD_PREC, FLD_LENGTH, FLD_SCALE, FLD_RADIX, FLD_NULL, FLD_REM, FLD_NO, FLD_CHARSET}; - static unsigned int length[] = {0, 4, 16, 4, 4, 4, 4, 4, 256, 32, 32}; - char *fld, *fmt; + static unsigned int length[] = {0, 4, 16, 4, 4, 4, 4, 4, 0, 32, 32}; + char *fld, *fmt, v; int i, n, ncol = sizeof(buftyp) / sizeof(int); int len, type, prec; bool mysql; @@ -164,6 +164,7 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db, // Some columns must be renamed for (i = 0, crp = qrp->Colresp; crp; crp = crp->Next) switch (++i) { + case 2: crp->Nulls = (char*)PlugSubAlloc(g, NULL, n); break; case 10: crp->Name = "Date_fmt"; break; case 11: crp->Name = "Collation"; break; } // endswitch i @@ -181,8 +182,9 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db, crp = qrp->Colresp; // Column_Name fld = (char *)fp->field_name; crp->Kdata->SetValue(fld, i); + v = 0; - if ((type = MYSQLtoPLG(fp->type())) == TYPE_ERROR) { + if ((type = MYSQLtoPLG(fp->type(), &v)) == TYPE_ERROR) { sprintf(g->Message, "Unsupported column type %s", GetTypeName(type)); qrp = NULL; break; @@ -190,6 +192,14 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db, crp = crp->Next; // Data_Type crp->Kdata->SetValue(type, i); + + if (fp->flags & ZEROFILL_FLAG) + crp->Nulls[i] = 'Z'; + else if (fp->flags & UNSIGNED_FLAG) + crp->Nulls[i] = 'U'; + else + crp->Nulls[i] = v; + crp = crp->Next; // Type_Name crp->Kdata->SetValue(GetTypeName(type), i); @@ -200,7 +210,7 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db, len = strlen(fmt); } else { fmt = (char*)fp->option_struct->dateformat; - len = fp->field_length; + fp->field_length; } // endif mysql } else { @@ -212,10 +222,10 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db, crp->Kdata->SetValue(len, i); crp = crp->Next; // Length - len = fp->field_length; + prec = (type == TYPE_FLOAT) ? fp->decimals() : 0; + len = (prec == 31) ? 0 : fp->field_length; crp->Kdata->SetValue(len, i); - prec = (type == TYPE_FLOAT) ? fp->decimals() : 0; crp = crp->Next; // Scale crp->Kdata->SetValue(prec, i); @@ -233,7 +243,7 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db, else crp->Kdata->Reset(i); - crp = crp->Next; // New + crp = crp->Next; // New (date format) crp->Kdata->SetValue((fmt) ? fmt : (char*) "", i); crp = crp->Next; // New (charset) |