I have the following script that I am using in a QString in qt and supplying to a QSqlQuery to create tables in a Sqlite database.
The Script.
CREATE TABLE accounts
(
A_Id INTEGER PRIMARY KEY,
Account_Name TEXT,
Account_Date TEXT
);
CREATE TABLE statements
(
S_Id INTEGER PRIMARY KEY,
Statement_Name TEXT
);
CREATE TABLE transactions
(
T_Id INTEGER PRIMARY KEY,
A_Id INTEGER,
S_Id INTEGER,
Amount REAL,
Transaction_Date TEXT,
FOREIGN KEY(A_Id) REFERENCES accounts(A_Id),
FOREIGN KEY(S_Id) REFERENCES statements(S_Id)
);
However when the scripts runs only the first table gets created in the database.
Thanks for any help.
QSqlQuery forwards the statement to the SQlite driver where the query-strings is analysed by sqlite3_prepare(...). The documentation says that "These routines only compile the first statement in zSql". Conclusion: This is a "feature" of SQLite.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With