Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3046

Sqlite / C++

$
0
0
I've created an sqlite application with Visual Studio C++, which works correctly.
However, I cannot reorder indexes, after deleting a record - because sqlite creates a new table and inserts data from the old table, but refuses to drop this one and so renames the new table.

This is my relevant code

Quote:

void ClegisView::OnBnClickedButton()
{
querySQL = "DELETE FROM legis WHERE n_ord = " +ord+ "";

sqlite3_exec(dbase, querySQL, NULL, NULL, &err);

queries = "CREATE table temp (n_ord INTEGER NOT NULL PRIMARY KEY, dip TEXT DEFAULT NULL, sum TEXT DEFAULT NULL, text TEXT DEFAULT NULL); INSERT INTO temp (dip, sum, text) SELECT dip, sum, text FROM legis; DROP table legis; ALTER table temp RENAME TO legis";

sqlite3_exec(dbase, queries, NULL, NULL, &err);

restart();
}
The sqlite statement above works if I use it in Sqlite Browser, from Windows terminal or in Python, but not with C++

What must I do ?

Thanks in advance

Viewing all articles
Browse latest Browse all 3046

Trending Articles