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:
parent
fe5b1c211b
commit
6ce1e4d44b
|
@ -195,7 +195,7 @@ public class Sampler {
|
||||||
// " as CHAR CHARACTER SET utf8), ";
|
// " as CHAR CHARACTER SET utf8), ";
|
||||||
// attribute = "CONVERT(" + listColumns.get(i) +
|
// attribute = "CONVERT(" + listColumns.get(i) +
|
||||||
// ", CHAR), ";
|
// ", CHAR), ";
|
||||||
attribute = "CAST(" + listColumns.get(i)
|
attribute = "CAST(" + "`" +listColumns.get(i)+ "`"
|
||||||
+ " as CHAR CHARACTER SET utf8), ";
|
+ " as CHAR CHARACTER SET utf8), ";
|
||||||
|
|
||||||
if (i == (listColumns.size() - 1)) {
|
if (i == (listColumns.size() - 1)) {
|
||||||
|
@ -206,14 +206,14 @@ public class Sampler {
|
||||||
// attribute = "CONVERT(" + listColumns.get(i) +
|
// attribute = "CONVERT(" + listColumns.get(i) +
|
||||||
// ", BINARY)";
|
// ", BINARY)";
|
||||||
|
|
||||||
attribute = "CAST(" + listColumns.get(i)
|
attribute = "CAST(" + "`" +listColumns.get(i)+ "`"
|
||||||
+ " as CHAR CHARACTER SET utf8)";
|
+ " as CHAR CHARACTER SET utf8)";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
attribute = "CAST(CAST(" + listColumns.get(i)
|
attribute = "CAST(CAST(" + "`" +listColumns.get(i)+ "`"
|
||||||
+ " as BINARY) as CHAR CHARACTER SET utf8), ";
|
+ " as BINARY) as CHAR CHARACTER SET utf8), ";
|
||||||
|
|
||||||
if (i == (listColumns.size() - 1)) {
|
if (i == (listColumns.size() - 1)) {
|
||||||
|
@ -224,7 +224,7 @@ public class Sampler {
|
||||||
// attribute = "CONVERT(" + listColumns.get(i) +
|
// attribute = "CONVERT(" + listColumns.get(i) +
|
||||||
// ", BINARY)";
|
// ", BINARY)";
|
||||||
|
|
||||||
attribute = "CAST(CAST(" + listColumns.get(i)
|
attribute = "CAST(CAST(" + "`" +listColumns.get(i)+ "`"
|
||||||
+ " as BINARY) as CHAR CHARACTER SET utf8)";
|
+ " as BINARY) as CHAR CHARACTER SET utf8)";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue