NO

Author Topic: Simple and tiny SQLite3 GUI shell  (Read 9430 times)

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1866
Simple and tiny SQLite3 GUI shell
« on: March 02, 2010, 12:50:05 pm »
Simple and tiny SQLite3 GUI shell for example.
Use sqlite3.dll from PellesC\bin-folder.
This is a startpoint to someone who want to make it better.

EDIT 20110121: message listview
       20110212: index list
« Last Edit: February 10, 2016, 11:15:45 pm by TimoVJL »
May the source be with you

jmac

  • Guest
Re: Simple and tiny SQLite3 GUI shell
« Reply #1 on: April 13, 2010, 06:49:51 am »
 Hi timovji

I have downloaded your example and am working through it (slowly as yet). Will post an update when I have managed to get some new features working.

Thanks for the great start.

jmac

David L Morris

  • Guest
Re: Simple and tiny SQLite3 GUI shell
« Reply #2 on: August 07, 2010, 06:57:22 am »
Thanks for this example. It is very generous of you to present such functionality with simple and clear comments. I am sure it will be of great help to those studying C, windows SDK and SQlite database development.  You have also covered printing from the ListView.  A great example.

lucindom

  • Guest
Re: Simple and tiny SQLite3 GUI shell
« Reply #3 on: February 11, 2011, 02:12:01 am »
Thanks! Excelent Code......


Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1866
Re: Simple and tiny SQLite3 GUI shell
« Reply #4 on: June 30, 2011, 12:21:20 pm »
Updated:
- Execute multiple SQL statements separated with ; (semicolons)
- 32/64-bit
- code can compiled with msvc too ?

Let me know if you find any errors in that code.

Small example for multiple SQL statements:
Code: [Select]
#include <stdio.h>
#include <stdlib.h>
#include "sqlite3.h"

#ifdef _WIN64
#pragma comment(lib, "SQLite364.lib")
#else
#pragma comment(lib, "SQLite3.lib")
#endif

int __cdecl main(int argc, char **argv)
{
sqlite3 *db;
int rc;
char *szSQL =
"DROP TABLE IF EXISTS test;"
"CREATE TABLE IF NOT EXISTS test (id INTEGER NOT NULL PRIMARY KEY, text VARCHAR(100));"
"INSERT INTO test VALUES (1, 'text1');"
"SELECT * FROM test;";
char *pSQL1, *pSQL2;


rc = sqlite3_open("test.db3", &db);
if (rc == SQLITE_OK)
{
sqlite3_stmt *stmt;
pSQL1 = szSQL; // at start
do
{
rc = sqlite3_prepare_v2(db, pSQL1, -1, &stmt, (const char**)&pSQL2);
if (rc == SQLITE_OK)
{
int nCols = sqlite3_column_count(stmt);
if (nCols)
{
int nCol;
for (nCol = 0; nCol < nCols; nCol++)
printf("%s\t", sqlite3_column_name(stmt, nCol));
printf("\n");
while ((rc = sqlite3_step(stmt)) == SQLITE_ROW)
for (nCol = 0; nCol < nCols; nCol++)
printf("%s\t", sqlite3_column_text(stmt, nCol));
printf("\n");
}
sqlite3_finalize(stmt);
} else {
fprintf(stderr, "Error: %s\n", sqlite3_errmsg(db));
break;
}
pSQL1 = pSQL2; // next statement
} while (*pSQL2);
sqlite3_close(db);
} else {
fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
sqlite3_close(db);
return 1;
}
return 0;
}
EDIT 20110630-22:40: TLSQLite3Shell_WS_0_0_3.zip some fixes
EDIT 20110807: TLSQLite3Shell_WS_0_0_3_1.zip ToolBar bitmap
« Last Edit: August 07, 2011, 04:58:42 pm by timovjl »
May the source be with you

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1866
Re: Simple and tiny SQLite3 GUI shell
« Reply #5 on: January 16, 2014, 04:59:41 pm »
Development version in TLSQLite3Shell_005_UC_WS.zip
Fixes some old bugs and creates new ones ;)

new features:
  • UNICODE version
  • menu bitmaps
let me know what errors found in this version :(
a6 fix UNICODE error string

EDIT 2016-09-01: a7 DBExec in thread, escape stop thread
« Last Edit: September 01, 2016, 04:22:12 pm by TimoVJL »
May the source be with you

Grincheux

  • Guest
Re: Simple and tiny SQLite3 GUI shell
« Reply #6 on: February 10, 2016, 10:21:09 pm »
Quote
SELECT Index,Error,Constante,Hexa,Description FROM WindowsErrorCodes;

NEAR "INDEX":SYNTAX ERROR

Could be useful

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1866
Re: Simple and tiny SQLite3 GUI shell
« Reply #7 on: February 10, 2016, 11:15:06 pm »
I just can't understand that error :(
Can you share that database to look at?
PM link to that?

Or just make a better version from that old code and correct bugs ;)
May the source be with you

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1866
Re: Simple and tiny SQLite3 GUI shell
« Reply #8 on: February 11, 2016, 07:00:00 pm »
INDEX is a keyword, look here.
Use 'index' like this.
May the source be with you

Grincheux

  • Guest
Re: Simple and tiny SQLite3 GUI shell
« Reply #9 on: February 11, 2016, 07:38:01 pm »
Sorry, you are right. In that case the software I use to create the table  would not allow such an item.
That could serve to you, if a user create a field with that name you send an error message.
« Last Edit: February 11, 2016, 07:39:53 pm by Grincheux »

Grincheux

  • Guest
Re: Simple and tiny SQLite3 GUI shell
« Reply #10 on: February 12, 2016, 04:23:24 pm »
Take a glance at http://sqlitebrowser.org/

Grincheux

  • Guest
Re: Simple and tiny SQLite3 GUI shell
« Reply #11 on: February 12, 2016, 04:43:48 pm »