NO

Author Topic: Need example code for C and Sqlite  (Read 781 times)

Offline valema

  • Member
  • *
  • Posts: 2
Need example code for C and Sqlite
« on: January 24, 2023, 12:00:54 AM »
Hello, yes that's it; and with or without ODBC.
I have tried using the raw sqlite.c (and .h) code but got these errors:

POLINK: error: Unresolved external symbol '__endthreadex' - referenced from 'C:\SQLite\sqlite-amalgamation-3400100\output\sqlite3.obj'.
POLINK: error: Unresolved external symbol '__beginthreadex' - referenced from 'C:\SQLite\sqlite-amalgamation-3400100\output\sqlite3.obj'.

(I run windows 10, 64)

I then installed odbc for sqlite... and

http://www.intelmenu.com/notes/c/c_odbc.html

copy pasted that code (a new project): got other errors,

POLINK: error: Unresolved external symbol '_SQLAllocHandle@12' - referenced from 'C:\Users\valte\Documents\videoprojekt\app_med_go_java_sqlite\c\test_odbc\output\prog.obj'.
POLINK: error: Unresolved external symbol '_SQLSetEnvAttr@16' - referenced from 'C:\Users\valte\Documents\videoprojekt\app_med_go_java_sqlite\c\test_odbc\output\prog.obj'.
POLINK: error: Unresolved external symbol '_SQLSetConnectAttr@16' - referenced from 'C:\Users\valte\Documents\videoprojekt\app_med_go_java_sqlite\c\test_odbc\output\prog.obj'.
POLINK: error: Unresolved external symbol '_SQLConnect@28' - referenced from 'C:\Users\valte\Documents\videoprojekt\app_med_go_java_sqlite\c\test_odbc\output\prog.obj'.
POLINK: error: Unresolved external symbol '_SQLDisconnect@4' - referenced from 'C:\Users\valte\Documents\videoprojekt\app_med_go_java_sqlite\c\test_odbc\output\prog.obj'.
POLINK: error: Unresolved external symbol '_SQLFreeHandle@8' - referenced from 'C:\Users\valte\Documents\videoprojekt\app_med_go_java_sqlite\c\test_odbc\output\prog.obj'.
POLINK: error: Unresolved external symbol '_SQLExecDirect@12' - referenced from 'C:\Users\valte\Documents\videoprojekt\app_med_go_java_sqlite\c\test_odbc\output\prog.obj'.
POLINK: error: Unresolved external symbol '_SQLFetch@4' - referenced from 'C:\Users\valte\Documents\videoprojekt\app_med_go_java_sqlite\c\test_odbc\output\prog.obj'.
POLINK: error: Unresolved external symbol '_SQLGetData@24' - referenced from 'C:\Users\valte\Documents\videoprojekt\app_med_go_java_sqlite\c\test_odbc\output\prog.obj'.
« Last Edit: January 24, 2023, 12:20:43 AM by valema »

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2092
Re: Need example code for C and Sqlite
« Reply #1 on: January 24, 2023, 07:08:36 AM »
Hello, yes that's it; and with or without ODBC.
I have tried using the raw sqlite.c (and .h) code but got these errors:

POLINK: error: Unresolved external symbol '__endthreadex' - referenced from 'C:\SQLite\sqlite-amalgamation-3400100\output\sqlite3.obj'.
POLINK: error: Unresolved external symbol '__beginthreadex' - referenced from 'C:\SQLite\sqlite-amalgamation-3400100\output\sqlite3.obj'.
Choose from project options Compiler -> Code generation multithreaded library

SQLite use __cdecl , so use it project too.

this project might have modified header file sqlite3c.h for __cdecl
https://forum.pellesc.de/index.php?topic=3110.msg14062#msg14062

For ODBC
add odbc32.lib to project

https://forum.pellesc.de/index.php?topic=2489.msg9424#msg9424

« Last Edit: January 24, 2023, 07:21:43 AM by TimoVJL »
May the source be with you

Offline John Z

  • Member
  • *
  • Posts: 799
Re: Need example code for C and Sqlite
« Reply #2 on: January 24, 2023, 12:53:25 PM »
Hello, yes that's it; and with or without ODBC.

Need sample code
In this forum look for CFE, if not found it is also hosted at
 https://sourceforge.net/projects/convolution-filter-editor/
a good example using sqllite and Pelles C by forum member Grincheux

John Z

forum
https://forum.pellesc.de/index.php?topic=10182.msg35965#msg35965 

another sqlite program example link with smaller overhead
https://forum.pellesc.de/index.php?topic=10177.0
« Last Edit: January 24, 2023, 01:01:41 PM by John Z »