New to SQLite so I don't know what I'm doing wrong. I'm just getting an error saying:
SQLSTATE[HY000]: General error: 1 near "CREATE": syntax error
Here's my SQL:
CREATE TABLE users (
id INTEGER NOT NULL PRIMARY KEY,
date_created DATETIME NOT NULL,
date_updated DATETIME NOT NULL,
username VARCHAR(32) NOT NULL,
password VARCHAR(32) NOT NULL,
role VARCHAR(32) NOT NULL DEFAULT 'member',
first_name VARCHAR(50) NOT NULL,
last_name VARCHAR(50) NOT NULL,
email VARCHAR(128) NOT NULL
)
CREATE TABLE subscribers (
id INTEGER NOT NULL PRIMARY KEY,
name VARCHAR(40) DEFAULT NULL,
email VARCHAR(255) NOT NULL UNIQUE
)
CREATE TABLE weekly_download (
id INTEGER NOT NULL PRIMARY KEY,
filename TEXT NOT NULL,
download_date DATE NOT NULL,
body TEXT
)
SQLite_Schema is an error code that is returned when there is a change in the database. The SQLite _schema error code is indicated when a prepared SQL statement is no longer valid and cannot be executed. These types of errors occur when using sqlite3 prepare () and sqlite3 step () interfaces to run SQL.
The SQLITE_SCHEMA error is returned when a prepared SQL statement is not valid and cannot be executed. Such type occurs only when using the sqlite3 prepare() and sqlite3 step() interfaces to run SQL.
OperationalError: database is locked errors indicate that your application is experiencing more concurrency than sqlite can handle in default configuration. This error means that one thread or process has an exclusive lock on the database connection and another thread timed out waiting for the lock the be released.
put a semicolon after each statement.
CREATE TABLE ( ... ) ;
CREATE TABLE ( ... ) ;
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