bug fixed for sampling in class Sampler for a database mysql about an attribute of a table that could be a keyword.Quotes `` added for all attributes before submitting a query.

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-access/DatabasesResourcesManager@99335 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Loredana Liccardo 2014-08-28 15:36:38 +00:00
parent fe5b1c211b
commit 6ce1e4d44b
1 changed files with 4 additions and 4 deletions

View File

@ -195,7 +195,7 @@ public class Sampler {
// " as CHAR CHARACTER SET utf8), ";
// attribute = "CONVERT(" + listColumns.get(i) +
// ", CHAR), ";
attribute = "CAST(" + listColumns.get(i)
attribute = "CAST(" + "`" +listColumns.get(i)+ "`"
+ " as CHAR CHARACTER SET utf8), ";
if (i == (listColumns.size() - 1)) {
@ -206,14 +206,14 @@ public class Sampler {
// attribute = "CONVERT(" + listColumns.get(i) +
// ", BINARY)";
attribute = "CAST(" + listColumns.get(i)
attribute = "CAST(" + "`" +listColumns.get(i)+ "`"
+ " as CHAR CHARACTER SET utf8)";
}
} else {
attribute = "CAST(CAST(" + listColumns.get(i)
attribute = "CAST(CAST(" + "`" +listColumns.get(i)+ "`"
+ " as BINARY) as CHAR CHARACTER SET utf8), ";
if (i == (listColumns.size() - 1)) {
@ -224,7 +224,7 @@ public class Sampler {
// attribute = "CONVERT(" + listColumns.get(i) +
// ", BINARY)";
attribute = "CAST(CAST(" + listColumns.get(i)
attribute = "CAST(CAST(" + "`" +listColumns.get(i)+ "`"
+ " as BINARY) as CHAR CHARACTER SET utf8)";
}