spatialdude / usqlite

μSQLite library module for MicroPython
MIT License
87 stars 18 forks source link

Micropython 1.21 windows port: Compile error #21

Open emile-cronje opened 8 months ago

emile-cronje commented 8 months ago

Good day

Are there any plans to make usqlite compatible with micropython 1.21? I get a compile error in usqlite_cursor.c in function:

STATIC mp_obj_t row_tuple(usqlite_cursor_t *cursor) { int columns = sqlite3_data_count(cursor->stmt);

mp_obj_tuple_t *o = m_new_obj_var(mp_obj_tuple_t, mp_obj_t, columns);
o->base.type = &mp_type_tuple;
o->len = columns;

for (int i = 0; i < columns; i++)
{
    o->items[i] = usqlite_column_value(cursor->stmt, i);
}

return MP_OBJ_FROM_PTR(o);

}

syntax error: ')' in line: mp_obj_tuple_t *o = m_new_obj_var(mp_obj_tuple_t, mp_obj_t, columns);

Regards

beyonlo commented 8 months ago

I'm interested to use sqlite too, but to use in the ESP32-S3 Microcontroller.

spatialdude commented 8 months ago

@emile-cronje @beyonlo Please try the latest v0.1.4 code, it should resolve the issues with the latest version of micropython.

beyonlo commented 8 months ago

@spatialdude just to be sure, this project usqlite works also on the micropython for microcontrollers, like as the ESP32, or just for the micropython UNIX/Windows port?

spatialdude commented 8 months ago

@beyonlo Yes it does work on microcontrollers and the ones I have personally used it on are included here https://github.com/spatialdude/usqlite#ports Do consider if you have enough memory available on your target device to meet your requirements. The memory usage can also be configured - https://github.com/spatialdude/usqlite#memory-allocation-configuration

beyonlo commented 8 months ago

@spatialdude thank you!

Some more questions:

  1. What is the relation of this project with the official micropython lib (that has these files/sqlite support): https://github.com/micropython/micropython-lib/tree/master/unix-ffi/sqlite3
  2. Can this project be a official sqlite3 for the micropython?
  3. Is this project active? While I was writing this post, I see that you did yesterday new commits and now the usqlite suppport that last sqlite version - 2023-11-24 (3.44.2). I was starting to ask you if is active because I saw the last commits was two years ago. Well, my fear is if is there intention to continue supporting and developing this project supporting always the last sqlite version?

Sorry for many questions, but I love sqlite and would like to start using it in the microcontrollers with micropython!

Thank you in advance!

spatialdude commented 3 months ago

@beyonlo There is no official relationship between μSQLite and MicroPython, they're just friends 😉

I would be pleased for μSQLite to be included as a module in MicroPython, but the decision would beed to be made by the MicroPython team @dpgeorge on that if there was sufficient demand from the MP community.

Otherwise I try to routinely keep μSQLite up to date with both MicroPython and SQLite releases.

dpgeorge commented 3 months ago

I really like this project, and it's good to see @spatialdude keep it up-to-date.

I would be pleased for μSQLite to be included as a module in MicroPython, but the decision would beed to be made by the MicroPython team @dpgeorge on that if there was sufficient demand from the MP community.

At this stage I still think it makes sense to have this as a separate project, similar to ulab https://github.com/v923z/micropython-ulab.

Although we have had requests to bundle sqlite3 support with the new webassembly port, so I'll be looking into that in the near future. Will be interesting to see how we can make that work.