Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can we use truncate query in android sqlite

can we use truncate query in android database? otherwise can we performing truncate operation using our java code?

like image 410
Kandha Avatar asked Aug 19 '10 08:08

Kandha


1 Answers

If I have to truncate a table, I simply drop and recreate it.

Documentation ( http://www.sqlite.org/lang_delete.html ):

When the WHERE is omitted from a DELETE statement and the table being deleted has no triggers, SQLite uses an optimization to erase the entire table content without having to visit each row of the table individually. This "truncate" optimization makes the delete run much faster.
like image 58
WarrenFaith Avatar answered Oct 06 '22 18:10

WarrenFaith