Brad Gies wrote:
> Does anyone have any code or know of any code, or just know where to find
> the procedures/functions, that would allow me to set the value of
> Parameters by Parameter Name (field Names) for prepared statements instead
> of the index?
>
> If I have the following:
>
> myStatement = Db.compileStatement("Insert into myTable (load_id, load_name)
> values (?, ?);
>
> Ie. I want to do something like the following :
>
> myStatement.parambyName(“load_id”).value = 123;
> myStatement.parambyName(“load_name”).value = 456;
Except that you don't have a load_id or a load_name. Your *table* may
have one, but there's little in the statement that ties your paramters
to those columns until the statement is executed.
Some SQLite language bindings offer syntax beyond question marks to
handle this scenario. For example, the Ruby binding would allow
something like:
Db.compileStatement("Insert into myTable (load_id, load_name) values
(:my_id, :my_name)";
after which you could use some methods to associate values by the
colon-prefixed placeholders (e.g., :my_name).
However, in Android, that would require a custom subclass of
SQLiteStatement, and I haven't run across one like that. Hopefully, if
somebody else has one, they'll chime in.
If it makes you feel better, about half of the SQLite language bindings
seem to be missing this capability.
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy
Need help for your Android OSS project? http://wiki.andmob.org/hado
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" 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/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---