For databases on the Android platform, embedded SQLite is becoming more and more popular. For better cross-platform operations, we recommend that you use original SQL statements for direct operations, which greatly improves the code and processing efficiency, however, you must handle SQL statement exceptions.
Next, let's talk about the advantages of rawquery. We can see that the query Code uses SQL statements directly. The performance test efficiency is much faster than the class encapsulated by Android, but it cannot be used with some adapters, however, in general, the cross-platform architecture is very prominent. The following is the pseudo code for local usage, without any construction and instantiation. It is hoped that the project manager will know the advantages of rawsql in the use of Android platform.
Sqlitedatabase dB; string ARGs [] = {ID}; contentvalues CV = new contentvalues (); cv. put ("android123", ID); cursor c = dB. rawquery ("select * from table where android123 =? ", ArgS); execute the local SQL statement to query if (C. getcount ()! = 0) {// dosomething contentvalues CV = new contentvalues (); cv. put ("android123", "cwj"); dB. insert ("table", "android123", CV); // insert data string ARGs [] = {ID}; contentvalues cv2 = new contentvalues (); cv2.put ("android123 ", ID); dB. delete ("table", "android123 =? ", ArgS); // delete data}