Problem with using Google Visualization query language to search for strings
I'm trying to use Google visualization's query language to query for a 开发者_如何学Cstring using postgresql database. I have a column named 'server' of type character varying in my db. But when I try to use the query object's setQuery() function I get a weird error.
var query = new google.visualization.Query(dataSourceURL);
query.setQuery('where server = \'myServer\'');
query.send(handleQueryResonse); // Error in query: Internal error Failed
// to execute SQL query. mySQL error
// message: ERROR: column "myServer" does not
// exist
This code happens to work if I query for a numeric column, say 'where someNumber = 50'. I have also tried 'where server = "myServer"' but still gives the same error. But from the error it seems to think that myServer is a column for some reason?
I don't believe the Google Visualization API officially supports any other database apart from mySQL. You'll notice in the error message that you included in the comment that the message includes "mySQL error message".
I suggest that you have a look at this issue http://code.google.com/p/google-visualization-java/issues/detail?id=18 which also includes a possible patch that may resolve your issue.
I've just applied the patch to resolve the same issue you were having and initial tests seems to indicate it's working.
Build instructions for the google visualization jar can be found at http://code.google.com/apis/chart/interactive/docs/dev/dsl_install.html
I also had to update 4 unit tests to get it to build happily.
Hope that helps.
精彩评论