Skip to content

Commit

Permalink
- Fix a bug causing Insert into ODBC to fail when the column name is
Browse files Browse the repository at this point in the history
  UTF8 encoded.
modified:
  storage/connect/tabodbc.cpp
  • Loading branch information
Buggynours committed Feb 2, 2015
1 parent 6a78371 commit 82f2be6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions storage/connect/tabodbc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit 82f2be6

Please sign in to comment.