I just recently wrote a servlet that allows you to run sql directly without
interpretation. I needed Oracle SQL generated and not mysql SQL. I also
needed the container to manage a connection pool rather than connect for each
request (but then Oracle takes a long time to connect).
Anyway ... if you'd like that I can share it and contribute to google vis data
source ... especially since I borrowed some code from SqlDataSourceHelper for
conversions (I've not been in a position to contribute code like this before,
so don't know the process, etc).
For your example with my servlet, you'd do something in your jscript like
var query = new
google.visualization.Query('sql/mydatabase?p1=7480866925479195136');
query.setQuery("SELECT * FROM myTable WHERE ID=?");
...
Mine uses container level connection pools and Java Naming and I've only just
gotten it working yesterday using GlassFish v3, but if it fits the bill (or any
bill) you're welcome to it.
On Sep 16, 2010, at 3:57 AM, ChartMan wrote:
> If these IDs are actually strings can't you treat them as such in your data.
> I guess you are not trying to do any numeric operations like < or >
>
>
> ChartMan
>
> On Tue, Sep 14, 2010 at 12:02 AM, Ben Burleson <[email protected]> wrote:
> I found that the conversion happens when I parse the ID string into a
> double, required by the NumberValue constructor. I'm still curious if
> there is an easier way to construct a WHERE clause for a
> SqlDataSourceHelper query.
>
> On Sep 13, 2:43 pm, Ben Burleson <[email protected]> wrote:
> > I have successfully queried a MySQL database from my data source
> > servlet, but it's not clear how to construct a custom query
> > programatically.
> >
> > Say the table has three columns, ID, Timestamp, and Value. I want to
> > get all rows with a given ID. I tried to build a query to pass to
> > SqlDataSourceHelper.executeQuery(), and add a ColumnValueFilter to the
> > query, but the NumberValue used to construct the ColumnValueFilter
> > takes liberty to convert the value for comparison.
> >
> > In one example, the ID is 7480866925479195136, but the query that gets
> > constructed and sent to MySQL is:
> > SELECT * FROM TABLE WHERE (ID=7.4808669254791956E18)
> >
> > Is there a way to keep the NumberValue as a 64-bit int rather than a
> > double? (The ID has to be 64-bit, I don't have control over that.)
> >
> > Or is there another way to approach this? A simpler way to query a
> > MySQL database with SqlDataSourceHelper? I don't want to build a
> > DataTable result by hand, but maybe that's the only option?
> >
> > Thanks,
> > Ben
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Visualization API" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-visualization-api?hl=en.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Visualization API" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-visualization-api?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.