My favorites | Sign in
Google
                
New issue | Search
for
| Advanced search | Search tips
Issue 4: [RFE] Allow query parameters to be set individually like a prepared statement
5 people starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----
Type-Enhancement
Priority-Low
API-Gears


Sign in to add a comment
 
Reported by jason.essington, Jul 04, 2007
The Database support should allow parameters to be set individually using actual java objects for 
each parameter something like:

Database db = new Database("some.Database");
Statement st = db.createStatement("SELECT * FROM sometable WHERE entrydate > ? AND id > ? 
AND  entrytype = ?");
st.setDate(0, someDate);
st.setInteger(1, 15);
st.setString(2, "user");
ResultSet rs = st.execute();
...
rs.close();

This could be accomplished by having a Statement interface that contains the setter methods 
and an execute method. Hide the actual implementation in the database class, and have the 
setters individually add parameters to a Javascript array that will eventually be sent to the 
underlying execute() function in Gears.

See attached patch.
statement.patch
5.5 KB   Download
Comment 1 by gwt.team.mmendez, Jan 02, 2008
(No comment was entered for this change.)
Labels: -Type-Defect -Priority-Medium Type-Enhancement Priority-Low API-Gears
Comment 2 by roberto.tyley, Sep 28, 2008
This looks good. As a developer who's looking at persisting around 20 fields of
various types (int, string, float, date), I'd appreciate the more formal interface  -
rather than just changing everything to a string, as appears to be required by the
current interface:
http://gwt-google-apis.googlecode.com/svn/javadoc/gears/1.1/com/google/gwt/gears/client/database/Database.html#execute(java.lang.String,%20java.lang.String...)

The javascript Gears api does seem to allow you to use integers, at least:

http://code.google.com/apis/gears/api_database.html#Database-execute

Sign in to add a comment