Commit 31d2c024 authored by Olivier Bertrand's avatar Olivier Bertrand

Merge branch 'ob-10.0' into 10.0

parents 0bfb5bee 481e6433
...@@ -4926,11 +4926,11 @@ static bool add_field(String *sql, const char *field_name, int typ, int len, ...@@ -4926,11 +4926,11 @@ static bool add_field(String *sql, const char *field_name, int typ, int len,
error|= sql->append("` "); error|= sql->append("` ");
error|= sql->append(type); error|= sql->append(type);
if (len && typ != TYPE_DATE) { if (len && typ != TYPE_DATE && (typ != TYPE_DOUBLE || dec >= 0)) {
error|= sql->append('('); error|= sql->append('(');
error|= sql->append_ulonglong(len); error|= sql->append_ulonglong(len);
if (!strcmp(type, "DOUBLE")) { if (typ == TYPE_DOUBLE) {
error|= sql->append(','); error|= sql->append(',');
// dec must be < len and < 31 // dec must be < len and < 31
error|= sql->append_ulonglong(MY_MIN(dec, (MY_MIN(len, 31) - 1))); error|= sql->append_ulonglong(MY_MIN(dec, (MY_MIN(len, 31) - 1)));
...@@ -5516,6 +5516,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, ...@@ -5516,6 +5516,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
dec= crp->Prec; dec= crp->Prec;
flg= crp->Flag; flg= crp->Flag;
v= crp->Var; v= crp->Var;
tm= (crp->Kdata->IsNullable()) ? 0 : NOT_NULL_FLAG;
if (!len && typ == TYPE_STRING) if (!len && typ == TYPE_STRING)
len= 256; // STRBLK's have 0 length len= 256; // STRBLK's have 0 length
...@@ -5523,9 +5524,9 @@ static int connect_assisted_discovery(handlerton *, THD* thd, ...@@ -5523,9 +5524,9 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
// Now add the field // Now add the field
#if defined(NEW_WAY) #if defined(NEW_WAY)
rc= add_fields(g, thd, &alter_info, cnm, typ, len, dec, rc= add_fields(g, thd, &alter_info, cnm, typ, len, dec,
NOT_NULL_FLAG, "", flg, dbf, v); tm, "", flg, dbf, v);
#else // !NEW_WAY #else // !NEW_WAY
if (add_field(&sql, cnm, typ, len, dec, NULL, NOT_NULL_FLAG, if (add_field(&sql, cnm, typ, len, dec, NULL, tm,
NULL, NULL, NULL, NULL, flg, dbf, v)) NULL, NULL, NULL, NULL, flg, dbf, v))
rc= HA_ERR_OUT_OF_MEM; rc= HA_ERR_OUT_OF_MEM;
#endif // !NEW_WAY #endif // !NEW_WAY
...@@ -5582,7 +5583,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, ...@@ -5582,7 +5583,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
len= crp->Kdata->GetIntValue(i); len= crp->Kdata->GetIntValue(i);
break; break;
case FLD_SCALE: case FLD_SCALE:
dec= crp->Kdata->GetIntValue(i); dec = (!crp->Kdata->IsNull(i)) ? crp->Kdata->GetIntValue(i) : -1;
break; break;
case FLD_NULL: case FLD_NULL:
if (crp->Kdata->GetIntValue(i)) if (crp->Kdata->GetIntValue(i))
...@@ -5675,14 +5676,14 @@ static int connect_assisted_discovery(handlerton *, THD* thd, ...@@ -5675,14 +5676,14 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
dec= 0; dec= 0;
} // endswitch typ } // endswitch typ
} // endif ttp } else
#endif // ODBC_SUPPORT #endif // ODBC_SUPPORT
// Make the arguments as required by add_fields // Make the arguments as required by add_fields
if (typ == TYPE_DATE) if (typ == TYPE_DOUBLE)
prec= len;
if (typ == TYPE_DATE)
prec= 0; prec= 0;
else if (typ == TYPE_DOUBLE)
prec= len;
// Now add the field // Now add the field
#if defined(NEW_WAY) #if defined(NEW_WAY)
......
...@@ -5,7 +5,7 @@ SHOW CREATE TABLE t1; ...@@ -5,7 +5,7 @@ SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`Name` varchar(256) NOT NULL, `Name` varchar(256) NOT NULL,
`Description` varchar(256) NOT NULL `Description` varchar(256) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='ODBC' `CATFUNC`='Sources' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='ODBC' `CATFUNC`='Sources'
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CATFUNC=Drivers; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CATFUNC=Drivers;
...@@ -13,35 +13,35 @@ SHOW CREATE TABLE t1; ...@@ -13,35 +13,35 @@ SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`Description` char(128) NOT NULL, `Description` char(128) NOT NULL,
`Attributes` varchar(256) NOT NULL `Attributes` varchar(256) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='ODBC' `CATFUNC`='Drivers' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='ODBC' `CATFUNC`='Drivers'
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CATFUNC=Tables CONNECTION='Not important'; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CATFUNC=Tables CONNECTION='Not important';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`Table_Cat` char(128) NOT NULL, `Table_Cat` char(128) DEFAULT NULL,
`Table_Schema` char(128) NOT NULL, `Table_Schema` char(128) DEFAULT NULL,
`Table_Name` char(128) NOT NULL, `Table_Name` char(128) NOT NULL,
`Table_Type` char(16) NOT NULL, `Table_Type` char(16) NOT NULL,
`Remark` char(255) NOT NULL `Remark` char(255) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='Not important' `TABLE_TYPE`='ODBC' `CATFUNC`='Tables' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='Not important' `TABLE_TYPE`='ODBC' `CATFUNC`='Tables'
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CATFUNC=Columns CONNECTION='Not important'; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CATFUNC=Columns CONNECTION='Not important';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`Table_Cat` char(128) NOT NULL, `Table_Cat` char(128) DEFAULT NULL,
`Table_Schema` char(128) NOT NULL, `Table_Schema` char(128) DEFAULT NULL,
`Table_Name` char(128) NOT NULL, `Table_Name` char(128) NOT NULL,
`Column_Name` char(128) NOT NULL, `Column_Name` char(128) NOT NULL,
`Data_Type` smallint(6) NOT NULL, `Data_Type` smallint(6) NOT NULL,
`Type_Name` char(30) NOT NULL, `Type_Name` char(30) NOT NULL,
`Column_Size` int(10) NOT NULL, `Column_Size` int(10) NOT NULL,
`Buffer_Length` int(10) NOT NULL, `Buffer_Length` int(10) NOT NULL,
`Decimal_Digits` smallint(6) NOT NULL, `Decimal_Digits` smallint(6) DEFAULT NULL,
`Radix` smallint(6) NOT NULL, `Radix` smallint(6) DEFAULT NULL,
`Nullable` smallint(6) NOT NULL, `Nullable` smallint(6) NOT NULL,
`Remarks` char(255) NOT NULL `Remarks` char(255) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='Not important' `TABLE_TYPE`='ODBC' `CATFUNC`='Columns' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='Not important' `TABLE_TYPE`='ODBC' `CATFUNC`='Columns'
DROP TABLE t1; DROP TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`Name` varchar(256) NOT NULL, `Name` varchar(256) NOT NULL,
`Description` varchar(256) NOT NULL `Description` varchar(256) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='ODBC' `CATFUNC`='Sources' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='ODBC' `CATFUNC`='Sources'
SET NAMES utf8; SET NAMES utf8;
# #
...@@ -14,9 +14,9 @@ TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEngineOracle;UID=mtr;PWD=mtr' ...@@ -14,9 +14,9 @@ TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEngineOracle;UID=mtr;PWD=mtr'
CATFUNC=Tables; CATFUNC=Tables;
SELECT * FROM t1 WHERE Table_Schema='MTR' ORDER BY Table_Schema, Table_Name; SELECT * FROM t1 WHERE Table_Schema='MTR' ORDER BY Table_Schema, Table_Name;
Table_Cat Table_Schema Table_Name Table_Type Remark Table_Cat Table_Schema Table_Name Table_Type Remark
MTR T1 TABLE NULL MTR T1 TABLE NULL
MTR T2 TABLE NULL MTR T2 TABLE NULL
MTR V1 VIEW NULL MTR V1 VIEW NULL
DROP TABLE t1; DROP TABLE t1;
# All tables in all schemas (filtered with WHERE) # All tables in all schemas (filtered with WHERE)
CREATE TABLE t1 ENGINE=CONNECT CREATE TABLE t1 ENGINE=CONNECT
...@@ -24,9 +24,9 @@ TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEngineOracle;UID=mtr;PWD=mtr' ...@@ -24,9 +24,9 @@ TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEngineOracle;UID=mtr;PWD=mtr'
CATFUNC=Tables TABNAME='%.%'; CATFUNC=Tables TABNAME='%.%';
SELECT * FROM t1 WHERE Table_Schema='MTR' ORDER BY Table_Schema, Table_Name; SELECT * FROM t1 WHERE Table_Schema='MTR' ORDER BY Table_Schema, Table_Name;
Table_Cat Table_Schema Table_Name Table_Type Remark Table_Cat Table_Schema Table_Name Table_Type Remark
MTR T1 TABLE NULL MTR T1 TABLE NULL
MTR T2 TABLE NULL MTR T2 TABLE NULL
MTR V1 VIEW NULL MTR V1 VIEW NULL
DROP TABLE t1; DROP TABLE t1;
# All tables "T1" in all schemas (filtered with WHERE) # All tables "T1" in all schemas (filtered with WHERE)
CREATE TABLE t1 ENGINE=CONNECT CREATE TABLE t1 ENGINE=CONNECT
...@@ -34,7 +34,7 @@ TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEngineOracle;UID=mtr;PWD=mtr' ...@@ -34,7 +34,7 @@ TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEngineOracle;UID=mtr;PWD=mtr'
CATFUNC=Tables TABNAME='%.T1'; CATFUNC=Tables TABNAME='%.T1';
SELECT * FROM t1 WHERE Table_Schema='MTR' ORDER BY Table_Schema, Table_Name; SELECT * FROM t1 WHERE Table_Schema='MTR' ORDER BY Table_Schema, Table_Name;
Table_Cat Table_Schema Table_Name Table_Type Remark Table_Cat Table_Schema Table_Name Table_Type Remark
MTR T1 TABLE NULL MTR T1 TABLE NULL
DROP TABLE t1; DROP TABLE t1;
# All tables "T1" in all schemas (filtered with WHERE) # All tables "T1" in all schemas (filtered with WHERE)
CREATE TABLE t1 ENGINE=CONNECT CREATE TABLE t1 ENGINE=CONNECT
...@@ -42,7 +42,7 @@ TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEngineOracle;UID=mtr;PWD=mtr' ...@@ -42,7 +42,7 @@ TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEngineOracle;UID=mtr;PWD=mtr'
CATFUNC=Tables TABNAME='T1'; CATFUNC=Tables TABNAME='T1';
SELECT * FROM t1 WHERE Table_Schema='MTR' ORDER BY Table_Schema, Table_Name; SELECT * FROM t1 WHERE Table_Schema='MTR' ORDER BY Table_Schema, Table_Name;
Table_Cat Table_Schema Table_Name Table_Type Remark Table_Cat Table_Schema Table_Name Table_Type Remark
MTR T1 TABLE NULL MTR T1 TABLE NULL
DROP TABLE t1; DROP TABLE t1;
# Table "T1" in the schema "MTR" # Table "T1" in the schema "MTR"
CREATE TABLE t1 ENGINE=CONNECT CREATE TABLE t1 ENGINE=CONNECT
...@@ -50,7 +50,7 @@ TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEngineOracle;UID=mtr;PWD=mtr' ...@@ -50,7 +50,7 @@ TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEngineOracle;UID=mtr;PWD=mtr'
CATFUNC=Tables TABNAME='MTR.T1'; CATFUNC=Tables TABNAME='MTR.T1';
SELECT * FROM t1 ORDER BY Table_Schema, Table_Name; SELECT * FROM t1 ORDER BY Table_Schema, Table_Name;
Table_Cat Table_Schema Table_Name Table_Type Remark Table_Cat Table_Schema Table_Name Table_Type Remark
MTR T1 TABLE NULL MTR T1 TABLE NULL
DROP TABLE t1; DROP TABLE t1;
# All tables in the schema "MTR" # All tables in the schema "MTR"
CREATE TABLE t1 ENGINE=CONNECT CREATE TABLE t1 ENGINE=CONNECT
...@@ -58,9 +58,9 @@ TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEngineOracle;UID=mtr;PWD=mtr' ...@@ -58,9 +58,9 @@ TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEngineOracle;UID=mtr;PWD=mtr'
CATFUNC=Tables TABNAME='MTR.%'; CATFUNC=Tables TABNAME='MTR.%';
SELECT * FROM t1 ORDER BY Table_Schema, Table_Name; SELECT * FROM t1 ORDER BY Table_Schema, Table_Name;
Table_Cat Table_Schema Table_Name Table_Type Remark Table_Cat Table_Schema Table_Name Table_Type Remark
MTR T1 TABLE NULL MTR T1 TABLE NULL
MTR T2 TABLE NULL MTR T2 TABLE NULL
MTR V1 VIEW NULL MTR V1 VIEW NULL
DROP TABLE t1; DROP TABLE t1;
# #
# Checking CATFUNC=Columns # Checking CATFUNC=Columns
...@@ -73,10 +73,10 @@ CATFUNC=Columns; ...@@ -73,10 +73,10 @@ CATFUNC=Columns;
SELECT * FROM t1 WHERE Table_Schema='MTR' ORDER BY Table_Schema, Table_Name; SELECT * FROM t1 WHERE Table_Schema='MTR' ORDER BY Table_Schema, Table_Name;
Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks
MTR T1 A 3 DECIMAL 38 40 0 10 1 MTR T1 A 3 DECIMAL 38 40 0 10 1
MTR T1 B 6 NUMBER 38 40 0 0 1 MTR T1 B 6 NUMBER 38 40 NULL NULL 1
MTR T2 A 12 VARCHAR2 64 64 0 0 1 MTR T2 A 12 VARCHAR2 64 64 NULL NULL 1
MTR V1 A 3 DECIMAL 38 40 0 10 1 MTR V1 A 3 DECIMAL 38 40 0 10 1
MTR V1 B 6 NUMBER 38 40 0 0 1 MTR V1 B 6 NUMBER 38 40 NULL NULL 1
DROP TABLE t1; DROP TABLE t1;
# All columns in all schemas (limited with WHERE) # All columns in all schemas (limited with WHERE)
CREATE TABLE t1 ENGINE=CONNECT CREATE TABLE t1 ENGINE=CONNECT
...@@ -85,17 +85,17 @@ CATFUNC=Columns TABNAME='%.%'; ...@@ -85,17 +85,17 @@ CATFUNC=Columns TABNAME='%.%';
SELECT * FROM t1 WHERE Table_Schema='MTR' ORDER BY Table_Schema, Table_Name; SELECT * FROM t1 WHERE Table_Schema='MTR' ORDER BY Table_Schema, Table_Name;
Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks
MTR T1 A 3 DECIMAL 38 40 0 10 1 MTR T1 A 3 DECIMAL 38 40 0 10 1
MTR T1 B 6 NUMBER 38 40 0 0 1 MTR T1 B 6 NUMBER 38 40 NULL NULL 1
MTR T2 A 12 VARCHAR2 64 64 0 0 1 MTR T2 A 12 VARCHAR2 64 64 NULL NULL 1
MTR V1 A 3 DECIMAL 38 40 0 10 1 MTR V1 A 3 DECIMAL 38 40 0 10 1
MTR V1 B 6 NUMBER 38 40 0 0 1 MTR V1 B 6 NUMBER 38 40 NULL NULL 1
DROP TABLE t1; DROP TABLE t1;
# All tables "T1" in all schemas (limited with WHERE) # All tables "T1" in all schemas (limited with WHERE)
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEngineOracle;UID=mtr;PWD=mtr' CATFUNC=Columns TABNAME='%.T1'; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEngineOracle;UID=mtr;PWD=mtr' CATFUNC=Columns TABNAME='%.T1';
SELECT * FROM t1 WHERE Table_Schema='MTR' ORDER BY Table_Schema, Table_Name; SELECT * FROM t1 WHERE Table_Schema='MTR' ORDER BY Table_Schema, Table_Name;
Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks
MTR T1 A 3 DECIMAL 38 40 0 10 1 MTR T1 A 3 DECIMAL 38 40 0 10 1
MTR T1 B 6 NUMBER 38 40 0 0 1 MTR T1 B 6 NUMBER 38 40 NULL NULL 1
DROP TABLE t1; DROP TABLE t1;
# Table "T1" in the schema "MTR" # Table "T1" in the schema "MTR"
CREATE TABLE t1 ENGINE=CONNECT CREATE TABLE t1 ENGINE=CONNECT
...@@ -104,7 +104,7 @@ CATFUNC=Columns TABNAME='MTR.T1'; ...@@ -104,7 +104,7 @@ CATFUNC=Columns TABNAME='MTR.T1';
SELECT * FROM t1 ORDER BY Table_Schema, Table_Name; SELECT * FROM t1 ORDER BY Table_Schema, Table_Name;
Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks
MTR T1 A 3 DECIMAL 38 40 0 10 1 MTR T1 A 3 DECIMAL 38 40 0 10 1
MTR T1 B 6 NUMBER 38 40 0 0 1 MTR T1 B 6 NUMBER 38 40 NULL NULL 1
DROP TABLE t1; DROP TABLE t1;
# All tables "T1" in all schemas (filtered with WHERE) # All tables "T1" in all schemas (filtered with WHERE)
CREATE TABLE t1 ENGINE=CONNECT CREATE TABLE t1 ENGINE=CONNECT
...@@ -113,7 +113,7 @@ CATFUNC=Columns TABNAME='%.T1'; ...@@ -113,7 +113,7 @@ CATFUNC=Columns TABNAME='%.T1';
SELECT * FROM t1 WHERE Table_Schema='MTR' ORDER BY Table_Schema, Table_Name; SELECT * FROM t1 WHERE Table_Schema='MTR' ORDER BY Table_Schema, Table_Name;
Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks
MTR T1 A 3 DECIMAL 38 40 0 10 1 MTR T1 A 3 DECIMAL 38 40 0 10 1
MTR T1 B 6 NUMBER 38 40 0 0 1 MTR T1 B 6 NUMBER 38 40 NULL NULL 1
DROP TABLE t1; DROP TABLE t1;
# #
# Checking tables # Checking tables
...@@ -127,32 +127,32 @@ SHOW CREATE TABLE t1; ...@@ -127,32 +127,32 @@ SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`A` decimal(40,0) DEFAULT NULL, `A` decimal(40,0) DEFAULT NULL,
`B` double(40,0) DEFAULT NULL `B` double DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='DSN=ConnectEngineOracle;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='T1' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='DSN=ConnectEngineOracle;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='T1'
SELECT * FROM t1 ORDER BY A; SELECT * FROM t1 ORDER BY A;
A B A B
10 1000000000 10 1000000000
20 1000000000000 20 1000000000000
30 1000000000000000 30 1e15
CREATE TABLE t2 AS SELECT * FROM t1; CREATE TABLE t2 AS SELECT * FROM t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`A` decimal(40,0) DEFAULT NULL, `A` decimal(40,0) DEFAULT NULL,
`B` double(40,0) DEFAULT NULL `B` double DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t2; SELECT * FROM t2;
A B A B
10 1000000000 10 1000000000
20 1000000000000 20 1000000000000
30 1000000000000000 30 1e15
DROP TABLE t2; DROP TABLE t2;
CREATE VIEW v1 AS SELECT * FROM t1; CREATE VIEW v1 AS SELECT * FROM t1;
SELECT * FROM v1; SELECT * FROM v1;
A B A B
10 1000000000 10 1000000000
20 1000000000000 20 1000000000000
30 1000000000000000 30 1e15
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
# Table "T1" in the schema "MTR" # Table "T1" in the schema "MTR"
...@@ -163,13 +163,13 @@ SHOW CREATE TABLE t1; ...@@ -163,13 +163,13 @@ SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`A` decimal(40,0) DEFAULT NULL, `A` decimal(40,0) DEFAULT NULL,
`B` double(40,0) DEFAULT NULL `B` double DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='DSN=ConnectEngineOracle;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='MTR.T1' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='DSN=ConnectEngineOracle;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='MTR.T1'
SELECT * FROM t1; SELECT * FROM t1;
A B A B
10 1000000000 10 1000000000
20 1000000000000 20 1000000000000
30 1000000000000000 30 1e15
DROP TABLE t1; DROP TABLE t1;
# View "V1" in the schema "MTR" # View "V1" in the schema "MTR"
CREATE TABLE t1 ENGINE=CONNECT CREATE TABLE t1 ENGINE=CONNECT
...@@ -179,32 +179,32 @@ SHOW CREATE TABLE t1; ...@@ -179,32 +179,32 @@ SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`A` decimal(40,0) DEFAULT NULL, `A` decimal(40,0) DEFAULT NULL,
`B` double(40,0) DEFAULT NULL `B` double DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='DSN=ConnectEngineOracle;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='MTR.V1' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='DSN=ConnectEngineOracle;UID=mtr;PWD=mtr' `TABLE_TYPE`='ODBC' `TABNAME`='MTR.V1'
SELECT * FROM t1; SELECT * FROM t1;
A B A B
10 1000000000 10 1000000000
20 1000000000000 20 1000000000000
30 1000000000000000 30 1e15
CREATE TABLE t2 AS SELECT * FROM t1; CREATE TABLE t2 AS SELECT * FROM t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`A` decimal(40,0) DEFAULT NULL, `A` decimal(40,0) DEFAULT NULL,
`B` double(40,0) DEFAULT NULL `B` double DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t2; SELECT * FROM t2;
A B A B
10 1000000000 10 1000000000
20 1000000000000 20 1000000000000
30 1000000000000000 30 1e15
DROP TABLE t2; DROP TABLE t2;
CREATE VIEW v1 AS SELECT * FROM t1; CREATE VIEW v1 AS SELECT * FROM t1;
SELECT * FROM v1; SELECT * FROM v1;
A B A B
10 1000000000 10 1000000000
20 1000000000000 20 1000000000000
30 1000000000000000 30 1e15
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
# Table "T2" in the schema "MTR" # Table "T2" in the schema "MTR"
......
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`Name` varchar(256) NOT NULL, `Name` varchar(256) NOT NULL,
`Description` varchar(256) NOT NULL `Description` varchar(256) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='ODBC' `CATFUNC`='Sources' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='ODBC' `CATFUNC`='Sources'
SET NAMES utf8; SET NAMES utf8;
# #
...@@ -99,9 +99,9 @@ Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Bu ...@@ -99,9 +99,9 @@ Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Bu
mtr public t1 a 4 int4 10 4 0 10 0 mtr public t1 a 4 int4 10 4 0 10 0
mtr public t2 a 4 int4 10 4 0 10 0 mtr public t2 a 4 int4 10 4 0 10 0
mtr public v1 a 4 int4 10 4 0 10 1 mtr public v1 a 4 int4 10 4 0 10 1
mtr schema1 t1 a 1 bpchar 10 60 0 0 0 mtr schema1 t1 a 1 bpchar 10 60 NULL NULL 0
mtr schema1 t2 a 1 bpchar 10 60 0 0 0 mtr schema1 t2 a 1 bpchar 10 60 NULL NULL 0
mtr schema1 v1 a 1 bpchar 10 60 0 0 1 mtr schema1 v1 a 1 bpchar 10 60 NULL NULL 1
DROP TABLE t1; DROP TABLE t1;
# All columns in the schemas "public" and "schema1" # All columns in the schemas "public" and "schema1"
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Columns TABNAME='%.%.%'; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Columns TABNAME='%.%.%';
...@@ -110,16 +110,16 @@ Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Bu ...@@ -110,16 +110,16 @@ Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Bu
mtr public t1 a 4 int4 10 4 0 10 0 mtr public t1 a 4 int4 10 4 0 10 0
mtr public t2 a 4 int4 10 4 0 10 0 mtr public t2 a 4 int4 10 4 0 10 0
mtr public v1 a 4 int4 10 4 0 10 1 mtr public v1 a 4 int4 10 4 0 10 1
mtr schema1 t1 a 1 bpchar 10 60 0 0 0 mtr schema1 t1 a 1 bpchar 10 60 NULL NULL 0
mtr schema1 t2 a 1 bpchar 10 60 0 0 0 mtr schema1 t2 a 1 bpchar 10 60 NULL NULL 0
mtr schema1 v1 a 1 bpchar 10 60 0 0 1 mtr schema1 v1 a 1 bpchar 10 60 NULL NULL 1
DROP TABLE t1; DROP TABLE t1;
# All tables "t1" in all schemas # All tables "t1" in all schemas
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Columns TABNAME='%.%.t1'; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Columns TABNAME='%.%.t1';
SELECT * FROM t1 ORDER BY Table_Schema, Table_Name; SELECT * FROM t1 ORDER BY Table_Schema, Table_Name;
Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks
mtr public t1 a 4 int4 10 4 0 10 0 mtr public t1 a 4 int4 10 4 0 10 0
mtr schema1 t1 a 1 bpchar 10 60 0 0 0 mtr schema1 t1 a 1 bpchar 10 60 NULL NULL 0
DROP TABLE t1; DROP TABLE t1;
# Table "t1" in the schema "public" # Table "t1" in the schema "public"
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Columns TABNAME='%.public.t1'; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Columns TABNAME='%.public.t1';
...@@ -131,14 +131,14 @@ DROP TABLE t1; ...@@ -131,14 +131,14 @@ DROP TABLE t1;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Columns TABNAME='%.schema1.t1'; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Columns TABNAME='%.schema1.t1';
SELECT * FROM t1 ORDER BY Table_Schema, Table_Name; SELECT * FROM t1 ORDER BY Table_Schema, Table_Name;
Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks
mtr schema1 t1 a 1 bpchar 10 60 0 0 0 mtr schema1 t1 a 1 bpchar 10 60 NULL NULL 0
DROP TABLE t1; DROP TABLE t1;
# All tables "t1" in all schemas (Catalog name is ignored by PostgreSQL) # All tables "t1" in all schemas (Catalog name is ignored by PostgreSQL)
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Columns TABNAME='xxx.%.t1'; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Columns TABNAME='xxx.%.t1';
SELECT * FROM t1 ORDER BY Table_Schema, Table_Name; SELECT * FROM t1 ORDER BY Table_Schema, Table_Name;
Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks
mtr public t1 a 4 int4 10 4 0 10 0 mtr public t1 a 4 int4 10 4 0 10 0
mtr schema1 t1 a 1 bpchar 10 60 0 0 0 mtr schema1 t1 a 1 bpchar 10 60 NULL NULL 0
DROP TABLE t1; DROP TABLE t1;
# #
# Checking tables # Checking tables
......
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`Description` char(128) NOT NULL, `Description` char(128) NOT NULL,
`Attributes` varchar(256) NOT NULL `Attributes` varchar(256) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='ODBC' `CATFUNC`='Drivers' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='ODBC' `CATFUNC`='Drivers'
SET NAMES utf8; SET NAMES utf8;
GRANT ALL PRIVILEGES ON *.* TO user@localhost; GRANT ALL PRIVILEGES ON *.* TO user@localhost;
......
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`Name` varchar(256) NOT NULL, `Name` varchar(256) NOT NULL,
`Description` varchar(256) NOT NULL `Description` varchar(256) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='ODBC' `CATFUNC`='Sources' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='ODBC' `CATFUNC`='Sources'
CREATE TABLE contact (Nom VARCHAR(128), Fonction VARCHAR(128), Company VARCHAR(128), Repertoire VARCHAR(30)) ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEngineXLS;DBQ=DATADIR/test/contacts.xls';; CREATE TABLE contact (Nom VARCHAR(128), Fonction VARCHAR(128), Company VARCHAR(128), Repertoire VARCHAR(30)) ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEngineXLS;DBQ=DATADIR/test/contacts.xls';;
SELECT Nom, Fonction FROM contact WHERE Repertoire='ascii'; SELECT Nom, Fonction FROM contact WHERE Repertoire='ascii';
...@@ -16,11 +16,11 @@ DROP TABLE contact; ...@@ -16,11 +16,11 @@ DROP TABLE contact;
CREATE TABLE t1 ENGINE=CONNECT CATFUNC=Tables TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEngineXLS;DBQ=DATADIR/test/contacts.xls' CHARSET=utf8 DATA_CHARSET=latin1;; CREATE TABLE t1 ENGINE=CONNECT CATFUNC=Tables TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEngineXLS;DBQ=DATADIR/test/contacts.xls' CHARSET=utf8 DATA_CHARSET=latin1;;
SELECT * FROM t1 WHERE Table_name='CONTACT'; SELECT * FROM t1 WHERE Table_name='CONTACT';
Table_Cat Table_Schema Table_Name Table_Type Remark Table_Cat Table_Schema Table_Name Table_Type Remark
DATADIR/test/contacts CONTACT TABLE DATADIR/test/contacts NULL CONTACT TABLE NULL
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 ENGINE=CONNECT CATFUNC=Columns TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEngineXLS;DBQ=DATADIR/test/contacts.xls' CHARSET=utf8 DATA_CHARSET=latin1;; CREATE TABLE t1 ENGINE=CONNECT CATFUNC=Columns TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEngineXLS;DBQ=DATADIR/test/contacts.xls' CHARSET=utf8 DATA_CHARSET=latin1;;
SELECT * FROM t1 WHERE Table_name='CONTACT' AND Column_name IN ('Nom','Fonction'); SELECT * FROM t1 WHERE Table_name='CONTACT' AND Column_name IN ('Nom','Fonction');
Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks
DATADIR/test/contacts CONTACT Nom 12 VARCHAR 255 510 0 0 1 DATADIR/test/contacts NULL CONTACT Nom 12 VARCHAR 255 510 NULL NULL 1 NULL
DATADIR/test/contacts CONTACT Fonction 12 VARCHAR 255 510 0 0 1 DATADIR/test/contacts NULL CONTACT Fonction 12 VARCHAR 255 510 NULL NULL 1 NULL
DROP TABLE t1; DROP TABLE t1;
/************ Odbconn C++ Functions Source Code File (.CPP) ************/ /************ Odbconn C++ Functions Source Code File (.CPP) ************/
/* Name: ODBCONN.CPP Version 2.2 */ /* Name: ODBCONN.CPP Version 2.2 */
/* */ /* */
/* (C) Copyright to the author Olivier BERTRAND 1998-2015 */ /* (C) Copyright to the author Olivier BERTRAND 1998-2016 */
/* */ /* */
/* This file contains the ODBC connection classes functions. */ /* This file contains the ODBC connection classes functions. */
/***********************************************************************/ /***********************************************************************/
...@@ -314,8 +314,10 @@ PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *db, char *table, ...@@ -314,8 +314,10 @@ PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *db, char *table,
FLD_TYPE, FLD_TYPENAME, FLD_PREC, FLD_LENGTH, FLD_TYPE, FLD_TYPENAME, FLD_PREC, FLD_LENGTH,
FLD_SCALE, FLD_RADIX, FLD_NULL, FLD_REM}; FLD_SCALE, FLD_RADIX, FLD_NULL, FLD_REM};
unsigned int length[] = {0, 0, 0, 0, 6, 0, 10, 10, 6, 6, 6, 0}; unsigned int length[] = {0, 0, 0, 0, 6, 0, 10, 10, 6, 6, 6, 0};
int n, ncol = 12; bool b[] = {true,true,false,false,false,false,false,false,true,true,false,true};
PQRYRES qrp; int i, n, ncol = 12;
PCOLRES crp;
PQRYRES qrp;
CATPARM *cap; CATPARM *cap;
ODBConn *ocp = NULL; ODBConn *ocp = NULL;
...@@ -363,6 +365,10 @@ PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *db, char *table, ...@@ -363,6 +365,10 @@ PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *db, char *table,
qrp = PlgAllocResult(g, ncol, maxres, IDS_COLUMNS, qrp = PlgAllocResult(g, ncol, maxres, IDS_COLUMNS,
buftyp, fldtyp, length, false, true); buftyp, fldtyp, length, false, true);
for (i = 0, crp = qrp->Colresp; crp; i++, crp = crp->Next)
if (b[i])
crp->Kdata->SetNullable(true);
if (info || !qrp) // Info table if (info || !qrp) // Info table
return qrp; return qrp;
...@@ -495,8 +501,10 @@ PQRYRES ODBCDrivers(PGLOBAL g, int maxres, bool info) ...@@ -495,8 +501,10 @@ PQRYRES ODBCDrivers(PGLOBAL g, int maxres, bool info)
int buftyp[] = {TYPE_STRING, TYPE_STRING}; int buftyp[] = {TYPE_STRING, TYPE_STRING};
XFLD fldtyp[] = {FLD_NAME, FLD_REM}; XFLD fldtyp[] = {FLD_NAME, FLD_REM};
unsigned int length[] = {128, 256}; unsigned int length[] = {128, 256};
int ncol = 2; bool b[] = {false, true};
PQRYRES qrp; int i, ncol = 2;
PCOLRES crp;
PQRYRES qrp;
ODBConn *ocp = NULL; ODBConn *ocp = NULL;
/************************************************************************/ /************************************************************************/
...@@ -520,7 +528,11 @@ PQRYRES ODBCDrivers(PGLOBAL g, int maxres, bool info) ...@@ -520,7 +528,11 @@ PQRYRES ODBCDrivers(PGLOBAL g, int maxres, bool info)
qrp = PlgAllocResult(g, ncol, maxres, IDS_DRIVER, qrp = PlgAllocResult(g, ncol, maxres, IDS_DRIVER,
buftyp, fldtyp, length, false, true); buftyp, fldtyp, length, false, true);
/************************************************************************/ for (i = 0, crp = qrp->Colresp; crp; i++, crp = crp->Next)
if (b[i])
crp->Kdata->SetNullable(true);
/************************************************************************/
/* Now get the results into blocks. */ /* Now get the results into blocks. */
/************************************************************************/ /************************************************************************/
if (!info && qrp && ocp->GetDrivers(qrp)) if (!info && qrp && ocp->GetDrivers(qrp))
...@@ -542,8 +554,10 @@ PQRYRES ODBCDataSources(PGLOBAL g, int maxres, bool info) ...@@ -542,8 +554,10 @@ PQRYRES ODBCDataSources(PGLOBAL g, int maxres, bool info)
int buftyp[] = {TYPE_STRING, TYPE_STRING}; int buftyp[] = {TYPE_STRING, TYPE_STRING};
XFLD fldtyp[] = {FLD_NAME, FLD_REM}; XFLD fldtyp[] = {FLD_NAME, FLD_REM};
unsigned int length[] = {0, 256}; unsigned int length[] = {0, 256};
int n = 0, ncol = 2; bool b[] = {false, true};
PQRYRES qrp; int i, n = 0, ncol = 2;
PCOLRES crp;
PQRYRES qrp;
ODBConn *ocp = NULL; ODBConn *ocp = NULL;
/************************************************************************/ /************************************************************************/
...@@ -571,7 +585,11 @@ PQRYRES ODBCDataSources(PGLOBAL g, int maxres, bool info) ...@@ -571,7 +585,11 @@ PQRYRES ODBCDataSources(PGLOBAL g, int maxres, bool info)
qrp = PlgAllocResult(g, ncol, maxres, IDS_DSRC, qrp = PlgAllocResult(g, ncol, maxres, IDS_DSRC,
buftyp, fldtyp, length, false, true); buftyp, fldtyp, length, false, true);
/************************************************************************/ for (i = 0, crp = qrp->Colresp; crp; i++, crp = crp->Next)
if (b[i])
crp->Kdata->SetNullable(true);
/************************************************************************/
/* Now get the results into blocks. */ /* Now get the results into blocks. */
/************************************************************************/ /************************************************************************/
if (!info && qrp && ocp->GetDataSources(qrp)) if (!info && qrp && ocp->GetDataSources(qrp))
...@@ -595,8 +613,10 @@ PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *db, char *tabpat, ...@@ -595,8 +613,10 @@ PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *db, char *tabpat,
XFLD fldtyp[] = {FLD_CAT, FLD_SCHEM, FLD_NAME, XFLD fldtyp[] = {FLD_CAT, FLD_SCHEM, FLD_NAME,
FLD_TYPE, FLD_REM}; FLD_TYPE, FLD_REM};
unsigned int length[] = {0, 0, 0, 16, 0}; unsigned int length[] = {0, 0, 0, 16, 0};
int n, ncol = 5; bool b[] ={ true, true, false, false, true };
PQRYRES qrp; int i, n, ncol = 5;
PCOLRES crp;
PQRYRES qrp;
CATPARM *cap; CATPARM *cap;
ODBConn *ocp = NULL; ODBConn *ocp = NULL;
...@@ -638,7 +658,11 @@ PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *db, char *tabpat, ...@@ -638,7 +658,11 @@ PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *db, char *tabpat,
qrp = PlgAllocResult(g, ncol, maxres, IDS_TABLES, buftyp, qrp = PlgAllocResult(g, ncol, maxres, IDS_TABLES, buftyp,
fldtyp, length, false, true); fldtyp, length, false, true);
if (info || !qrp) for (i = 0, crp = qrp->Colresp; crp; i++, crp = crp->Next)
if (b[i])
crp->Kdata->SetNullable(true);
if (info || !qrp)
return qrp; return qrp;
if (!(cap = AllocCatInfo(g, CAT_TAB, db, tabpat, qrp))) if (!(cap = AllocCatInfo(g, CAT_TAB, db, tabpat, qrp)))
......
/************** Table C++ Functions Source Code File (.CPP) ************/ /************** Table C++ Functions Source Code File (.CPP) ************/
/* Name: TABLE.CPP Version 2.7 */ /* Name: TABLE.CPP Version 2.7 */
/* */ /* */
/* (C) Copyright to the author Olivier BERTRAND 1999-2015 */ /* (C) Copyright to the author Olivier BERTRAND 1999-2016 */
/* */ /* */
/* This file contains the TBX, TDB and OPJOIN classes functions. */ /* This file contains the TBX, TDB and OPJOIN classes functions. */
/***********************************************************************/ /***********************************************************************/
...@@ -518,7 +518,8 @@ bool TDBCAT::InitCol(PGLOBAL g) ...@@ -518,7 +518,8 @@ bool TDBCAT::InitCol(PGLOBAL g)
sprintf(g->Message, "Invalid flag %d for column %s", sprintf(g->Message, "Invalid flag %d for column %s",
colp->Flag, colp->Name); colp->Flag, colp->Name);
return true; return true;
} // endif Crp } else if (crp->Fld == FLD_SCALE || crp->Fld == FLD_RADIX)
colp->Value->SetNullable(true);
} // endfor colp } // endfor colp
...@@ -586,11 +587,14 @@ CATCOL::CATCOL(PCOLDEF cdp, PTDB tdbp, int n) ...@@ -586,11 +587,14 @@ CATCOL::CATCOL(PCOLDEF cdp, PTDB tdbp, int n)
/***********************************************************************/ /***********************************************************************/
void CATCOL::ReadColumn(PGLOBAL) void CATCOL::ReadColumn(PGLOBAL)
{ {
bool b = (!Crp->Kdata || Crp->Kdata->IsNull(Tdbp->N));
// Get the value of the Name or Description property // Get the value of the Name or Description property
if (Crp->Kdata) if (!b)
Value->SetValue_pvblk(Crp->Kdata, Tdbp->N); Value->SetValue_pvblk(Crp->Kdata, Tdbp->N);
else else
Value->Reset(); Value->Reset();
Value->SetNull(b);
} // end of ReadColumn } // end of ReadColumn
...@@ -73,7 +73,8 @@ class VALBLK : public BLOCK { ...@@ -73,7 +73,8 @@ class VALBLK : public BLOCK {
virtual void SetNull(int n, bool b) virtual void SetNull(int n, bool b)
{if (To_Nulls) {To_Nulls[n] = (b) ? '*' : 0;}} {if (To_Nulls) {To_Nulls[n] = (b) ? '*' : 0;}}
virtual bool IsNull(int n) {return To_Nulls && To_Nulls[n];} virtual bool IsNull(int n) {return To_Nulls && To_Nulls[n];}
virtual void SetNullable(bool b); virtual bool IsNullable(void) {return Nullable;}
virtual void SetNullable(bool b);
virtual bool IsUnsigned(void) {return Unsigned;} virtual bool IsUnsigned(void) {return Unsigned;}
virtual bool Init(PGLOBAL g, bool check) = 0; virtual bool Init(PGLOBAL g, bool check) = 0;
virtual int GetVlen(void) = 0; virtual int GetVlen(void) = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment