diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2015-02-02 15:35:58 +0100 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2015-02-02 15:35:58 +0100 |
commit | 82f2be67ae908e203f80cf437ff5b849c111adee (patch) | |
tree | f77a68c7256626480bfb8205dcf188bf99201f2d /storage/connect/tabodbc.cpp | |
parent | 6a7837199133e35e5fe79182a78bff4c06b2b00b (diff) | |
download | mariadb-git-82f2be67ae908e203f80cf437ff5b849c111adee.tar.gz |
- Fix a bug causing Insert into ODBC to fail when the column name is
UTF8 encoded.
modified:
storage/connect/tabodbc.cpp
Diffstat (limited to 'storage/connect/tabodbc.cpp')
-rw-r--r-- | storage/connect/tabodbc.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/storage/connect/tabodbc.cpp b/storage/connect/tabodbc.cpp index 9fa9c4698e3..40a6f3dcdf7 100644 --- a/storage/connect/tabodbc.cpp +++ b/storage/connect/tabodbc.cpp @@ -379,7 +379,7 @@ int TDBODBC::Decode(char *txt, char *buf, size_t n) /***********************************************************************/ char *TDBODBC::MakeSQL(PGLOBAL g, bool cnt) { - char *colist, *tabname, *sql, buf[64]; + char *colist, *tabname, *sql, buf[NAM_LEN * 3]; LPCSTR schmp = NULL, catp = NULL; int len, ncol = 0; bool first = true; @@ -492,7 +492,7 @@ char *TDBODBC::MakeSQL(PGLOBAL g, bool cnt) /***********************************************************************/ char *TDBODBC::MakeInsert(PGLOBAL g) { - char *stmt, *colist, *valist; + char *stmt, *colist, *valist, buf[NAM_LEN * 3]; // char *tk = "`"; int len = 0; bool b = FALSE; @@ -519,10 +519,13 @@ char *TDBODBC::MakeInsert(PGLOBAL g) } else b = true; + // Column name can be in UTF-8 encoding + Decode(colp->GetName(), buf, sizeof(buf)); + if (Quote) - strcat(strcat(strcat(colist, Quote), colp->GetName()), Quote); + strcat(strcat(strcat(colist, Quote), buf), Quote); else - strcat(colist, colp->GetName()); + strcat(colist, buf); strcat(valist, "?"); // Parameter marker } // endfor colp |