summaryrefslogtreecommitdiff
path: root/storage/connect/tabjdbc.cpp
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2016-10-05 23:44:54 +0200
committerOlivier Bertrand <bertrandop@gmail.com>2016-10-05 23:44:54 +0200
commit9b20d606fb1afd0327356e7c78c2aea774dec3d4 (patch)
tree910842dba708446c5155c39f5c7bac4fc79a0643 /storage/connect/tabjdbc.cpp
parent7d596c9ff526bc912769490023c44e9a5b2fa743 (diff)
downloadmariadb-git-9b20d606fb1afd0327356e7c78c2aea774dec3d4.tar.gz
- Fix MDEV-10948. Syntax error on quoted JDBC tables.
Was because the quoting character was always '"' instead of being retrieve from the JDBC source. modified: storage/connect/JdbcInterface.java modified: storage/connect/jdbconn.cpp modified: storage/connect/tabjdbc.cpp
Diffstat (limited to 'storage/connect/tabjdbc.cpp')
-rw-r--r--storage/connect/tabjdbc.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/storage/connect/tabjdbc.cpp b/storage/connect/tabjdbc.cpp
index 86fd831b262..e398523892f 100644
--- a/storage/connect/tabjdbc.cpp
+++ b/storage/connect/tabjdbc.cpp
@@ -686,6 +686,9 @@ bool TDBJDBC::MakeInsert(PGLOBAL g)
else
Prepared = true;
+ if (trace)
+ htrc("Insert=%s\n", Query->GetStr());
+
return false;
} // end of MakeInsert
@@ -733,17 +736,18 @@ bool TDBJDBC::MakeCommand(PGLOBAL g)
// If so, it must be quoted in the original query
strlwr(strcat(strcat(strcpy(name, " "), Name), " "));
- if (!strstr(" update delete low_priority ignore quick from ", name))
- strlwr(strcpy(name, Name)); // Not a keyword
- else
+ if (strstr(" update delete low_priority ignore quick from ", name)) {
strlwr(strcat(strcat(strcpy(name, qc), Name), qc));
+ k += 2;
+ } else
+ strlwr(strcpy(name, Name)); // Not a keyword
if ((p = strstr(qrystr, name))) {
for (i = 0; i < p - qrystr; i++)
stmt[i] = (Qrystr[i] == '`') ? *qc : Qrystr[i];
stmt[i] = 0;
- k = i + (int)strlen(Name);
+ k += i + (int)strlen(Name);
if (qtd && *(p-1) == ' ')
strcat(strcat(strcat(stmt, qc), TableName), qc);
@@ -765,6 +769,9 @@ bool TDBJDBC::MakeCommand(PGLOBAL g)
return NULL;
} // endif p
+ if (trace)
+ htrc("Command=%s\n", stmt);
+
Query = new(g)STRING(g, 0, stmt);
return (!Query->GetSize());
} // end of MakeCommand
@@ -1214,6 +1221,10 @@ int TDBJDBC::WriteDB(PGLOBAL g)
} // endif oom
Query->RepLast(')');
+
+ if (trace > 1)
+ htrc("Inserting: %s\n", Query->GetStr());
+
rc = Jcp->ExecuteUpdate(Query->GetStr());
Query->Truncate(len); // Restore query