[android-developers] Re: Newbie question about Content Provider

2012-01-20 Thread Lester Quintero
Hi,

I see the example and I did not find where using insert - Select to
put data into database.
I assume then that this can not be done, as I searched many examples
and have not found anything like.

Thanks, for your help.





On 20 ene, 06:02, Ricardo Santos ricardo.c.r.san...@gmail.com wrote:
 Do the notepad tutorial, on the developers page, it will help you a lot.

 On Tue, Jan 17, 2012 at 1:37 PM, Lester Quintero lesterqu...@gmail.comwrote:







  Hello everybody,

  Its possible with content providers make insert-select in SqlIte
  database.
  would be something like:

  Insert into Table(t1, t2)
  Select tx, ty
  From Table

  or

  Insert into Table(t1, t2)
  Select tx, ty  WHERE NOT EXISTS ...

  Thanks.

  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Newbie question about Content Provider

2012-01-20 Thread A. Elk
Are you talking about a content provider or an SQLite database? They aren't 
equivalent. A content provider *may* use an SQLite database as its database 
repository, but it doesn't have to, and you can't assume that it does.

*If it's a content provider:*

You can do an insert followed by a query. Generally, it has to be done in 
two separate method calls:

ContentResolver.insert();
ContentResolver.query();

One row can be inserted per insert().

You can also do a transaction using ContentProviderOperation objects and 
then ContentResolver.applyBatch();

*If it's an SQLite database:*

You can do anything you can do in SQLite itself, using the classes in 
android.database.SQLite. Remember, though, that in general you *can't* use 
SQLite classes against a content provider (in general).

*In addition:*
*
*
If this doesn't answer your question, you might try to explain your use 
case rather than simply asking if SQLite operations translate to Android.


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Newbie question about Content Provider

2012-01-20 Thread Lester Quintero
Hi,

It's a Content Provider that use SQLite Database.

I want pass data of one table to another with  Insert-Select sintax
and/or check that data not exist in second table.

I Found that SQLite permit sintax:

Insert into Table(t1, t2)
Select tx, ty
From Table  --To insert select from one table to another

OR

Insert into Table(t1, t2)
Select tx, ty  WHERE NOT EXISTS ... --To Check if data exist or not

I thought that through the Content Provider could emulate this syntax

thanks.


On 20 ene, 12:59, A. Elk lancaster.dambust...@gmail.com wrote:
 Are you talking about a content provider or an SQLite database? They aren't
 equivalent. A content provider *may* use an SQLite database as its database
 repository, but it doesn't have to, and you can't assume that it does.

 *If it's a content provider:*

 You can do an insert followed by a query. Generally, it has to be done in
 two separate method calls:

 ContentResolver.insert();
 ContentResolver.query();

 One row can be inserted per insert().

 You can also do a transaction using ContentProviderOperation objects and
 then ContentResolver.applyBatch();

 *If it's an SQLite database:*

 You can do anything you can do in SQLite itself, using the classes in
 android.database.SQLite. Remember, though, that in general you *can't* use
 SQLite classes against a content provider (in general).

 *In addition:*
 *
 *
 If this doesn't answer your question, you might try to explain your use
 case rather than simply asking if SQLite operations translate to Android.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en