Commit 3c5733cd authored by Sergei Golubchik's avatar Sergei Golubchik

Merge branch 'connect/10.0' into 10.0

parents 6a28882b 41a3c58e
...@@ -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.03.0007 July 05, 2015"; char version[]= "Version 1.03.0007 October 20, 2015";
#if defined(__WIN__) #if defined(__WIN__)
char compver[]= "Version 1.03.0007 " __DATE__ " " __TIME__; char compver[]= "Version 1.03.0007 " __DATE__ " " __TIME__;
char slash= '\\'; char slash= '\\';
...@@ -1134,7 +1134,10 @@ PTOS ha_connect::GetTableOptionStruct(TABLE_SHARE *s) ...@@ -1134,7 +1134,10 @@ PTOS ha_connect::GetTableOptionStruct(TABLE_SHARE *s)
{ {
TABLE_SHARE *tsp= (tshp) ? tshp : (s) ? s : table_share; TABLE_SHARE *tsp= (tshp) ? tshp : (s) ? s : table_share;
return (tsp) ? tsp->option_struct : NULL; return (tsp && (!tsp->db_plugin ||
!stricmp(plugin_name(tsp->db_plugin)->str, "connect") ||
!stricmp(plugin_name(tsp->db_plugin)->str, "partition")))
? tsp->option_struct : NULL;
} // end of GetTableOptionStruct } // end of GetTableOptionStruct
/****************************************************************************/ /****************************************************************************/
...@@ -2471,6 +2474,17 @@ PFIL ha_connect::CondFilter(PGLOBAL g, Item *cond) ...@@ -2471,6 +2474,17 @@ PFIL ha_connect::CondFilter(PGLOBAL g, Item *cond)
!(colp[i]= tdbp->ColDB(g, (PSZ)pField->field->field_name, 0))) !(colp[i]= tdbp->ColDB(g, (PSZ)pField->field->field_name, 0)))
return NULL; // Column does not belong to this table return NULL; // Column does not belong to this table
// These types are not yet implemented (buggy)
switch (pField->field->type()) {
case MYSQL_TYPE_TIMESTAMP:
case MYSQL_TYPE_DATE:
case MYSQL_TYPE_TIME:
case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_YEAR:
case MYSQL_TYPE_NEWDATE:
return NULL;
} // endswitch type
if (trace) { if (trace) {
htrc("Field index=%d\n", pField->field->field_index); htrc("Field index=%d\n", pField->field->field_index);
htrc("Field name=%s\n", pField->field->field_name); htrc("Field name=%s\n", pField->field->field_name);
...@@ -2486,11 +2500,9 @@ PFIL ha_connect::CondFilter(PGLOBAL g, Item *cond) ...@@ -2486,11 +2500,9 @@ PFIL ha_connect::CondFilter(PGLOBAL g, Item *cond)
if (!i && (ismul)) if (!i && (ismul))
return NULL; return NULL;
if ((res= pval->val_str(&tmp)) == NULL)
return NULL; // To be clarified
switch (args[i]->real_type()) { switch (args[i]->real_type()) {
case COND::STRING_ITEM: case COND::STRING_ITEM:
res= pval->val_str(&tmp);
pp->Value= PlugSubAllocStr(g, NULL, res->ptr(), res->length()); pp->Value= PlugSubAllocStr(g, NULL, res->ptr(), res->length());
pp->Type= (pp->Value) ? TYPE_STRING : TYPE_ERROR; pp->Type= (pp->Value) ? TYPE_STRING : TYPE_ERROR;
break; break;
...@@ -2521,7 +2533,7 @@ PFIL ha_connect::CondFilter(PGLOBAL g, Item *cond) ...@@ -2521,7 +2533,7 @@ PFIL ha_connect::CondFilter(PGLOBAL g, Item *cond)
} // endswitch type } // endswitch type
if (trace) if (trace)
htrc("Value=%.*s\n", res->length(), res->ptr()); htrc("Value type=%hd\n", pp->Type);
// Append the value to the argument list // Append the value to the argument list
if (pprec) if (pprec)
......
...@@ -2360,9 +2360,11 @@ int ODBConn::GetCatInfo(CATPARM *cap) ...@@ -2360,9 +2360,11 @@ int ODBConn::GetCatInfo(CATPARM *cap)
} // endif rc } // endif rc
for (n = 0, crp = qrp->Colresp; crp; n++, crp = crp->Next) { for (n = 0, crp = qrp->Colresp; crp; n++, crp = crp->Next) {
if (vlen[n] == SQL_NULL_DATA) if (vlen[n] == SQL_NO_TOTAL)
ThrowDBX("Unexpected SQL_NO_TOTAL returned from SQLFetch");
else if (vlen[n] == SQL_NULL_DATA)
pval[n]->SetNull(true); pval[n]->SetNull(true);
else if (crp->Type == TYPE_STRING && vlen[n] != SQL_NULL_DATA) else if (crp->Type == TYPE_STRING/* && vlen[n] != SQL_NULL_DATA*/)
pval[n]->SetValue_char(pbuf[n], vlen[n]); pval[n]->SetValue_char(pbuf[n], vlen[n]);
else else
pval[n]->SetNull(false); pval[n]->SetNull(false);
......
...@@ -193,7 +193,8 @@ class DllExport COLDEF : public COLCRT { /* Column description block ...@@ -193,7 +193,8 @@ class DllExport COLDEF : public COLCRT { /* Column description block
friend class COLBLK; friend class COLBLK;
friend class DBFFAM; friend class DBFFAM;
friend class TDBASE; friend class TDBASE;
public: friend class TDBDOS;
public:
COLDEF(void); // Constructor COLDEF(void); // Constructor
// Implementation // Implementation
......
...@@ -2018,6 +2018,7 @@ int TDBDOS::EstimatedLength(void) ...@@ -2018,6 +2018,7 @@ int TDBDOS::EstimatedLength(void)
// result if we set dep to 1 // result if we set dep to 1
dep = 1 + cdp->GetLong() / 20; // Why 20 ????? dep = 1 + cdp->GetLong() / 20; // Why 20 ?????
} else for (; cdp; cdp = cdp->GetNext()) } else for (; cdp; cdp = cdp->GetNext())
if (!(cdp->Flags & (U_VIRTUAL|U_SPECIAL)))
dep = MY_MAX(dep, cdp->GetOffset()); dep = MY_MAX(dep, cdp->GetOffset());
return (int)dep; return (int)dep;
......
...@@ -755,7 +755,7 @@ int TDBJSN::MakeTopTree(PGLOBAL g, PJSON jsp) ...@@ -755,7 +755,7 @@ int TDBJSN::MakeTopTree(PGLOBAL g, PJSON jsp)
} else } else
strcpy(To_Line, s); strcpy(To_Line, s);
Row->Clear(); // Row->Clear();
return false; return false;
} else } else
return true; return true;
...@@ -979,6 +979,7 @@ bool JSONCOL::ParseJpath(PGLOBAL g) ...@@ -979,6 +979,7 @@ bool JSONCOL::ParseJpath(PGLOBAL g)
if (!stricmp(Name, colp->GetName())) { if (!stricmp(Name, colp->GetName())) {
Nod = colp->Nod; Nod = colp->Nod;
Nodes = colp->Nodes; Nodes = colp->Nodes;
Xpd = colp->Xpd;
goto fin; goto fin;
} // endif Name } // endif Name
...@@ -1347,6 +1348,11 @@ PJSON JSONCOL::GetRow(PGLOBAL g) ...@@ -1347,6 +1348,11 @@ PJSON JSONCOL::GetRow(PGLOBAL g)
/***********************************************************************/ /***********************************************************************/
void JSONCOL::WriteColumn(PGLOBAL g) void JSONCOL::WriteColumn(PGLOBAL g)
{ {
if (Xpd && Tjp->Pretty < 2) {
strcpy(g->Message, "Cannot write expanded column when Pretty is not 2");
longjmp(g->jumper[g->jump_level], 666);
} // endif Xpd
/*********************************************************************/ /*********************************************************************/
/* Check whether this node must be written. */ /* Check whether this node must be written. */
/*********************************************************************/ /*********************************************************************/
......
...@@ -321,10 +321,21 @@ PSZ TDBODBC::GetFile(PGLOBAL g) ...@@ -321,10 +321,21 @@ PSZ TDBODBC::GetFile(PGLOBAL g)
{ {
if (Connect) { if (Connect) {
char *p1, *p2; char *p1, *p2;
int i;
size_t n; size_t n;
if ((p1 = strstr(Connect, "DBQ="))) { if (!(p1 = strstr(Connect, "DBQ="))) {
p1 += 4; // Beginning of file name char *p, *lc = strlwr(PlugDup(g, Connect));
if ((p = strstr(lc, "database=")))
p1 = Connect + (p - lc);
i = 9;
} else
i = 4;
if (p1) {
p1 += i; // Beginning of file name
p2 = strchr(p1, ';'); // End of file path/name p2 = strchr(p1, ';'); // End of file path/name
// Make the File path/name from the connect string // Make the File path/name from the connect string
......
...@@ -103,6 +103,7 @@ ulonglong CharToNumber(char *p, int n, ulonglong maxval, ...@@ -103,6 +103,7 @@ ulonglong CharToNumber(char *p, int n, ulonglong maxval,
if (minus) *minus = false; if (minus) *minus = false;
if (rc) *rc = false; if (rc) *rc = false;
if (n <= 0) return 0LL;
// Eliminate leading blanks or 0 // Eliminate leading blanks or 0
for (p2 = p + n; p < p2 && (*p == ' ' || *p == '0'); p++) ; for (p2 = p + n; p < p2 && (*p == ' ' || *p == '0'); p++) ;
...@@ -705,7 +706,7 @@ bool TYPVAL<TYPE>::SetValue_char(char *p, int n) ...@@ -705,7 +706,7 @@ bool TYPVAL<TYPE>::SetValue_char(char *p, int n)
template <> template <>
bool TYPVAL<double>::SetValue_char(char *p, int n) bool TYPVAL<double>::SetValue_char(char *p, int n)
{ {
if (p) { if (p && n > 0) {
char buf[64]; char buf[64];
for (; n > 0 && *p == ' '; p++) for (; n > 0 && *p == ' '; p++)
...@@ -1345,7 +1346,7 @@ bool TYPVAL<PSZ>::SetValue_char(char *p, int n) ...@@ -1345,7 +1346,7 @@ bool TYPVAL<PSZ>::SetValue_char(char *p, int n)
{ {
bool rc; bool rc;
if (p) { if (p && n > 0) {
rc = n > Len; rc = n > Len;
if ((n = MY_MIN(n, Len))) { if ((n = MY_MIN(n, Len))) {
...@@ -1804,7 +1805,7 @@ bool DECVAL::SetValue_char(char *p, int n) ...@@ -1804,7 +1805,7 @@ bool DECVAL::SetValue_char(char *p, int n)
{ {
bool rc; bool rc;
if (p) { if (p && n > 0) {
rc = n > Len; rc = n > Len;
if ((n = MY_MIN(n, Len))) { if ((n = MY_MIN(n, Len))) {
...@@ -2095,7 +2096,7 @@ bool BINVAL::SetValue_char(char *p, int n) ...@@ -2095,7 +2096,7 @@ bool BINVAL::SetValue_char(char *p, int n)
{ {
bool rc; bool rc;
if (p) { if (p && n > 0) {
rc = n > Clen; rc = n > Clen;
Len = MY_MIN(n, Clen); Len = MY_MIN(n, Clen);
memcpy(Binp, p, Len); memcpy(Binp, p, Len);
...@@ -2672,13 +2673,16 @@ bool DTVAL::SetValue_char(char *p, int n) ...@@ -2672,13 +2673,16 @@ bool DTVAL::SetValue_char(char *p, int n)
int ndv; int ndv;
int dval[6]; int dval[6];
if (n > 0) {
// Trim trailing blanks // Trim trailing blanks
for (p2 = p + n -1; p < p2 && *p2 == ' '; p2--) ; for (p2 = p + n -1; p < p2 && *p2 == ' '; p2--);
if ((rc = (n = p2 - p + 1) > Len)) if ((rc = (n = p2 - p + 1) > Len))
n = Len; n = Len;
memcpy(Sdate, p, n); memcpy(Sdate, p, n);
} // endif n
Sdate[n] = '\0'; Sdate[n] = '\0';
ndv = ExtractDate(Sdate, Pdtp, DefYear, dval); ndv = ExtractDate(Sdate, Pdtp, DefYear, dval);
......
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