12/28/2023 0 Comments Sqlite command line exit![]() i don't know where you got that quotes from, but this is not a valid SQL syntax for `CREATE TABLE`. Note the single quotes in your code: that is where it all goes wrong. ![]() "KEY NOT NULL, surname TEXT NOT NULL) ", &aCallback, null, &msg) Result = sqlite3_exec(db, "CREATE TABLE people(id INT PRIMARY "~ i don't know why sqlite is not rejecting it, but the correct one is this: `CREATE TABLE people('.')` is not the syntax you want. Wow! but it has! or isn't it? yep, it hasn't. "Failed to insert record: table people has no column named id" Writeln("Failed to insert record: ", to!string(msg)) sqlite3 is a terminal-based front-end to the SQLite library that can evaluate queries interactively and display the results in multiple formats. sqlite3 options databasefile SQL Summary. tables command gives a list of tables in the test.db database. If you'll output the error message, you'll see something unusual here: sqlite3 - A command line interface for SQLite version 3 Synopsis. We provide a parameter to the sqlite3 tool test.db is a database name. > VALUES (1, 'Smith') ", &aCallback, null, &msg) > result = sqlite3_exec(db, "INSERT INTO people (id, surname) > KEY NOT NULL, surname TEXT NOT NULL') ", &aCallback, null, &msg) > result = sqlite3_exec(db, "CREATE TABLE people('id INT PRIMARY > int result = sqlite3_open("myDatabase.db", &db) > extern(C) int aCallback(void *n, int c, char **v, char **col) I don't fully understand the callback function yet (I borrowed this from a C tutorial on the subject), maybe that is the source of the problem? > Can someone please tell me what I'm doing wrong here, the sql INSERT statement fails for some reason. Result = sqlite3_exec(db, "INSERT INTO people (id, surname) VALUES (1, 'Smith') ", &aCallback, null, &msg) Result = sqlite3_exec(db, "CREATE TABLE people('id INT PRIMARY KEY NOT NULL, surname TEXT NOT NULL') ", &aCallback, null, &msg) Int result = sqlite3_open("myDatabase.db", &db) I don't fully understand the callback function yet (I borrowed this from a C tutorial on the subject), maybe that is the source of the problem?Įxtern(C) int aCallback(void *n, int c, char **v, char **col) Can someone please tell me what I'm doing wrong here, the sql INSERT statement fails for some reason.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |