Conversation
lua/interface.lua
Outdated
| int sqlite3_libversion_number(void); | ||
| ]] | ||
|
|
||
| print(ffi.string(clib.sqlite3_libversion())) |
There was a problem hiding this comment.
We need to do ffi.string wrapped. We also need to check if NULL i think
There was a problem hiding this comment.
If the value is nil then it should skip sending nil i think
There was a problem hiding this comment.
Was just a comment to myself because i noticed that weird output of clib.sqlite3_libversion() without it
lua/interface.lua
Outdated
| int sqlite3_prepare( | ||
| sqlite3 *db, /* Database handle */ | ||
| const char *zSql, /* SQL statement, UTF-8 encoded */ | ||
| int nByte, /* Maximum length of zSql in bytes. */ | ||
| sqlite3_stmt **ppStmt, /* OUT: Statement handle */ | ||
| const char **pzTail /* OUT: Pointer to unused portion of zSql */ | ||
| ); | ||
| int sqlite3_prepare_v2( | ||
| sqlite3 *db, /* Database handle */ | ||
| const char *zSql, /* SQL statement, UTF-8 encoded */ | ||
| int nByte, /* Maximum length of zSql in bytes. */ | ||
| sqlite3_stmt **ppStmt, /* OUT: Statement handle */ | ||
| const char **pzTail /* OUT: Pointer to unused portion of zSql */ | ||
| ); | ||
| int sqlite3_prepare_v3( | ||
| sqlite3 *db, /* Database handle */ | ||
| const char *zSql, /* SQL statement, UTF-8 encoded */ | ||
| int nByte, /* Maximum length of zSql in bytes. */ | ||
| unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_ flags */ | ||
| sqlite3_stmt **ppStmt, /* OUT: Statement handle */ | ||
| const char **pzTail /* OUT: Pointer to unused portion of zSql */ | ||
| ); | ||
| int sqlite3_prepare16( | ||
| sqlite3 *db, /* Database handle */ | ||
| const void *zSql, /* SQL statement, UTF-16 encoded */ | ||
| int nByte, /* Maximum length of zSql in bytes. */ | ||
| sqlite3_stmt **ppStmt, /* OUT: Statement handle */ | ||
| const void **pzTail /* OUT: Pointer to unused portion of zSql */ | ||
| ); | ||
| int sqlite3_prepare16_v2( | ||
| sqlite3 *db, /* Database handle */ | ||
| const void *zSql, /* SQL statement, UTF-16 encoded */ | ||
| int nByte, /* Maximum length of zSql in bytes. */ | ||
| sqlite3_stmt **ppStmt, /* OUT: Statement handle */ | ||
| const void **pzTail /* OUT: Pointer to unused portion of zSql */ | ||
| ); | ||
| int sqlite3_prepare16_v3( | ||
| sqlite3 *db, /* Database handle */ | ||
| const void *zSql, /* SQL statement, UTF-16 encoded */ | ||
| int nByte, /* Maximum length of zSql in bytes. */ | ||
| unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_ flags */ | ||
| sqlite3_stmt **ppStmt, /* OUT: Statement handle */ | ||
| const void **pzTail /* OUT: Pointer to unused portion of zSql */ | ||
| ); | ||
| ]] |
There was a problem hiding this comment.
We don't need that many prepare statements. Just prepare and prepare16. So which version do we keep 😆
There was a problem hiding this comment.
@Conni2461 If there is no difference between then any would be fine. Also what does the additional 16 means?
There was a problem hiding this comment.
UTF-8 vs UTF-16 encoded statement can be found in the comment 😆
There was a problem hiding this comment.
🤣🤣 oh then I believe as user we need both, no?
There was a problem hiding this comment.
We need definitely both 8 and 16 but i have no idea whats the difference between v1, v2, v3
- sqlite3rtree - sqlite3session - fts5
I guess defs.lua, inside sql dir if it's only purpose is to have the low level ffi stuff
|
Before lazy was default and there was no way of changing that. I've
decided to make it optional because it seems that:
1. People expects sqlite {} or sqlite:extend {} to create all the
defined table in advance.
2. Performance impact of initializing db object is only 1.0 slower in
microseconds, so it seems to not be as important as I thought it
would:
```lua
-- test/lazy.lua
Benchmark #1: 'Logical Component'
Time(mean ± σ): 23.7 μs ± 18.7 μs
Range(min … max): 17.4 μs … 102.3 μs 20 runs
Benchmark #2: 'Full Initialization'
Time(mean ± σ): 28.7 μs ± 12.9 μs
Range(min … max): 24.1 μs … 83.1 μs 20 runs
Summary
'Logical Component' ran
1.2 ± 1.1 times faster than 'Full Initialization'
```
Right now testing with
:luafile %.How should we name that file?
Edit: I am going to copy everything and then we can get rid of everything we don't really need like
sqlite3_int64 sqlite3_memory_used(void)or do we need*sqlite3_malloc(int). We will see :) I am at 25% right now