Commit de197212 authored by Buggynours's avatar Buggynours

Fix of error and warnings when compiling on linux

	modifié :         storage/connect/ha_connect.cc
	modifié :         storage/connect/jsonudf.cpp
	nouveau fichier : storage/connect/mysql-test/connect/r/odbc_firebird.result
	modifié :         storage/connect/mysql-test/connect/t/json.test
	nouveau fichier : storage/connect/mysql-test/connect/t/odbc_firebird.test
	modifié :         storage/connect/tabodbc.cpp
	supprimé :        storage/connect/Makefile
parent 1816eca5
This diff is collapsed.
...@@ -169,7 +169,7 @@ ...@@ -169,7 +169,7 @@
#define JSONMAX 10 // JSON Default max grp size #define JSONMAX 10 // JSON Default max grp size
extern "C" { extern "C" {
char version[]= "Version 1.04.0003 October 20, 2015"; char version[]= "Version 1.04.0003 October 25, 2015";
#if defined(__WIN__) #if defined(__WIN__)
char compver[]= "Version 1.04.0003 " __DATE__ " " __TIME__; char compver[]= "Version 1.04.0003 " __DATE__ " " __TIME__;
char slash= '\\'; char slash= '\\';
...@@ -1114,7 +1114,7 @@ int GetIntegerTableOption(PGLOBAL g, PTOS options, char *opname, int idef) ...@@ -1114,7 +1114,7 @@ int GetIntegerTableOption(PGLOBAL g, PTOS options, char *opname, int idef)
else if (!stricmp(opname, "Compressed")) else if (!stricmp(opname, "Compressed"))
opval= (options->compressed); opval= (options->compressed);
if (opval == NO_IVAL) { if (opval == (unsigned)NO_IVAL) {
char *pv; char *pv;
if ((pv= GetListOption(g, opname, options->oplist))) if ((pv= GetListOption(g, opname, options->oplist)))
...@@ -2222,7 +2222,8 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL vop, char q, ...@@ -2222,7 +2222,8 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL vop, char q,
const key_range *kr) const key_range *kr)
{ {
const uchar *ptr; const uchar *ptr;
uint i, rem, len, klen, stlen; //uint i, rem, len, klen, stlen;
uint i, rem, len, stlen;
bool nq, both, oom= false; bool nq, both, oom= false;
OPVAL op; OPVAL op;
Field *fp; Field *fp;
...@@ -2255,7 +2256,8 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL vop, char q, ...@@ -2255,7 +2256,8 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL vop, char q,
else else
oom|= qry->Append(" WHERE ("); oom|= qry->Append(" WHERE (");
klen= len= ranges[i]->length; // klen= len= ranges[i]->length;
len= ranges[i]->length;
rem= kfp->user_defined_key_parts; rem= kfp->user_defined_key_parts;
ptr= ranges[i]->key; ptr= ranges[i]->key;
...@@ -2541,6 +2543,8 @@ PFIL ha_connect::CondFilter(PGLOBAL g, Item *cond) ...@@ -2541,6 +2543,8 @@ PFIL ha_connect::CondFilter(PGLOBAL g, Item *cond)
case MYSQL_TYPE_YEAR: case MYSQL_TYPE_YEAR:
case MYSQL_TYPE_NEWDATE: case MYSQL_TYPE_NEWDATE:
return NULL; return NULL;
default:
break;
} // endswitch type } // endswitch type
if (trace) { if (trace) {
......
...@@ -15,9 +15,14 @@ ...@@ -15,9 +15,14 @@
#include "jsonudf.h" #include "jsonudf.h"
#if defined(UNIX) || defined(UNIV_LINUX)
#define _O_RDONLY O_RDONLY
#endif
#define MEMFIX 4096 #define MEMFIX 4096
#if defined(connect_EXPORTS) #if defined(connect_EXPORTS)
#define PUSH_WARNING(M) \ #define PUSH_WARNING(M) \
push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, 0, M) push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, 0, M)
#else #else
#define PUSH_WARNING(M) htrc(M) #define PUSH_WARNING(M) htrc(M)
...@@ -1356,7 +1361,11 @@ static char *GetJsonFile(PGLOBAL g, char *fn) ...@@ -1356,7 +1361,11 @@ static char *GetJsonFile(PGLOBAL g, char *fn)
char *str; char *str;
int h, n, len; int h, n, len;
#if defined(UNIX) || defined(UNIV_LINUX)
h= open(fn, O_RDONLY);
#else
h= open(fn, _O_RDONLY, _O_TEXT); h= open(fn, _O_RDONLY, _O_TEXT);
#endif
if (h == -1) { if (h == -1) {
sprintf(g->Message, "Error %d opening %s", errno, fn); sprintf(g->Message, "Error %d opening %s", errno, fn);
...@@ -1504,7 +1513,7 @@ char *jsonvalue(UDF_INIT *initid, UDF_ARGS *args, char *result, ...@@ -1504,7 +1513,7 @@ char *jsonvalue(UDF_INIT *initid, UDF_ARGS *args, char *result,
return str; return str;
} // end of JsonValue } // end of JsonValue
void JsonValue_deinit(UDF_INIT* initid) void jsonvalue_deinit(UDF_INIT* initid)
{ {
JsonFreeMem((PGLOBAL)initid->ptr); JsonFreeMem((PGLOBAL)initid->ptr);
} // end of jsonvalue_deinit } // end of jsonvalue_deinit
...@@ -2804,12 +2813,12 @@ my_bool jsonlocate_init(UDF_INIT *initid, UDF_ARGS *args, char *message) ...@@ -2804,12 +2813,12 @@ my_bool jsonlocate_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
strcpy(message, "Fourth argument is not an integer (memory)"); strcpy(message, "Fourth argument is not an integer (memory)");
return true; return true;
} else } else
more = (ulong)*(longlong*)args->args[2]; more += (ulong)*(longlong*)args->args[2];
CalcLen(args, false, reslen, memlen); CalcLen(args, false, reslen, memlen);
if (IsJson(args, 0) != 3) if (IsJson(args, 0) != 3)
memlen += 1000; // TODO: calculate this memlen += more; // TODO: calculate this
return JsonInit(initid, args, message, true, reslen, memlen); return JsonInit(initid, args, message, true, reslen, memlen);
} // end of jsonlocate_init } // end of jsonlocate_init
...@@ -2905,7 +2914,7 @@ char *jsonlocate(UDF_INIT *initid, UDF_ARGS *args, char *result, ...@@ -2905,7 +2914,7 @@ char *jsonlocate(UDF_INIT *initid, UDF_ARGS *args, char *result,
return NULL; return NULL;
} // end of jsonlocate } // end of jsonlocate
void json_locate_deinit(UDF_INIT* initid) void jsonlocate_deinit(UDF_INIT* initid)
{ {
JsonFreeMem((PGLOBAL)initid->ptr); JsonFreeMem((PGLOBAL)initid->ptr);
} // end of jsonlocate_deinit } // end of jsonlocate_deinit
...@@ -2931,14 +2940,14 @@ my_bool json_locate_all_init(UDF_INIT *initid, UDF_ARGS *args, char *message) ...@@ -2931,14 +2940,14 @@ my_bool json_locate_all_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
strcpy(message, "Fourth argument is not an integer (memory)"); strcpy(message, "Fourth argument is not an integer (memory)");
return true; return true;
} else } else
more = (ulong)*(longlong*)args->args[2]; more += (ulong)*(longlong*)args->args[2];
CalcLen(args, false, reslen, memlen); CalcLen(args, false, reslen, memlen);
if (IsJson(args, 0) != 3) if (IsJson(args, 0) != 3)
memlen += 1000; // TODO: calculate this memlen += more; // TODO: calculate this
return JsonInit(initid, args, message, true, reslen, memlen); return JsonInit(initid, args, message, true, reslen, memlen);
} // end of json_locate_all_init } // end of json_locate_all_init
char *json_locate_all(UDF_INIT *initid, UDF_ARGS *args, char *result, char *json_locate_all(UDF_INIT *initid, UDF_ARGS *args, char *result,
...@@ -3237,6 +3246,8 @@ char *jfile_make(UDF_INIT *initid, UDF_ARGS *args, char *result, ...@@ -3237,6 +3246,8 @@ char *jfile_make(UDF_INIT *initid, UDF_ARGS *args, char *result,
case INT_RESULT: case INT_RESULT:
pretty = (int)*(longlong*)args->args[i]; pretty = (int)*(longlong*)args->args[i];
break; break;
default:
PUSH_WARNING("Unexpected argument type in jfile_make");
} // endswitch arg_type } // endswitch arg_type
if (fn) { if (fn) {
...@@ -3397,12 +3408,12 @@ char *jbin_array_add(UDF_INIT *initid, UDF_ARGS *args, char *result, ...@@ -3397,12 +3408,12 @@ char *jbin_array_add(UDF_INIT *initid, UDF_ARGS *args, char *result,
if (!CheckMemory(g, initid, args, 2, false, true)) { if (!CheckMemory(g, initid, args, 2, false, true)) {
int *x = NULL; int *x = NULL;
uint n = 2; uint n = 2;
PJSON jsp; // PJSON jsp;
PJVAL jvp; PJVAL jvp;
PJAR arp; PJAR arp;
jvp = MakeValue(g, args, 0, &top); jvp = MakeValue(g, args, 0, &top);
jsp = jvp->GetJson(); // jsp = jvp->GetJson();
x = GetIntArgPtr(g, args, n); x = GetIntArgPtr(g, args, n);
if (CheckPath(g, args, top, jvp, n)) if (CheckPath(g, args, top, jvp, n))
......
SET NAMES utf8;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='Bad connection string';
ERROR HY000: SQLDriverConnect: [unixODBC][Driver Manager]Data source name not found, and no default driver specified
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CATFUNC=Sources;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`Name` varchar(256) NOT NULL,
`Description` varchar(256) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='ODBC' `CATFUNC`='Sources'
SELECT * FROM t1;
Name Description
Firebird Firebird
DROP TABLE t1;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CATFUNC=Drivers;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`Description` char(128) NOT NULL,
`Attributes` varchar(256) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='ODBC' `CATFUNC`='Drivers'
SELECT * FROM t1;
Description Attributes
Firebird Description=Firebird ODBC Driver in usr;Driver=/usr/local/lib/libOdbcFb.so;Setup=/usr/local/lib/libOdbcFb.so;FileUsage=1;
DROP TABLE t1;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CATFUNC=Tables CONNECTION='Not important';
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`Table_Cat` char(128) NOT NULL,
`Table_Schema` char(128) NOT NULL,
`Table_Name` char(128) NOT NULL,
`Table_Type` char(16) NOT NULL,
`Remark` char(255) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='Not important' `TABLE_TYPE`='ODBC' `CATFUNC`='Tables'
DROP TABLE t1;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CATFUNC=Columns CONNECTION='Not important';
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`Table_Cat` char(128) NOT NULL,
`Table_Schema` char(128) NOT NULL,
`Table_Name` char(128) NOT NULL,
`Column_Name` char(128) NOT NULL,
`Data_Type` smallint(6) NOT NULL,
`Type_Name` char(30) NOT NULL,
`Column_Size` int(10) NOT NULL,
`Buffer_Length` int(10) NOT NULL,
`Decimal_Digits` smallint(6) NOT NULL,
`Radix` smallint(6) NOT NULL,
`Nullable` smallint(6) NOT NULL,
`Remarks` char(255) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='Not important' `TABLE_TYPE`='ODBC' `CATFUNC`='Columns'
DROP TABLE t1;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC TABNAME='EMPLOYEE' CONNECTION='DSN=Firebird;UID=SYSDBA;PWD=manager';
SELECT * FROM t1;
EMP_NO FIRST_NAME LAST_NAME PHONE_EXT HIRE_DATE DEPT_NO JOB_CODE JOB_GRADE JOB_COUNTRY SALARY FULL_NAME
2 Robert Nelson 250 1988-12-28 00:00:00 600 VP 2 USA 105900.00 Nelson, Robert
4 Bruce Young 233 1988-12-28 00:00:00 621 Eng 2 USA 97500.00 Young, Bruce
5 Kim Lambert 22 1989-02-06 00:00:00 130 Eng 2 USA 102750.00 Lambert, Kim
8 Leslie Johnson 410 1989-04-05 00:00:00 180 Mktg 3 USA 64635.00 Johnson, Leslie
9 Phil Forest 229 1989-04-17 00:00:00 622 Mngr 3 USA 75060.00 Forest, Phil
11 K. J. Weston 34 1990-01-17 00:00:00 130 SRep 4 USA 86292.94 Weston, K. J.
12 Terri Lee 256 1990-05-01 00:00:00 000 Admin 4 USA 53793.00 Lee, Terri
14 Stewart Hall 227 1990-06-04 00:00:00 900 Finan 3 USA 69482.63 Hall, Stewart
15 Katherine Young 231 1990-06-14 00:00:00 623 Mngr 3 USA 67241.25 Young, Katherine
20 Chris Papadopoulos 887 1990-01-01 00:00:00 671 Mngr 3 USA 89655.00 Papadopoulos, Chris
24 Pete Fisher 888 1990-09-12 00:00:00 671 Eng 3 USA 81810.19 Fisher, Pete
28 Ann Bennet 5 1991-02-01 00:00:00 120 Admin 5 England 22935.00 Bennet, Ann
29 Roger De Souza 288 1991-02-18 00:00:00 623 Eng 3 USA 69482.63 De Souza, Roger
34 Janet Baldwin 2 1991-03-21 00:00:00 110 Sales 3 USA 61637.81 Baldwin, Janet
36 Roger Reeves 6 1991-04-25 00:00:00 120 Sales 3 England 33620.63 Reeves, Roger
37 Willie Stansbury 7 1991-04-25 00:00:00 120 Eng 4 England 39224.06 Stansbury, Willie
44 Leslie Phong 216 1991-06-03 00:00:00 623 Eng 4 USA 56034.38 Phong, Leslie
45 Ashok Ramanathan 209 1991-08-01 00:00:00 621 Eng 3 USA 80689.50 Ramanathan, Ashok
46 Walter Steadman 210 1991-08-09 00:00:00 900 CFO 1 USA 116100.00 Steadman, Walter
52 Carol Nordstrom 420 1991-10-02 00:00:00 180 PRel 4 USA 42742.50 Nordstrom, Carol
61 Luke Leung 3 1992-02-18 00:00:00 110 SRep 4 USA 68805.00 Leung, Luke
65 Sue Anne O'Brien 877 1992-03-23 00:00:00 670 Admin 5 USA 31275.00 O'Brien, Sue Anne
71 Jennifer M. Burbank 289 1992-04-15 00:00:00 622 Eng 3 USA 53167.50 Burbank, Jennifer M.
72 Claudia Sutherland NULL 1992-04-20 00:00:00 140 SRep 4 Canada 100914.00 Sutherland, Claudia
83 Dana Bishop 290 1992-06-01 00:00:00 621 Eng 3 USA 62550.00 Bishop, Dana
85 Mary S. MacDonald 477 1992-06-01 00:00:00 100 VP 2 USA 111262.50 MacDonald, Mary S.
94 Randy Williams 892 1992-08-08 00:00:00 672 Mngr 4 USA 56295.00 Williams, Randy
105 Oliver H. Bender 255 1992-10-08 00:00:00 000 CEO 1 USA 212850.00 Bender, Oliver H.
107 Kevin Cook 894 1993-02-01 00:00:00 670 Dir 2 USA 111262.50 Cook, Kevin
109 Kelly Brown 202 1993-02-04 00:00:00 600 Admin 5 USA 27000.00 Brown, Kelly
110 Yuki Ichida 22 1993-02-04 00:00:00 115 Eng 3 Japan 6000000.00 Ichida, Yuki
113 Mary Page 845 1993-04-12 00:00:00 671 Eng 4 USA 48000.00 Page, Mary
114 Bill Parker 247 1993-06-01 00:00:00 623 Eng 5 USA 35000.00 Parker, Bill
118 Takashi Yamamoto 23 1993-07-01 00:00:00 115 SRep 4 Japan 7480000.00 Yamamoto, Takashi
121 Roberto Ferrari 1 1993-07-12 00:00:00 125 SRep 4 Italy 99000000.00 Ferrari, Roberto
127 Michael Yanowski 492 1993-08-09 00:00:00 100 SRep 4 USA 44000.00 Yanowski, Michael
134 Jacques Glon NULL 1993-08-23 00:00:00 123 SRep 4 France 390500.00 Glon, Jacques
136 Scott Johnson 265 1993-09-13 00:00:00 623 Doc 3 USA 60000.00 Johnson, Scott
138 T.J. Green 218 1993-11-01 00:00:00 621 Eng 4 USA 36000.00 Green, T.J.
141 Pierre Osborne NULL 1994-01-03 00:00:00 121 SRep 4 Switzerland 110000.00 Osborne, Pierre
144 John Montgomery 820 1994-03-30 00:00:00 672 Eng 5 USA 35000.00 Montgomery, John
145 Mark Guckenheimer 221 1994-05-02 00:00:00 622 Eng 5 USA 32000.00 Guckenheimer, Mark
DROP TABLE t1;
...@@ -135,7 +135,7 @@ CREATE TABLE t1 ...@@ -135,7 +135,7 @@ CREATE TABLE t1
Year int(4) FIELD_FORMAT='DATEPUB', Year int(4) FIELD_FORMAT='DATEPUB',
INDEX IX(ISBN) INDEX IX(ISBN)
) )
ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='bib0.json' LRECL=320 OPTION_LIST='Pretty=0'; ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='bib0.json' LRECL=350 OPTION_LIST='Pretty=0';
SHOW INDEX FROM t1; SHOW INDEX FROM t1;
SELECT * FROM t1; SELECT * FROM t1;
DESCRIBE SELECT * FROM t1 WHERE ISBN = '9782212090819'; DESCRIBE SELECT * FROM t1 WHERE ISBN = '9782212090819';
......
--source have_odbc.inc
SET NAMES utf8;
# MS ODBC and unixODBC return different error message text,
# so disable displaying error messages
#--disable_result_log ONCE
--error ER_UNKNOWN_ERROR
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='Bad connection string';
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CATFUNC=Sources;
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CATFUNC=Drivers;
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CATFUNC=Tables CONNECTION='Not important';
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CATFUNC=Columns CONNECTION='Not important';
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC TABNAME='EMPLOYEE' CONNECTION='DSN=Firebird;UID=SYSDBA;PWD=manager';
SELECT * FROM t1;
DROP TABLE t1;
...@@ -513,7 +513,7 @@ bool TDBODBC::MakeInsert(PGLOBAL g) ...@@ -513,7 +513,7 @@ bool TDBODBC::MakeInsert(PGLOBAL g)
{ {
char *schmp = NULL, *catp = NULL, buf[NAM_LEN * 3]; char *schmp = NULL, *catp = NULL, buf[NAM_LEN * 3];
int len = 0; int len = 0;
bool b = false, oom; bool b = false, oom = false;
PTABLE tablep = To_Table; PTABLE tablep = To_Table;
PCOL colp; PCOL colp;
......
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