简体   繁体   中英

Difference in Ways of executing sql queries in android?

android中的db.execSQL()方法和activityObject.managedQuery()方法有什么区别?

managedQuery(...) is a generic query mechanism which can be used for a variety of 'database' objects that have ContentProviders . This can include SQLite databases, phone contacts etc etc. It can only be used to 'query' for data and not make changes to the database.

db.execSQL(...) is a method call directly on a SQLite database and can be used to perform any SQL operation. This means not only can it 'query' (SELECT) data, but it can be used to create, alter, drop tables as well as insert, delete rows etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM