Main Site Documentation

SQLite integrity_check


#1

I guess the integrity_check has been disabled.

is there a way to run it, to fix the database.
Like below

[sqlite executeNonQuery:@ “pragma integrity_check”];
[sqlite executeNonQuery:@ “reindex nodes”];
[sqlite executeNonQuery:@ “reindex pristine”];


#2

@ microt - It looks like those commands return results so you want ExecuteQuery, not ExecuteNonQuery.


#3

when i use ExecuteQuery method, “[em]At least one column must be provided[/em]” exception is thrown.
so i could not get integrity_check result


_database = new Database("\\SD\\mydata.db");
ResultSet executeQuery = _database.ExecuteQuery("PRAGMA integrity_check");

#### Exception System.ArgumentException - 0x00000000 (1) ####
#### Message: At least one column must be provided.
#### GHI.SQLite.ResultSet::.ctor [IP: 001c] ####
#### GHI.SQLite.Database::ExecuteQuery [IP: 003e] ####
#### Rs485ReadData.Program::ProgramStarted [IP: 017a] ####
#### Rs485ReadData.Program::Main [IP: 0015] ####

A first chance exception of type ‘System.ArgumentException’ occurred in GHI.SQLite.dll
An unhandled exception of type ‘System.ArgumentException’ occurred in GHI.SQLite.dll
Additional information: At least one column must be provided.
Uncaught exception


#4

@ hytgny - I may have misspoke for integrity_check, when I ran it as ExecuteNonQuery, it executed without issue.


#5

myDatabase = new Database(DB_SetFile);
myDatabase.ExecuteNonQuery(“PRAGMA integrity_check”);
myDatabase.ExecuteNonQuery(“reindex nodes”)
1st “ExecuteNonQuery” runs…But I do not know if it did something
but 2nd one gives an exception

#### Exception GHI.SQLite.Database+QueryPrepareException - 0x00000000 (10) ####
#### Message: unable to identify the object to be reindexed
#### GHI.SQLite.Database::PrepareSqlStatement [IP: 001e] ####
#### GHI.SQLite.Database::ExecuteNonQuery [IP: 0019] ####
#### TouchLogger.SQL_DBaseSet::DB_Count [IP: 001c] ####
#### TouchLogger.SQL_DBase::Init [IP: 009a] ####

#6

@ microt - I believe that’s an error from SQLite itself. You’ll have to consult their documentation.