DynSQLite Library - SQLite support library

Started by Michele, November 09, 2026, 12:12:02 AM

Previous topic - Next topic

John Z

Hi Michele,

Started to look more into your masterpiece - Two minor things at the start.
When opening a DB there is very little notification that it has been opened successfully. I did eventually notice the Title bar text change, but perhaps something more affirmative could be done.

Secondly if 'mistakenly'  ;)  opening a .pdf, or .txt, or non-database file the program crashes.  Might want to validate, as a minimum, that the selected file has an extension which is one of the three you allow.

Then check the header to be sure it is a valid SQLite db before trying to load it - valid SQLite 3 database begins with a 16-byte magic header string that spells out SQLite format 3 followed by a null terminator.

Cheers,
John Z

John Z

#31
Hi Michele,

A display issue with column 2.  I mistakenly have it as blob and will fix it.
Nevertheless as the attached image shows SQLite DB browser shows the value while the Studio is just showing (i guess the format) <BLOB 1 bytes>

John Z

Update:   
I miss having a MRU/Recent files list.

Needing to hit save for every entry is burdensome

Like to write all changes at once so a 'Write Changes' menu item

Missing 'Save As' so I tried Backup
Tools - Backup does not seem to work , took filename but I never found the file. then I entered the same backup name twice didn't ask to overwrite so more indication  nothing was backed up.

SQL queries worked fine.

After testing/using for a while not a fan of the static splash window just housing the menu, using screen space, maybe it should be retractable to just the menu after a while.

I see </> on the splash window so I want to click < or > to cycle thru 'something' usually means forward backward but its just an image ....

Done for today - but more testing later

Still very impressive!
John Z

Michele

Quote from: TimoVJL on November 11, 2026, 09:01:43 PMNext hint is to use WIN32_LEAN_AND_MEAN to every project, that use windows.h
I tried to implement it, but because of different SDK's structures of each compiler, clang, gcc, msvcand PellesC, the compilation process produce a bunch of errors due to undefined symbols as consequence of definitions sparse in different headers.
I managed to conditionally add headers per each compiler, but the advantage of WIN32_LEAN_AND_MEAN doesn't pay for the nightmare of conditionality and the effort to search for missing definitions headers.
I removed it.

Michele

#33
Quote from: John Z on November 15, 2026, 11:08:22 AMHi Michele,

Started to look more into your masterpiece - Two minor things at the start.
When opening a DB there is very little notification that it has been opened successfully. I did eventually notice the Title bar text change, but perhaps something more affirmative could be done.
Cheers,
John Z
Hello John, thanks for the feedback.
The notification is an option of the SQLiteStudio, which is simply a demo for the library DynSQLite, and doesn't pretend to compete with other similar apps. Anyway I added some message in the next revision.

Quote from: John Z on November 15, 2026, 11:08:22 AMSecondly if 'mistakenly'  ;)  opening a .pdf, or .txt, or non-database file the program crashes.  Might want to validate, as a minimum, that the selected file has an extension which is one of the three you allow.

Then check the header to be sure it is a valid SQLite db before trying to load it - valid SQLite 3 database begins with a 16-byte magic header string that spells out SQLite format 3 followed by a null terminator.
Thanks for the feedback I realized that the sqlite3_open_v2() is a lazy functions, that doesn't check the consistency of the opened database and returns a context handle whatever you're trying to open.  >:(
I added code to check for a valid file and don't fails on new databases (DB file not existing yet).

Quote from: John Z on November 15, 2026, 05:45:04 PMHi Michele,

A display issue with column 2.  I mistakenly have it as blob and will fix it.
Nevertheless as the attached image shows SQLite DB browser shows the value while the Studio is just showing (i guess the format) <BLOB 1 bytes>

John Z
Actually the DynSQLite engine treats the blobs as what they are, and allows to save/modify from files.
Unfortunately it very diffused to use them also for long (or even short) text, that's why 'SQLite DB browser' checks for printable text and eventually display it. To implement this function I need more time to distinguish between real text and binary code beginning with printable test.
I'll implement later.

Quote from: John Z on November 15, 2026, 05:45:04 PMI miss having a MRU/Recent files list.

Like to write all changes at once so a 'Write Changes' menu item

Missing 'Save As' so I tried Backup
Tools - Backup does not seem to work , took filename but I never found the file. then I entered the same backup name twice didn't ask to overwrite so more indication  nothing was backed up.

SQL queries worked fine.

After testing/using for a while not a fan of the static splash window just housing the menu, using screen space, maybe it should be retractable to just the menu after a while.

I see </> on the splash window so I want to click < or > to cycle thru 'something' usually means forward backward but its just an image ....

Done for today - but more testing later

Still very impressive!
John Z
These are all features of the demo browser SQLiteStudio, not the core engine of the DynSQLite library. I would to complete and debug it first. Anyway I would appreciate your help for modifications to SQLStudio project,
The 'backup' entry was supposed to act as 'Save As' probably got bugged during open code modifications. It uses the vacuum feature to create a clean copy. I'll have a look, but also this is part of SQLiteStudio.

Quote from: John Z on November 15, 2026, 05:45:04 PMNeeding to hit save for every entry is burdensome
A note here, DynSQLite, which main intent is to create a library to simplify DB managing inside user projects, directly modify the DataBase, that's why it asks, while 'SQLite DB browser' works on a local copy and only after 'Save DB' apply the modifications to the real database.
DynSQLite allows you to create fast managing of database functions in a program, doesn't have to work on a copy to commit, it doesn't allow the undoes. Once again to work on memory copy can be implemented in SQLStudio creating a memory copy database and then write it.
A practical example is to insert DynSQLite in your Hint-SA to quick modify or add the functions database.

Anyway I'm hard working on actual basecode for some major bugs that I found leading to crashes.

I'll be back soon (or I hope so).

John Z

Hi Michele,

I understand now, the implementation of the library vs. the library itself. The latter being the desired target...not the program which demonstrates the library.

John Z

TimoVJL

#35
Quote from: Michele on <strong>Yesterday</strong> at 09:19:15 AM
Quote from: TimoVJL on November 11, 2026, 09:01:43 PMNext hint is to use WIN32_LEAN_AND_MEAN to every project, that use windows.h
I tried to implement it, but because of different SDK's structures of each compiler, clang, gcc, msvcand PellesC, the compilation process produce a bunch of errors due to undefined symbols as consequence of definitions sparse in different headers.
I managed to conditionally add headers per each compiler, but the advantage of WIN32_LEAN_AND_MEAN doesn't pay for the nightmare of conditionality and the effort to search for missing definitions headers.
I removed it.
Just curious, how a simple define can be reason for errors in standard WinSDK headers ?
What set fails ?
msvc and clang usually use MS WinSDK headers and gcc mingw.

Only lib_src\AboutDlg.c needs <ole2.h> ?
AboutDlg.c(64): warning #2018: Undeclared function 'CreateStreamOnHGlobal' (did you mean: ?);
May the source be with you

Michele

Quote from: TimoVJL on <strong>Yesterday</strong> at 12:07:54 PMJust curious, how a simple define can be reason for errors in standard WinSDK headers ?
What set fails ?
msvc and clang usually use MS WinSDK headers and gcc mingw.

Only lib_src\AboutDlg.c needs <ole2.h> ?
AboutDlg.c(64): warning #2018: Undeclared function 'CreateStreamOnHGlobal' (did you mean: ?);
Hello TimoVJL,
Testing between compiler takes more time, adding a function creates a problem to follow.
When developing and, specially, debugging for weird bugs this becomes frustrating, and it just spares a couple of seconds max on a full recompilation.
Maybe can be an optimization to consider after completing.

PS: Ole2.h isn't required because of lean and mean by itself, but when using gdiplus.h for example, and other compilers require dlgcomm.h to be added, and so on each time you introduce a new function.

TimoVJL

#37
Quote from: Michele on <strong>Yesterday</strong> at 01:57:06 PMPS: Ole2.h isn't required because of lean and mean by itself, but when using gdiplus.h for example, and other compilers require dlgcomm.h to be added, and so on each time you introduce a new function.
Just don't use gdiplus.h, use gdiplusflat.h instead, if COM isn't used.
May the source be with you

Michele

#38
Quote from: TimoVJL on <strong>Yesterday</strong> at 02:16:42 PMJust don't use gdiplus.h, use gdiplusflat.h instead, if COM isn't used.
Actually the gdiplus.h that I distribute with the release just #include <fGdiPlusFlat.h>, that I included in the same zip. And it requires Ole2.h.
But anyway it would be another conditional (#ifdef/#else/#endif) to add.
I'll consider it when the heavier part of the engine will be completed and, hopefully, can leave beta stage.

Why do you consider so important the use of WIN32_LEAN_AND_MEAN?

TimoVJL

#39
Quote from: Michele on <strong>Yesterday</strong> at 03:17:58 PMWhy do you consider so important the use of WIN32_LEAN_AND_MEAN?
It might shorten a build time
This case without it
Build time: 158131ms
with it
Build time: 118469ms

so not much differences.

Quote from: Michele on <strong>Yesterday</strong> at 03:17:58 PMActually the gdiplus.h that I distribute with the release just #include <fGdiPlusFlat.h>, that I included in the same zip. And it requires Ole2.h.
where ?
Also MS WinSDK gdiplusflat.h don't include ole2.h eighter, but it have an own problems, as it don't support ISO C and is only for C++.

EDIT: error when using clang.exe v23
clang.exe -c -D_CRT_SECURE_NO_WARNINGS -DMSQL_STATIC=1 ..\lib_src\*.c..\lib_src\Browser.c(251,5): error: call to undeclared function 'asprintf'; ISO C99 and later do not support implicit
      function declarations [-Wimplicit-function-declaration]
  251 |     asprintf(&finalWhereClause, "WHERE (%s)", conditionsBuf);
      |     ^
1 error generated.
May the source be with you

Michele

#40
Quote from: TimoVJL on <strong>Yesterday</strong> at 04:56:52 PM
Quote from: Michele on <strong>Yesterday</strong> at 03:17:58 PMActually the gdiplus.h that I distribute with the release just #include <fGdiPlusFlat.h>, that I included in the same zip. And it requires Ole2.h.
where ?
Also MS WinSDK gdiplusflat.h don't include ole2.h eighter, but it have an own problems, as it don't support ISO C and is only for C++.
TimoVJL PellesC requires it, this is the configuration required to use WIN32_LEAN_AND_MEAN, the file is AboutDlg.h:
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#include <wtypes.h>
#ifdef __POCC__
//#include <ole2.h>    //Commented to generate errors
#include "gdiplus.h"
#else
#include <gdiplus.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
#include <sqlite3.h>
#include "DynSqlite.h"
I commented out Ole32.h to force error generation:
Building AboutDlg.obj.
D:\PellesC_Dev\LIBS\DynSqlite\lib_src\AboutDlg.c(67): warning #2018: Undeclared function 'CreateStreamOnHGlobal' (did you mean: ?); assuming 'extern' returning 'int'.
D:\PellesC_Dev\LIBS\DynSqlite\lib_src\AboutDlg.c(118): error #2152: Unknown member 'lpVtbl' of 'IStream (aka (incomplete) struct IStream)' (did you mean: ?).
D:\PellesC_Dev\LIBS\DynSqlite\lib_src\AboutDlg.c(118): error #2113: Left operand of '->' has incompatible type 'int'.
D:\PellesC_Dev\LIBS\DynSqlite\lib_src\AboutDlg.c(118): error #2068: Expected called object to have function type, but found 'int'.
*** Error code: 1 ***
Done.
I'm doing the development using Clang under Eclipse IDE and don't see a big change in compilation times. PellesC IDE, with all the respect for such great piece of software, doesn't fit very well development, and especially debug of large projects.
Jumping between the 2 compilers, not considering the others, add more work to do.
Honestly this is a library, and once compiled you have only to link it to other projects (not build each time), in those you are free to use WIN32_LEAN_AND_MEAN to speed up your project compilation.

Michele

Quote from: John Z on <strong>Yesterday</strong> at 10:51:22 AMHi Michele,

I understand now, the implementation of the library vs. the library itself. The latter being the desired target...not the program which demonstrates the library.

John Z
👍