Android Question TRUNCATE TABLE + crash app

MichalK73

Well-Known Member
Licensed User
Longtime User
Hello.
I have a problem with cleaning table.

Code: Copy
Main.SQL.ExecNonQuery("TRUNCATE TABLE wyniki")

Debugger does not return any error and application crash occurs.

With TRY:
Code: Copy
        Try
        Main.SQL.ExecNonQuery("TRUNCATE TABLE wyniki")
        Catch
            Log("Error")   
        End Try
Debugger unreported any code, nor does it have the log message "Error",
, and the application continues to operate without cleaning the table.


What could be causing this?
 
just did a search for truncate but it doesn't seem to be a supported keyword for SQLite.
 
Upvote 0
does it clear the ID count aswell?

that's the different with other databases. delete trashes but the ID count remains while truncate resets the ID count back to 0.
 
Upvote 0
If you are using autoincrement, this is stored in the sqllite_sequence table (part of the sqlite_master). It uses 2 column [name] and [seq] and can be altered by the usual UPDATE, INSERT and DELETE statements.
Making modifications to this table will likely perturb the AUTOINCREMENT key generation algorithm. Make sure you know what you are doing before you undertake such changes.
 
Upvote 0
Back
Top