Android Question TRUNCATE TABLE + crash app

MichalK73

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

B4X:
Main.SQL.ExecNonQuery("TRUNCATE TABLE wyniki")

Debugger does not return any error and application crash occurs.

With TRY:
B4X:
        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?
 

sorex

Expert
Licensed User
Longtime User
just did a search for truncate but it doesn't seem to be a supported keyword for SQLite.
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
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

Lahksman

Active Member
Licensed User
Longtime User
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
Cookies are required to use this site. You must accept them to continue using the site. Learn more…