Commit 7e65bdba authored by Olivier Bertrand's avatar Olivier Bertrand

- Update version number

  modified:   storage/connect/ha_connect.cc

- Regard columns with binary charset as string (was binary)
  modified:   storage/connect/ha_connect.cc
  modified:   storage/connect/tabmysql.cpp
  modified:   storage/connect/tabutil.cpp

- Support length 0 for CHAR and VARCHAR
  modified:   storage/connect/ha_connect.cc
  modified:   storage/connect/reldef.cpp
  modified:   storage/connect/value.cpp

- Add ACCEPT option for void columns in discovery
  modified:   storage/connect/tabjson.cpp

- Update some tests because of above change
  modified:   storage/connect/mysql-test/connect/r/json_java_2.result
  modified:   storage/connect/mysql-test/connect/r/json_java_3.result
  modified:   storage/connect/mysql-test/connect/r/json_mongo_c.result
  modified:   storage/connect/mysql-test/connect/r/mongo_c.result
  modified:   storage/connect/mysql-test/connect/r/mongo_java_2.result
  modified:   storage/connect/mysql-test/connect/r/mongo_java_3.result
  modified:   storage/connect/mysql-test/connect/r/odbc_oracle.result
  modified:   storage/connect/mysql-test/connect/r/updelx.result
  modified:   storage/connect/mysql-test/connect/t/mongo_test.inc
parent 703ce16a
......@@ -171,9 +171,9 @@
#define JSONMAX 10 // JSON Default max grp size
extern "C" {
char version[]= "Version 1.06.0003 August 28, 2017";
char version[]= "Version 1.06.0004 September 03, 2017";
#if defined(__WIN__)
char compver[]= "Version 1.06.0003 " __DATE__ " " __TIME__;
char compver[]= "Version 1.06.0004 " __DATE__ " " __TIME__;
char slash= '\\';
#else // !__WIN__
char slash= '/';
......@@ -1449,7 +1449,7 @@ PFOS ha_connect::GetFieldOptionStruct(Field *fdp)
void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
{
const char *cp;
char *chset, v;
char *chset, v = 0;
ha_field_option_struct *fop;
Field* fp;
Field* *fldp;
......@@ -1502,7 +1502,6 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
} // endif fop
chset = (char *)fp->charset()->name;
v = (!strcmp(chset, "binary")) ? 'B' : 0;
switch (fp->type()) {
case MYSQL_TYPE_BLOB:
......@@ -5184,7 +5183,8 @@ static bool add_field(String *sql, const char *field_name, int typ, int len,
error|= sql->append("` ");
error|= sql->append(type);
if (len && typ != TYPE_DATE && (typ != TYPE_DOUBLE || dec >= 0)) {
if (typ == TYPE_STRING ||
(len && typ != TYPE_DATE && (typ != TYPE_DOUBLE || dec >= 0))) {
error|= sql->append('(');
error|= sql->append_ulonglong(len);
......@@ -6410,6 +6410,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
case MYSQL_TYPE_VARCHAR:
case MYSQL_TYPE_VAR_STRING:
case MYSQL_TYPE_STRING:
#if 0
if (!fp->field_length) {
sprintf(g->Message, "Unsupported 0 length for column %s",
fp->field_name);
......@@ -6419,7 +6420,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
MYF(0), fp->field_name);
DBUG_RETURN(rc);
} // endif fp
#endif // 0
break; // To be checked
case MYSQL_TYPE_BIT:
case MYSQL_TYPE_NULL:
......@@ -7206,7 +7207,7 @@ maria_declare_plugin(connect)
0x0106, /* version number (1.05) */
NULL, /* status variables */
connect_system_variables, /* system variables */
"1.06.0003", /* string version */
"1.06.0004", /* string version */
MariaDB_PLUGIN_MATURITY_STABLE /* maturity */
}
maria_declare_plugin_end;
SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo2.jar';
set connect_enable_mongo=1;
#
# Test the MONGO table type
#
......@@ -25,7 +26,6 @@ address_street 1 CHAR 38 38 0 0 address.street
address_zipcode 1 CHAR 5 5 0 0 address.zipcode
borough 1 CHAR 13 13 0 0
cuisine 1 CHAR 64 64 0 0
grades 1 CHAR 0 0 0 1
grades_date 1 CHAR 256 256 0 1 grades.0.date
grades_grade 1 CHAR 14 14 0 1 grades.0.grade
grades_score 5 BIGINT 2 2 0 1 grades.0.score
......@@ -72,7 +72,6 @@ t1 CREATE TABLE `t1` (
`address_zipcode` char(5) NOT NULL `FIELD_FORMAT`='address.zipcode',
`borough` char(13) NOT NULL,
`cuisine` char(64) NOT NULL,
`grades` char(1) DEFAULT NULL,
`grades_date` varchar(256) DEFAULT NULL `FIELD_FORMAT`='grades.0.date',
`grades_grade` char(14) DEFAULT NULL `FIELD_FORMAT`='grades.0.grade',
`grades_score` bigint(2) DEFAULT NULL `FIELD_FORMAT`='grades.0.score',
......@@ -80,12 +79,12 @@ t1 CREATE TABLE `t1` (
`restaurant_id` char(8) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='mongodb://localhost:27017' `TABLE_TYPE`='JSON' `TABNAME`='restaurants' `OPTION_LIST`='Level=1,Driver=Java,Version=2' `DATA_CHARSET`='utf8' `LRECL`=4096
SELECT * FROM t1 LIMIT 5;
_id address_building address_coord address_street address_zipcode borough cuisine grades grades_date grades_grade grades_score name restaurant_id
58ada47de5a51ddfcd5ed51c 1007 -73.856077 Morris Park Ave 10462 Bronx Bakery 2 2014-03-03T00:00:00.000Z A 2 Morris Park Bake Shop 30075445
58ada47de5a51ddfcd5ed51d 469 -73.961704 Flatbush Avenue 11225 Brooklyn Hamburgers 2 2014-12-30T00:00:00.000Z A 8 Wendy'S 30112340
58ada47de5a51ddfcd5ed51e 351 -73.98513559999999 West 57 Street 10019 Manhattan Irish 2 2014-09-06T00:00:00.000Z A 2 Dj Reynolds Pub And Restaurant 30191841
58ada47de5a51ddfcd5ed51f 2780 -73.98241999999999 Stillwell Avenue 11224 Brooklyn American 2 2014-06-10T00:00:00.000Z A 5 Riviera Caterer 40356018
58ada47de5a51ddfcd5ed520 97-22 -73.8601152 63 Road 11374 Queens Jewish/Kosher 2 2014-11-24T00:00:00.000Z Z 20 Tov Kosher Kitchen 40356068
_id address_building address_coord address_street address_zipcode borough cuisine grades_date grades_grade grades_score name restaurant_id
58ada47de5a51ddfcd5ed51c 1007 -73.856077 Morris Park Ave 10462 Bronx Bakery 2014-03-03T00:00:00.000Z A 2 Morris Park Bake Shop 30075445
58ada47de5a51ddfcd5ed51d 469 -73.961704 Flatbush Avenue 11225 Brooklyn Hamburgers 2014-12-30T00:00:00.000Z A 8 Wendy'S 30112340
58ada47de5a51ddfcd5ed51e 351 -73.98513559999999 West 57 Street 10019 Manhattan Irish 2014-09-06T00:00:00.000Z A 2 Dj Reynolds Pub And Restaurant 30191841
58ada47de5a51ddfcd5ed51f 2780 -73.98241999999999 Stillwell Avenue 11224 Brooklyn American 2014-06-10T00:00:00.000Z A 5 Riviera Caterer 40356018
58ada47de5a51ddfcd5ed520 97-22 -73.8601152 63 Road 11374 Queens Jewish/Kosher 2014-11-24T00:00:00.000Z Z 20 Tov Kosher Kitchen 40356068
DROP TABLE t1;
#
# Dropping a column
......@@ -259,7 +258,6 @@ t1 CREATE TABLE `t1` (
`address_street` char(38) NOT NULL `FIELD_FORMAT`='address.street',
`address_zipcode` char(5) NOT NULL `FIELD_FORMAT`='address.zipcode',
`borough` char(13) NOT NULL,
`grades` char(1) DEFAULT NULL,
`grades_date` char(24) DEFAULT NULL `FIELD_FORMAT`='grades.0.date',
`grades_grade` char(14) DEFAULT NULL `FIELD_FORMAT`='grades.0.grade',
`grades_score` bigint(2) DEFAULT NULL `FIELD_FORMAT`='grades.0.score',
......@@ -384,3 +382,4 @@ planner 167 41.75
postcard 23 5.75
DROP TABLE t1;
true
set connect_enable_mongo=0;
SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo3.jar';
set connect_enable_mongo=1;
#
# Test the MONGO table type
#
......@@ -25,7 +26,6 @@ address_street 1 CHAR 38 38 0 0 address.street
address_zipcode 1 CHAR 5 5 0 0 address.zipcode
borough 1 CHAR 13 13 0 0
cuisine 1 CHAR 64 64 0 0
grades 1 CHAR 0 0 0 1
grades_date 1 CHAR 256 256 0 1 grades.0.date
grades_grade 1 CHAR 14 14 0 1 grades.0.grade
grades_score 5 BIGINT 2 2 0 1 grades.0.score
......@@ -72,7 +72,6 @@ t1 CREATE TABLE `t1` (
`address_zipcode` char(5) NOT NULL `FIELD_FORMAT`='address.zipcode',
`borough` char(13) NOT NULL,
`cuisine` char(64) NOT NULL,
`grades` char(1) DEFAULT NULL,
`grades_date` varchar(256) DEFAULT NULL `FIELD_FORMAT`='grades.0.date',
`grades_grade` char(14) DEFAULT NULL `FIELD_FORMAT`='grades.0.grade',
`grades_score` bigint(2) DEFAULT NULL `FIELD_FORMAT`='grades.0.score',
......@@ -80,12 +79,12 @@ t1 CREATE TABLE `t1` (
`restaurant_id` char(8) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='mongodb://localhost:27017' `TABLE_TYPE`='JSON' `TABNAME`='restaurants' `OPTION_LIST`='Level=1,Driver=Java,Version=3' `DATA_CHARSET`='utf8' `LRECL`=4096
SELECT * FROM t1 LIMIT 5;
_id address_building address_coord address_street address_zipcode borough cuisine grades grades_date grades_grade grades_score name restaurant_id
58ada47de5a51ddfcd5ed51c 1007 -73.856077 Morris Park Ave 10462 Bronx Bakery 1 1393804800 A 2 Morris Park Bake Shop 30075445
58ada47de5a51ddfcd5ed51d 469 -73.961704 Flatbush Avenue 11225 Brooklyn Hamburgers 1 1419897600 A 8 Wendy'S 30112340
58ada47de5a51ddfcd5ed51e 351 -73.98513559999999 West 57 Street 10019 Manhattan Irish 1 1409961600 A 2 Dj Reynolds Pub And Restaurant 30191841
58ada47de5a51ddfcd5ed51f 2780 -73.98241999999999 Stillwell Avenue 11224 Brooklyn American 1 1402358400 A 5 Riviera Caterer 40356018
58ada47de5a51ddfcd5ed520 97-22 -73.8601152 63 Road 11374 Queens Jewish/Kosher 1 1416787200 Z 20 Tov Kosher Kitchen 40356068
_id address_building address_coord address_street address_zipcode borough cuisine grades_date grades_grade grades_score name restaurant_id
58ada47de5a51ddfcd5ed51c 1007 -73.856077 Morris Park Ave 10462 Bronx Bakery 1393804800 A 2 Morris Park Bake Shop 30075445
58ada47de5a51ddfcd5ed51d 469 -73.961704 Flatbush Avenue 11225 Brooklyn Hamburgers 1419897600 A 8 Wendy'S 30112340
58ada47de5a51ddfcd5ed51e 351 -73.98513559999999 West 57 Street 10019 Manhattan Irish 1409961600 A 2 Dj Reynolds Pub And Restaurant 30191841
58ada47de5a51ddfcd5ed51f 2780 -73.98241999999999 Stillwell Avenue 11224 Brooklyn American 1402358400 A 5 Riviera Caterer 40356018
58ada47de5a51ddfcd5ed520 97-22 -73.8601152 63 Road 11374 Queens Jewish/Kosher 1416787200 Z 20 Tov Kosher Kitchen 40356068
DROP TABLE t1;
#
# Dropping a column
......@@ -259,7 +258,6 @@ t1 CREATE TABLE `t1` (
`address_street` char(38) NOT NULL `FIELD_FORMAT`='address.street',
`address_zipcode` char(5) NOT NULL `FIELD_FORMAT`='address.zipcode',
`borough` char(13) NOT NULL,
`grades` char(1) DEFAULT NULL,
`grades_date` bigint(13) DEFAULT NULL `FIELD_FORMAT`='grades.0.date',
`grades_grade` char(14) DEFAULT NULL `FIELD_FORMAT`='grades.0.grade',
`grades_score` bigint(2) DEFAULT NULL `FIELD_FORMAT`='grades.0.score',
......@@ -384,3 +382,4 @@ planner 167 41.75
postcard 23 5.75
DROP TABLE t1;
true
set connect_enable_mongo=0;
set connect_enable_mongo=1;
#
# Test the MONGO table type
#
......@@ -24,7 +25,6 @@ address_street 1 CHAR 38 38 0 0 address.street
address_zipcode 1 CHAR 5 5 0 0 address.zipcode
borough 1 CHAR 13 13 0 0
cuisine 1 CHAR 64 64 0 0
grades 1 CHAR 0 0 0 1
grades_date 1 CHAR 256 256 0 1 grades.0.date
grades_grade 1 CHAR 14 14 0 1 grades.0.grade
grades_score 5 BIGINT 2 2 0 1 grades.0.score
......@@ -71,7 +71,6 @@ t1 CREATE TABLE `t1` (
`address_zipcode` char(5) NOT NULL `FIELD_FORMAT`='address.zipcode',
`borough` char(13) NOT NULL,
`cuisine` char(64) NOT NULL,
`grades` char(1) DEFAULT NULL,
`grades_date` varchar(256) DEFAULT NULL `FIELD_FORMAT`='grades.0.date',
`grades_grade` char(14) DEFAULT NULL `FIELD_FORMAT`='grades.0.grade',
`grades_score` bigint(2) DEFAULT NULL `FIELD_FORMAT`='grades.0.score',
......@@ -79,12 +78,12 @@ t1 CREATE TABLE `t1` (
`restaurant_id` char(8) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='mongodb://localhost:27017' `TABLE_TYPE`='JSON' `TABNAME`='restaurants' `OPTION_LIST`='Level=1,Driver=C,Version=0' `DATA_CHARSET`='utf8' `LRECL`=1024
SELECT * FROM t1 LIMIT 5;
_id address_building address_coord address_street address_zipcode borough cuisine grades grades_date grades_grade grades_score name restaurant_id
58ada47de5a51ddfcd5ed51c 1007 -73.856076999999999089 Morris Park Ave 10462 Bronx Bakery 1 1393804800 A 2 Morris Park Bake Shop 30075445
58ada47de5a51ddfcd5ed51d 469 -73.96170399999999745 Flatbush Avenue 11225 Brooklyn Hamburgers 1 1419897600 A 8 Wendy'S 30112340
58ada47de5a51ddfcd5ed51e 351 -73.985135599999992451 West 57 Street 10019 Manhattan Irish 1 1409961600 A 2 Dj Reynolds Pub And Restaurant 30191841
58ada47de5a51ddfcd5ed51f 2780 -73.982419999999990523 Stillwell Avenue 11224 Brooklyn American 1 1402358400 A 5 Riviera Caterer 40356018
58ada47de5a51ddfcd5ed520 97-22 -73.860115199999995639 63 Road 11374 Queens Jewish/Kosher 1 1416787200 Z 20 Tov Kosher Kitchen 40356068
_id address_building address_coord address_street address_zipcode borough cuisine grades_date grades_grade grades_score name restaurant_id
58ada47de5a51ddfcd5ed51c 1007 -73.856076999999999089 Morris Park Ave 10462 Bronx Bakery 1393804800 A 2 Morris Park Bake Shop 30075445
58ada47de5a51ddfcd5ed51d 469 -73.96170399999999745 Flatbush Avenue 11225 Brooklyn Hamburgers 1419897600 A 8 Wendy'S 30112340
58ada47de5a51ddfcd5ed51e 351 -73.985135599999992451 West 57 Street 10019 Manhattan Irish 1409961600 A 2 Dj Reynolds Pub And Restaurant 30191841
58ada47de5a51ddfcd5ed51f 2780 -73.982419999999990523 Stillwell Avenue 11224 Brooklyn American 1402358400 A 5 Riviera Caterer 40356018
58ada47de5a51ddfcd5ed520 97-22 -73.860115199999995639 63 Road 11374 Queens Jewish/Kosher 1416787200 Z 20 Tov Kosher Kitchen 40356068
DROP TABLE t1;
#
# Dropping a column
......@@ -258,7 +257,6 @@ t1 CREATE TABLE `t1` (
`address_street` char(38) NOT NULL `FIELD_FORMAT`='address.street',
`address_zipcode` char(5) NOT NULL `FIELD_FORMAT`='address.zipcode',
`borough` char(13) NOT NULL,
`grades` char(1) DEFAULT NULL,
`grades_date` bigint(13) DEFAULT NULL `FIELD_FORMAT`='grades.0.date',
`grades_grade` char(14) DEFAULT NULL `FIELD_FORMAT`='grades.0.grade',
`grades_score` bigint(2) DEFAULT NULL `FIELD_FORMAT`='grades.0.score',
......@@ -383,3 +381,4 @@ planner 167 41.75
postcard 23 5.75
DROP TABLE t1;
true
set connect_enable_mongo=0;
set connect_enable_mongo=1;
#
# Test the MONGO table type
#
......@@ -376,3 +377,4 @@ planner 167 41.750000
postcard 23 5.750000
DROP TABLE t1;
true
set connect_enable_mongo=0;
SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo2.jar';
set connect_enable_mongo=1;
#
# Test the MONGO table type
#
......@@ -377,3 +378,4 @@ planner 167 41.75
postcard 23 5.75
DROP TABLE t1;
true
set connect_enable_mongo=0;
SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo3.jar';
set connect_enable_mongo=1;
#
# Test the MONGO table type
#
......@@ -377,3 +378,4 @@ planner 167 41.75
postcard 23 5.75
DROP TABLE t1;
true
set connect_enable_mongo=0;
......@@ -72,11 +72,11 @@ TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEngineOracle;UID=mtr;PWD=mtr'
CATFUNC=Columns;
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
NULL MTR T1 A 3 DECIMAL 38 40 0 10 1 NULL
NULL MTR T1 B 6 NUMBER 38 40 NULL NULL 1 NULL
NULL MTR T2 A 12 VARCHAR2 64 64 NULL NULL 1 NULL
NULL MTR V1 A 3 DECIMAL 38 40 0 10 1 NULL
NULL MTR V1 B 6 NUMBER 38 40 NULL NULL 1 NULL
MTR T1 A 3 DECIMAL 38 40 0 10 1
MTR T1 B 6 NUMBER 38 40 NULL NULL 1
MTR T2 A 12 VARCHAR2 64 64 NULL NULL 1
MTR V1 A 3 DECIMAL 38 40 0 10 1
MTR V1 B 6 NUMBER 38 40 NULL NULL 1
DROP TABLE t1;
# All columns in all schemas (limited with WHERE)
CREATE TABLE t1 ENGINE=CONNECT
......@@ -84,18 +84,18 @@ TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEngineOracle;UID=mtr;PWD=mtr'
CATFUNC=Columns TABNAME='%.%';
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
NULL MTR T1 A 3 DECIMAL 38 40 0 10 1 NULL
NULL MTR T1 B 6 NUMBER 38 40 NULL NULL 1 NULL
NULL MTR T2 A 12 VARCHAR2 64 64 NULL NULL 1 NULL
NULL MTR V1 A 3 DECIMAL 38 40 0 10 1 NULL
NULL MTR V1 B 6 NUMBER 38 40 NULL NULL 1 NULL
MTR T1 A 3 DECIMAL 38 40 0 10 1
MTR T1 B 6 NUMBER 38 40 NULL NULL 1
MTR T2 A 12 VARCHAR2 64 64 NULL NULL 1
MTR V1 A 3 DECIMAL 38 40 0 10 1
MTR V1 B 6 NUMBER 38 40 NULL NULL 1
DROP TABLE t1;
# 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';
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
NULL MTR T1 A 3 DECIMAL 38 40 0 10 1 NULL
NULL MTR T1 B 6 NUMBER 38 40 NULL NULL 1 NULL
MTR T1 A 3 DECIMAL 38 40 0 10 1
MTR T1 B 6 NUMBER 38 40 NULL NULL 1
DROP TABLE t1;
# Table "T1" in the schema "MTR"
CREATE TABLE t1 ENGINE=CONNECT
......@@ -103,8 +103,8 @@ TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEngineOracle;UID=mtr;PWD=mtr'
CATFUNC=Columns TABNAME='MTR.T1';
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
NULL MTR T1 A 3 DECIMAL 38 40 0 10 1 NULL
NULL MTR T1 B 6 NUMBER 38 40 NULL NULL 1 NULL
MTR T1 A 3 DECIMAL 38 40 0 10 1
MTR T1 B 6 NUMBER 38 40 NULL NULL 1
DROP TABLE t1;
# All tables "T1" in all schemas (filtered with WHERE)
CREATE TABLE t1 ENGINE=CONNECT
......@@ -112,8 +112,8 @@ 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;
Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks
NULL MTR T1 A 3 DECIMAL 38 40 0 10 1 NULL
NULL MTR T1 B 6 NUMBER 38 40 NULL NULL 1 NULL
MTR T1 A 3 DECIMAL 38 40 0 10 1
MTR T1 B 6 NUMBER 38 40 NULL NULL 1
DROP TABLE t1;
#
# Checking tables
......
set connect_enable_mongo=1;
--echo #
--echo # Test the MONGO table type
--echo #
......@@ -201,3 +203,5 @@ OPTION_LIST='Driver=$DRV,Version=$VERS,Pipeline=YES' $CONN;
SELECT * FROM t1;
DROP TABLE t1;
--exec $MONGO --eval "db.testcoll.drop()" --quiet
set connect_enable_mongo=0;
......@@ -789,7 +789,7 @@ int COLDEF::Define(PGLOBAL g, void *, PCOLINFO cfp, int poff)
Poff = poff;
Buf_Type = cfp->Type;
if ((Clen = GetTypeSize(Buf_Type, cfp->Length)) <= 0) {
if ((Clen = GetTypeSize(Buf_Type, cfp->Length)) < 0) {
sprintf(g->Message, MSG(BAD_COL_TYPE), GetTypeName(Buf_Type), Name);
return -1;
} // endswitch
......
......@@ -136,6 +136,7 @@ PQRYRES JSONColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt, bool info)
tdp->Base = GetIntegerTableOption(g, topt, "Base", 0) ? 1 : 0;
tdp->Pretty = GetIntegerTableOption(g, topt, "Pretty", 2);
tdp->Xcol = GetStringTableOption(g, topt, "Expand", NULL);
tdp->Accept = GetBooleanTableOption(g, topt, "Accept", false);
tdp->Uri = (dsn && *dsn ? dsn : NULL);
if (!tdp->Fn && !tdp->Uri) {
......@@ -365,7 +366,7 @@ PQRYRES JSONColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt, bool info)
jcp->Scale = MY_MAX(jcp->Scale, jcol.Scale);
jcp->Cbn |= jcol.Cbn;
jcp->Found = true;
} else {
} else if (jcol.Type != TYPE_UNKNOWN || tdp->Accept) {
// New column
jcp = (PJCL)PlugSubAlloc(g, NULL, sizeof(JCOL));
*jcp = jcol;
......@@ -448,8 +449,8 @@ PQRYRES JSONColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt, bool info)
/* Now get the results into blocks. */
/*********************************************************************/
for (i = 0, jcp = fjcp; jcp; i++, jcp = jcp->Next) {
if (jcp->Type == TYPE_UNKNOWN) // Void column
jcp->Type = TYPE_STRING;
if (jcp->Type == TYPE_UNKNOWN)
jcp->Type = TYPE_STRING; // Void column
crp = qrp->Colresp; // Column Name
crp->Kdata->SetValue(jcp->Name, i);
......
......@@ -1260,7 +1260,8 @@ MYSQLCOL::MYSQLCOL(MYSQL_FIELD *fld, PTDB tdbp, int i, PCSZ am)
: COLBLK(NULL, tdbp, i)
{
const char *chset = get_charset_name(fld->charsetnr);
char v = (!strcmp(chset, "binary")) ? 'B' : 0;
//char v = (!strcmp(chset, "binary")) ? 'B' : 0;
char v = 0;
Name = fld->name;
Opt = 0;
......
......@@ -186,7 +186,8 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db,
crp->Kdata->SetValue(colname, i);
chset = (char *)fp->charset()->name;
v = (!strcmp(chset, "binary")) ? 'B' : 0;
// v = (!strcmp(chset, "binary")) ? 'B' : 0;
v = 0;
if ((type = MYSQLtoPLG(fp->type(), &v)) == TYPE_ERROR) {
if (v == 'K') {
......
......@@ -176,7 +176,7 @@ int GetTypeSize(int type, int len)
case TYPE_DOUBLE: len = sizeof(double); break;
case TYPE_TINY: len = sizeof(char); break;
case TYPE_PCHAR: len = sizeof(char*); break;
default: len = 0;
default: len = -1;
} // endswitch type
return len;
......@@ -1370,7 +1370,7 @@ bool TYPVAL<PSZ>::SetValue_char(const char *cp, int n)
if (!cp || n == 0) {
Reset();
Null = Nullable;
Null = (cp) ? false : Nullable;
} else if (cp != Strp) {
const char *p = cp + n - 1;
......
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