Skip to content

Commit 3c5733c

Browse files
committed
Merge branch 'connect/10.0' into 10.0
2 parents 6a28882 + 41a3c58 commit 3c5733c

File tree

7 files changed

+66
-29
lines changed

7 files changed

+66
-29
lines changed

storage/connect/ha_connect.cc

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
#define JSONMAX 10 // JSON Default max grp size
170170

171171
extern "C" {
172-
char version[]= "Version 1.03.0007 July 05, 2015";
172+
char version[]= "Version 1.03.0007 October 20, 2015";
173173
#if defined(__WIN__)
174174
char compver[]= "Version 1.03.0007 " __DATE__ " " __TIME__;
175175
char slash= '\\';
@@ -1134,7 +1134,10 @@ PTOS ha_connect::GetTableOptionStruct(TABLE_SHARE *s)
11341134
{
11351135
TABLE_SHARE *tsp= (tshp) ? tshp : (s) ? s : table_share;
11361136

1137-
return (tsp) ? tsp->option_struct : NULL;
1137+
return (tsp && (!tsp->db_plugin ||
1138+
!stricmp(plugin_name(tsp->db_plugin)->str, "connect") ||
1139+
!stricmp(plugin_name(tsp->db_plugin)->str, "partition")))
1140+
? tsp->option_struct : NULL;
11381141
} // end of GetTableOptionStruct
11391142

11401143
/****************************************************************************/
@@ -2471,7 +2474,18 @@ PFIL ha_connect::CondFilter(PGLOBAL g, Item *cond)
24712474
!(colp[i]= tdbp->ColDB(g, (PSZ)pField->field->field_name, 0)))
24722475
return NULL; // Column does not belong to this table
24732476

2474-
if (trace) {
2477+
// These types are not yet implemented (buggy)
2478+
switch (pField->field->type()) {
2479+
case MYSQL_TYPE_TIMESTAMP:
2480+
case MYSQL_TYPE_DATE:
2481+
case MYSQL_TYPE_TIME:
2482+
case MYSQL_TYPE_DATETIME:
2483+
case MYSQL_TYPE_YEAR:
2484+
case MYSQL_TYPE_NEWDATE:
2485+
return NULL;
2486+
} // endswitch type
2487+
2488+
if (trace) {
24752489
htrc("Field index=%d\n", pField->field->field_index);
24762490
htrc("Field name=%s\n", pField->field->field_name);
24772491
} // endif trace
@@ -2486,12 +2500,10 @@ PFIL ha_connect::CondFilter(PGLOBAL g, Item *cond)
24862500
if (!i && (ismul))
24872501
return NULL;
24882502

2489-
if ((res= pval->val_str(&tmp)) == NULL)
2490-
return NULL; // To be clarified
2491-
2492-
switch (args[i]->real_type()) {
2503+
switch (args[i]->real_type()) {
24932504
case COND::STRING_ITEM:
2494-
pp->Value= PlugSubAllocStr(g, NULL, res->ptr(), res->length());
2505+
res= pval->val_str(&tmp);
2506+
pp->Value= PlugSubAllocStr(g, NULL, res->ptr(), res->length());
24952507
pp->Type= (pp->Value) ? TYPE_STRING : TYPE_ERROR;
24962508
break;
24972509
case COND::INT_ITEM:
@@ -2520,8 +2532,8 @@ PFIL ha_connect::CondFilter(PGLOBAL g, Item *cond)
25202532
return NULL;
25212533
} // endswitch type
25222534

2523-
if (trace)
2524-
htrc("Value=%.*s\n", res->length(), res->ptr());
2535+
if (trace)
2536+
htrc("Value type=%hd\n", pp->Type);
25252537

25262538
// Append the value to the argument list
25272539
if (pprec)

storage/connect/odbconn.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2360,9 +2360,11 @@ int ODBConn::GetCatInfo(CATPARM *cap)
23602360
} // endif rc
23612361

23622362
for (n = 0, crp = qrp->Colresp; crp; n++, crp = crp->Next) {
2363-
if (vlen[n] == SQL_NULL_DATA)
2363+
if (vlen[n] == SQL_NO_TOTAL)
2364+
ThrowDBX("Unexpected SQL_NO_TOTAL returned from SQLFetch");
2365+
else if (vlen[n] == SQL_NULL_DATA)
23642366
pval[n]->SetNull(true);
2365-
else if (crp->Type == TYPE_STRING && vlen[n] != SQL_NULL_DATA)
2367+
else if (crp->Type == TYPE_STRING/* && vlen[n] != SQL_NULL_DATA*/)
23662368
pval[n]->SetValue_char(pbuf[n], vlen[n]);
23672369
else
23682370
pval[n]->SetNull(false);

storage/connect/reldef.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ class DllExport COLDEF : public COLCRT { /* Column description block
193193
friend class COLBLK;
194194
friend class DBFFAM;
195195
friend class TDBASE;
196-
public:
196+
friend class TDBDOS;
197+
public:
197198
COLDEF(void); // Constructor
198199

199200
// Implementation

storage/connect/tabdos.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2018,7 +2018,8 @@ int TDBDOS::EstimatedLength(void)
20182018
// result if we set dep to 1
20192019
dep = 1 + cdp->GetLong() / 20; // Why 20 ?????
20202020
} else for (; cdp; cdp = cdp->GetNext())
2021-
dep = MY_MAX(dep, cdp->GetOffset());
2021+
if (!(cdp->Flags & (U_VIRTUAL|U_SPECIAL)))
2022+
dep = MY_MAX(dep, cdp->GetOffset());
20222023

20232024
return (int)dep;
20242025
} // end of Estimated Length

storage/connect/tabjson.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ int TDBJSN::MakeTopTree(PGLOBAL g, PJSON jsp)
755755
} else
756756
strcpy(To_Line, s);
757757

758-
Row->Clear();
758+
// Row->Clear();
759759
return false;
760760
} else
761761
return true;
@@ -979,7 +979,8 @@ bool JSONCOL::ParseJpath(PGLOBAL g)
979979
if (!stricmp(Name, colp->GetName())) {
980980
Nod = colp->Nod;
981981
Nodes = colp->Nodes;
982-
goto fin;
982+
Xpd = colp->Xpd;
983+
goto fin;
983984
} // endif Name
984985

985986
sprintf(g->Message, "Cannot parse updated column %s", Name);
@@ -1347,7 +1348,12 @@ PJSON JSONCOL::GetRow(PGLOBAL g)
13471348
/***********************************************************************/
13481349
void JSONCOL::WriteColumn(PGLOBAL g)
13491350
{
1350-
/*********************************************************************/
1351+
if (Xpd && Tjp->Pretty < 2) {
1352+
strcpy(g->Message, "Cannot write expanded column when Pretty is not 2");
1353+
longjmp(g->jumper[g->jump_level], 666);
1354+
} // endif Xpd
1355+
1356+
/*********************************************************************/
13511357
/* Check whether this node must be written. */
13521358
/*********************************************************************/
13531359
if (Value != To_Val)

storage/connect/tabodbc.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,21 @@ PSZ TDBODBC::GetFile(PGLOBAL g)
321321
{
322322
if (Connect) {
323323
char *p1, *p2;
324-
size_t n;
324+
int i;
325+
size_t n;
325326

326-
if ((p1 = strstr(Connect, "DBQ="))) {
327-
p1 += 4; // Beginning of file name
327+
if (!(p1 = strstr(Connect, "DBQ="))) {
328+
char *p, *lc = strlwr(PlugDup(g, Connect));
329+
330+
if ((p = strstr(lc, "database=")))
331+
p1 = Connect + (p - lc);
332+
333+
i = 9;
334+
} else
335+
i = 4;
336+
337+
if (p1) {
338+
p1 += i; // Beginning of file name
328339
p2 = strchr(p1, ';'); // End of file path/name
329340

330341
// Make the File path/name from the connect string

storage/connect/value.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ ulonglong CharToNumber(char *p, int n, ulonglong maxval,
103103

104104
if (minus) *minus = false;
105105
if (rc) *rc = false;
106+
if (n <= 0) return 0LL;
106107

107108
// Eliminate leading blanks or 0
108109
for (p2 = p + n; p < p2 && (*p == ' ' || *p == '0'); p++) ;
@@ -705,7 +706,7 @@ bool TYPVAL<TYPE>::SetValue_char(char *p, int n)
705706
template <>
706707
bool TYPVAL<double>::SetValue_char(char *p, int n)
707708
{
708-
if (p) {
709+
if (p && n > 0) {
709710
char buf[64];
710711

711712
for (; n > 0 && *p == ' '; p++)
@@ -1345,7 +1346,7 @@ bool TYPVAL<PSZ>::SetValue_char(char *p, int n)
13451346
{
13461347
bool rc;
13471348

1348-
if (p) {
1349+
if (p && n > 0) {
13491350
rc = n > Len;
13501351

13511352
if ((n = MY_MIN(n, Len))) {
@@ -1804,7 +1805,7 @@ bool DECVAL::SetValue_char(char *p, int n)
18041805
{
18051806
bool rc;
18061807

1807-
if (p) {
1808+
if (p && n > 0) {
18081809
rc = n > Len;
18091810

18101811
if ((n = MY_MIN(n, Len))) {
@@ -2095,7 +2096,7 @@ bool BINVAL::SetValue_char(char *p, int n)
20952096
{
20962097
bool rc;
20972098

2098-
if (p) {
2099+
if (p && n > 0) {
20992100
rc = n > Clen;
21002101
Len = MY_MIN(n, Clen);
21012102
memcpy(Binp, p, Len);
@@ -2672,13 +2673,16 @@ bool DTVAL::SetValue_char(char *p, int n)
26722673
int ndv;
26732674
int dval[6];
26742675

2675-
// Trim trailing blanks
2676-
for (p2 = p + n -1; p < p2 && *p2 == ' '; p2--) ;
2676+
if (n > 0) {
2677+
// Trim trailing blanks
2678+
for (p2 = p + n -1; p < p2 && *p2 == ' '; p2--);
26772679

2678-
if ((rc = (n = p2 - p + 1) > Len))
2679-
n = Len;
2680+
if ((rc = (n = p2 - p + 1) > Len))
2681+
n = Len;
2682+
2683+
memcpy(Sdate, p, n);
2684+
} // endif n
26802685

2681-
memcpy(Sdate, p, n);
26822686
Sdate[n] = '\0';
26832687

26842688
ndv = ExtractDate(Sdate, Pdtp, DefYear, dval);

0 commit comments

Comments
 (0)