> We want to add below update sql into our contentprovider:
> update tableName
>    set column1 = column1 + 1
>    where column1 >= 50
>
> We found current update of contentprovider does not support it, which
> would not recognize the "column1" of "column1 + 1" as column name.
>
> So we have to add execSQL method into ContentProvider and I think it
> is dirt.
>
> So I wonder if anyone know how to do such thing with ContentProvider
> or any more elegant way to achieve it.

It dawns on me that another possible interpretation of what you have above
is that a client of your ContentProvider is attempting to use that UPDATE
statement against the ContentProvider.

ContentProvider is not a database abstraction -- it's a content store
abstraction. Not all ContentProviders will be backed up by a SQLite
database or anything else that interprets SQL. Hence, it is not surprising
to me that ContentProvider does not support arbitrary SQL statements.

Since a ContentProvider -- particularly one needing your proposed UPDATE
statement -- is only needed for inter-process content sharing, you might
consider switching to a remote service (using AIDL) instead.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html


-- 
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

Reply via email to