diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2017-06-08 18:01:47 +0200 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2017-06-08 18:01:47 +0200 |
commit | da3c3b903f348304b43681fb600c7048fa81e350 (patch) | |
tree | 744f86c1f09f860d809209600dcdce75ed65b76c /storage | |
parent | 5b534a68890222650ffa213dd9a9f0c91d294e58 (diff) | |
download | mariadb-git-da3c3b903f348304b43681fb600c7048fa81e350.tar.gz |
Fix MDEV-12973: Blank columns querying SQL Server
Added support of NCHAR, NVARCHAR an ROWID JDBC types.
modified: storage/connect/jdbconn.cpp
Diffstat (limited to 'storage')
-rw-r--r-- | storage/connect/jdbconn.cpp | 61 |
1 files changed, 40 insertions, 21 deletions
diff --git a/storage/connect/jdbconn.cpp b/storage/connect/jdbconn.cpp index 6073936283c..f077cd2182b 100644 --- a/storage/connect/jdbconn.cpp +++ b/storage/connect/jdbconn.cpp @@ -120,42 +120,47 @@ int TranslateJDBCType(int stp, char *tn, int prec, int& len, char& v) int type; switch (stp) { - case -1: // LONGVARCHAR + case -1: // LONGVARCHAR + case -16: // LONGNVARCHAR (unicode) if (GetTypeConv() != TPC_YES) return TYPE_ERROR; else len = MY_MIN(abs(len), GetConvSize()); - case 12: // VARCHAR + case 12: // VARCHAR + case -9: // NVARCHAR (unicode) v = 'V'; - case 1: // CHAR + case 1: // CHAR + case -15: // NCHAR (unicode) + case -8: // ROWID type = TYPE_STRING; break; - case 2: // NUMERIC - case 3: // DECIMAL - case -3: // VARBINARY + case 2: // NUMERIC + case 3: // DECIMAL + case -3: // VARBINARY type = TYPE_DECIM; break; - case 4: // INTEGER + case 4: // INTEGER type = TYPE_INT; break; - case 5: // SMALLINT + case 5: // SMALLINT type = TYPE_SHORT; break; - case -6: // TINYINT - case -7: // BIT + case -6: // TINYINT + case -7: // BIT + case 16: // BOOLEAN type = TYPE_TINY; break; - case 6: // FLOAT - case 7: // REAL - case 8: // DOUBLE + case 6: // FLOAT + case 7: // REAL + case 8: // DOUBLE type = TYPE_DOUBLE; break; - case 93: // TIMESTAMP, DATETIME + case 93: // TIMESTAMP, DATETIME type = TYPE_DATE; len = 19 + ((prec) ? (prec+1) : 0); v = (tn && toupper(tn[0]) == 'T') ? 'S' : 'E'; break; - case 91: // DATE, YEAR + case 91: // DATE, YEAR type = TYPE_DATE; if (!tn || toupper(tn[0]) != 'Y') { @@ -167,17 +172,27 @@ int TranslateJDBCType(int stp, char *tn, int prec, int& len, char& v) } // endif len break; - case 92: // TIME + case 92: // TIME type = TYPE_DATE; len = 8 + ((prec) ? (prec+1) : 0); v = 'T'; break; - case -5: // BIGINT + case -5: // BIGINT type = TYPE_BIGINT; break; - case 0: // NULL - case -2: // BINARY - case -4: // LONGVARBINARY + case 0: // NULL + case -2: // BINARY + case -4: // LONGVARBINARY + case 70: // DATALINK + case 2000: // JAVA_OBJECT + case 2001: // DISTINCT + case 2002: // STRUCT + case 2003: // ARRAY + case 2004: // BLOB + case 2005: // CLOB + case 2006: // REF + case 2009: // SQLXML + case 2011: // NCLOB default: type = TYPE_ERROR; len = 0; @@ -1225,9 +1240,12 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val) switch (ctyp) { case 12: // VARCHAR + case -9: // NVARCHAR case -1: // LONGVARCHAR case 1: // CHAR - case 3: // DECIMAL + case -15: // NCHAR + case 3: // DECIMAL + case -8: // ROWID if (jb && ctyp != 3) cn = (jstring)jb; else if (!gmID(g, chrfldid, "StringField", "(ILjava/lang/String;)Ljava/lang/String;")) @@ -1245,6 +1263,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val) case 4: // INTEGER case 5: // SMALLINT case -6: // TINYINT + case 16: // BOOLEAN case -7: // BIT if (!gmID(g, intfldid, "IntField", "(ILjava/lang/String;)I")) val->SetValue((int)env->CallIntMethod(job, intfldid, rank, jn)); |