Open lincoln310 opened 4 years ago
i changed to this:
int fd = 0;
const char *dbname = db_get_name();
fd = open(dbname, O_RDONLY);
if (fd > 0)
rt_kprintf("%s exist\r\n", dbname);
else
rt_kprintf("%s not exist\r\n");
const char *sql = "CREATE TABLE IF NOT EXISTS student(id INTEGER PRIMARY KEY AUTOINCREMENT,name varchar(32) NOT NULL,score INT NOT NULL);";
rt_kprintf("sql cmd: %s\r\n\r\n", sql);
int ret = db_create_database(sql);
rt_kprintf("sql ret: %d\r\n", ret);
and result is :
\ | /
- RT - Thread Operating System
/ | \ 4.0.3 build Jun 26 2020
2006 - 2020 Copyright by rt-thread team
lwIP-2.0.2 initialized!
ÿ[32m[I/drv.rtc] RTC hasn't been configured, please use <date> command to config.ÿ[0m
ÿ[32m[I/sal.skt] Socket Abstraction Layer initialize success.ÿ[0m
ÿ[31m[E/wiz.dev] You should attach [spi10] into SPI bus firstly.ÿ[0m
ÿ[31m[E/wiz.dev] WIZnet SPI device initialize failed.ÿ[0m
ÿ[31m[E/wiz] RT-Thread WIZnet package (V2.0.0) initialize failed(-6).ÿ[0m
msh />ÿ[32m[I/SDIO] SD card capacity 7716864 KB.ÿ[0m
ÿ[32m[I/app.card] sd card mount to '/'ÿ[0m
/rt.db exist
sql cmd: CREATE TABLE IF NOT EXISTS student(id INTEGER PRIMARY KEY AUTOINCREMENT,name varchar(32) NOT NULL,score INT NOT NULL)
msh />ls
(rt_object_get_type((rt_object_t)thread) == RT_Object_Class_Thread) assertion failed at function:rt_thread_control, line numbeNo such directory
msh />
the line: "sql ret:" is not printed.
i mounted sdcard to /, and i want to use sqlite3. I just did this in main, but it doesn't work:
here is the result: