diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2015-05-26 01:02:33 +0200 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2015-05-26 01:02:33 +0200 |
commit | fb98632930cd320c55a8664f601c4082b3e14628 (patch) | |
tree | d422f3620569fd80957309359f2b026503900eb7 /storage/connect/reldef.cpp | |
parent | 37840d5313213a6c704386c09090569935e97ecb (diff) | |
download | mariadb-git-fb98632930cd320c55a8664f601c4082b3e14628.tar.gz |
JSONColumns and XMLColumns revisited. They can retrieve their parameters directly
from the PTOS argument. For this to work, finding the table options is now split
in HA_CONNECT functions and exported functions available from out of ha_connect.
modified: storage/connect/ha_connect.cc
modified: storage/connect/libdoc.cpp
modified: storage/connect/mycat.h
modified: storage/connect/plgdbsem.h
modified: storage/connect/tabjson.cpp
modified: storage/connect/tabjson.h
modified: storage/connect/tabxml.cpp
modified: storage/connect/tabxml.h
The BIN table formats have been changed to handle the case of floating point values
when used with Big Endian or Little Endian machines.
modified: storage/connect/ha_connect.cc
modified: storage/connect/mysql-test/connect/r/bin.result
modified: storage/connect/mysql-test/connect/t/bin.test
modified: storage/connect/reldef.cpp
modified: storage/connect/tabdos.cpp
modified: storage/connect/tabdos.h
modified: storage/connect/tabfix.cpp
modified: storage/connect/tabfix.
h
Diffstat (limited to 'storage/connect/reldef.cpp')
-rw-r--r-- | storage/connect/reldef.cpp | 65 |
1 files changed, 45 insertions, 20 deletions
diff --git a/storage/connect/reldef.cpp b/storage/connect/reldef.cpp index 4563500254b..720ede8f225 100644 --- a/storage/connect/reldef.cpp +++ b/storage/connect/reldef.cpp @@ -247,7 +247,7 @@ bool TABDEF::Define(PGLOBAL g, PCATLG cat, LPCSTR name, LPCSTR am) /***********************************************************************/ PSZ TABDEF::GetPath(void) { - return (Database) ? (PSZ)Database : Hc->GetDataPath(); + return (Database) ? (PSZ)Database : (Hc) ? Hc->GetDataPath() : NULL; } // end of GetPath /***********************************************************************/ @@ -256,7 +256,8 @@ PSZ TABDEF::GetPath(void) int TABDEF::GetColCatInfo(PGLOBAL g) { char *type= GetStringCatInfo(g, "Type", "*"); - int i, loff, poff, nof, nlg; + char c, fty, eds; + int i, n, loff, poff, nof, nlg; void *field= NULL; TABTYPE tc; PCOLDEF cdp, lcdp= NULL, tocols= NULL; @@ -331,28 +332,52 @@ int TABDEF::GetColCatInfo(PGLOBAL g) cdp->SetOffset(0); // Not to have shift case TAB_BIN: // BIN/VEC are packed by default - if (nof) + if (nof) { // Field width is the internal representation width // that can also depend on the column format - switch (cdp->Fmt ? *cdp->Fmt : cdp->Decode ? 'C' : 'X') { - case 'X': nof= cdp->Clen; - case 'C': break; - case 'R': - case 'F': -// case 'L': - case 'I': nof= 4; break; - case 'D': nof= 8; break; - case 'S': nof= 2; break; - case 'T': nof= 1; break; - default: /* New format */ - for (nof= 0, i= 0; cdp->Fmt[i]; i++) - if (isdigit(cdp->Fmt[i])) - nof= (nof * 10 + (cdp->Fmt[i] - '0')); - - if (!nof) + fty = cdp->Decode ? 'C' : 'X'; + eds = 0; + n = 0; + + if (cdp->Fmt && !cdp->Decode) { + for (i = 0; cdp->Fmt[i]; i++) { + c = toupper(cdp->Fmt[i]); + + if (isdigit(c)) + n = (n * 10 + (c - '0')); + else if (c == 'L' || c == 'B' || c == 'H') + eds = c; + else + fty = c; + + } // endfor i + + } // endif Fmt + + if (n) + nof = n; + else switch (fty) { + case 'X': + if (eds && IsTypeChar(cdp->Buf_Type)) + nof = sizeof(longlong); + else nof= cdp->Clen; - } // endswitch Fmt + break; + case 'C': break; + case 'R': + case 'F': nof = sizeof(float); break; + case 'I': nof = sizeof(int); break; + case 'D': nof = sizeof(double); break; + case 'S': nof = sizeof(short); break; + case 'T': nof = sizeof(char); break; + case 'G': nof = sizeof(longlong); break; + default: /* Wrong format */ + sprintf(g->Message, "Invalid format %c", fty); + return -1; + } // endswitch fty + + } // endif nof default: break; |