Skip to content

Commit

Permalink
Up to 1.3.8
Browse files Browse the repository at this point in the history
+ Windows 10 support
+ Query parameters e.g. select * from t where id < @id
+ strpart(str, delims, partno), e.g. select strpart('ab-cd-ef', '-', 2) --> 'cd'
* Reform Edit data dialog
* Generate data for any schema
* Minor changes
* Fix minor bugs
  • Loading branch information
little-brother committed Jan 19, 2021
1 parent f97b87b commit fc83ba3
Show file tree
Hide file tree
Showing 25 changed files with 754 additions and 292 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Sqlite-gui is a lightweight Windows GUI for [SQLite](https://www.sqlite.org/index.html) powered by C++, WinAPI and [Code::Blocks 17](http://www.codeblocks.org/). <br>

|[**Download latest version**](https://github.com/little-brother/sqlite-gui/releases/latest)|
|[**Download the latest version**](https://github.com/little-brother/sqlite-gui/releases/latest)|
|-------------------------------------------------------------------------------------------|


![View](resources/image.webp)
![View](resources/demo.webp)


### Features
Expand All @@ -15,17 +15,19 @@ Sqlite-gui is a lightweight Windows GUI for [SQLite](https://www.sqlite.org/inde
* Database comparison
* Search text in the whole database
* [Workflow manager](https://github.com/little-brother/sqlite-wf) (ETL)
* Quick data references ([video](https://youtu.be/XL1_lFhzLKo))
* Terminal mode
* Charts
* [Quick data references](https://github.com/little-brother/sqlite-gui/wiki#quick-references) ([video](https://youtu.be/XL1_lFhzLKo))
* [Terminal mode](https://raw.githubusercontent.com/little-brother/sqlite-gui/master/resources/terminal.webp)
* [Charts](https://github.com/little-brother/sqlite-gui/wiki#charts)
* [Query parameters](https://github.com/little-brother/sqlite-gui/wiki#query-parameters)
* Data generator
* Most usefull extensions are included
* [Extension pack](https://github.com/little-brother/sqlite-gui/wiki#extensions)
* Demo database "Bookstore" for beginners
* Does not require installation

### Cons
* Only utf-8 is supported
* NULL is displayed as an empty string and an empty string is set to NULL when data is edit
* The application is a single threaded. Therefore, the interface freeze on long operations

If you like the project, press the like-button [here](https://alternativeto.net/software/sqlite-gui/) or write something in a [Reddit](https://www.reddit.com/r/sqlite/comments/iaao8x/a_new_lightweight_sqlite_tool_for_windows/) topic to support it.<br>
If you have any problems, comments or suggestions, check [Wiki](https://github.com/little-brother/sqlite-gui/wiki) or just let me know <a href="mailto:[email protected]?subject=sqlite-gui">[email protected]</a>.
65 changes: 52 additions & 13 deletions extensions/ora.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,19 @@
md5(str)
Calculate md5 checksum
strpart(str, delimiter, partno)
Returns substring for a delimiter and a part number
select strpart('ab-cd-ef', '-', 2) --> 'cd'
select strpart('20.01.2021', '.', 3) --> 2021
*/
#include "sqlite3ext.h"
SQLITE_EXTENSION_INIT1
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <windows.h>

typedef unsigned char UINT8;
typedef unsigned int UINT;

static void rownum(sqlite3_context *ctx, int argc, sqlite3_value **argv){
int *pCounter = (int*)sqlite3_get_auxdata(ctx, 0);
Expand Down Expand Up @@ -167,18 +172,18 @@ const UINT r[] = {

#define LEFTROTATE(x, c) (((x) << (c)) | ((x) >> (32 - (c))))

void to_bytes(UINT val, UINT8 *bytes) {
static void to_bytes(UINT val, UINT8 *bytes) {
bytes[0] = (UINT8) val;
bytes[1] = (UINT8) (val >> 8);
bytes[2] = (UINT8) (val >> 16);
bytes[3] = (UINT8) (val >> 24);
}

UINT to_int32(const UINT8 *bytes) {
static UINT to_int32(const UINT8 *bytes) {
return (UINT) bytes[0] | ((UINT) bytes[1] << 8) | ((UINT) bytes[2] << 16) | ((UINT) bytes[3] << 24);
}

void _md5(const UINT8 *initial_msg, size_t initial_len, UINT8 *digest) {
static void _md5(const UINT8 *initial_msg, size_t initial_len, UINT8 *digest) {
UINT h0, h1, h2, h3;
UINT8 *msg = NULL;

Expand Down Expand Up @@ -248,23 +253,57 @@ void _md5(const UINT8 *initial_msg, size_t initial_len, UINT8 *digest) {
to_bytes(h3, digest + 12);
}

char const hex_chars[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};

static void md5 (sqlite3_context *ctx, int argc, sqlite3_value **argv) {
UINT8 r[16];
_md5(sqlite3_value_text(argv[0]), strlen(sqlite3_value_text(argv[0])), r);
UINT8 res[16];
_md5(sqlite3_value_text(argv[0]), strlen(sqlite3_value_text(argv[0])), res);

char buf[33];
for(int i = 0; i < 16; i++) {
char byte = res[i];
buf[2 * i] = hex_chars[(byte & 0xF0) >> 4];
buf[2 * i + 1] = hex_chars[(byte & 0x0F) >> 0];
}
buf[32] = 0;

sqlite3_result_text(ctx, buf, -1, SQLITE_TRANSIENT);
}

char buf[17];
sprintf(buf, "%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x", r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8], r[9], r[10], r[11], r[12], r[13], r[14], r[15]);
sqlite3_result_text(ctx, buf, -1, SQLITE_TRANSIENT);
static void strpart (sqlite3_context *ctx, int argc, sqlite3_value **argv) {
const char* instr = sqlite3_value_text(argv[0]);
const char* delim = sqlite3_value_text(argv[1]);
int no = sqlite3_value_int(argv[2]);

if (no < 1) {
sqlite3_result_null(ctx);
return;
}

char str[strlen(instr) + 1];
strcpy(str, instr);

char *ptr = strtok(str, delim);
int curr = 0;
while (ptr != NULL && curr < no - 1) {
ptr = strtok(NULL, delim);
curr++;
}

if (ptr)
sqlite3_result_text(ctx, ptr, -1, SQLITE_TRANSIENT);
else
sqlite3_result_null(ctx);
}

__declspec(dllexport) int sqlite3_ora_init(sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi) {
int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi);
(void)pzErrMsg; /* Unused parameter */
return SQLITE_OK == sqlite3_create_function(db, "rownum", 1, SQLITE_UTF8, 0, rownum, 0, 0) &&
SQLITE_OK == sqlite3_create_function(db, "concat", -1, SQLITE_UTF8, 0, concat, 0, 0) &&
SQLITE_OK == sqlite3_create_function(db, "decode", -1, SQLITE_UTF8, 0, decode, 0, 0) &&
SQLITE_OK == sqlite3_create_function(db, "crc32", 1, SQLITE_UTF8, 0, crc32, 0, 0) &&
SQLITE_OK == sqlite3_create_function(db, "md5", 1, SQLITE_UTF8, 0, md5, 0, 0) ?
SQLITE_OK == sqlite3_create_function(db, "md5", 1, SQLITE_UTF8, 0, md5, 0, 0) &&
SQLITE_OK == sqlite3_create_function(db, "strpart", 3, SQLITE_UTF8, 0, strpart, 0, 0) ?
SQLITE_OK : SQLITE_ERROR;
}
Binary file removed resources/btn_add.bmp
Binary file not shown.
Binary file removed resources/btn_delete.bmp
Binary file not shown.
Binary file removed resources/btn_refresh.bmp
Binary file not shown.
Binary file added resources/charts.webp
Binary file not shown.
Binary file added resources/demo.webp
Binary file not shown.
Binary file removed resources/image.webp
Binary file not shown.
Binary file added resources/terminal.webp
Binary file not shown.
Binary file added resources/toolbar_data.bmp
Binary file not shown.
3 changes: 3 additions & 0 deletions sqlite-gui.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@
</Build>
<Compiler>
<Add option="-Wall" />
<Add option="-std=c++11" />
</Compiler>
<Linker>
<Add option="-static-libgcc" />
<Add option="-static-libstdc++ -static-libgcc" />
<Add library="gdi32" />
<Add library="user32" />
<Add library="kernel32" />
Expand Down
26 changes: 14 additions & 12 deletions sqlite-gui.depend
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,28 @@
1562796420 d:\codes\sqlite-gui\sqlite3.h
<stdarg.h>

1610099075 source:d:\codes\sqlite-gui\src\resource.rc
1611058507 source:d:\codes\sqlite-gui\src\resource.rc
<windows.h>
<commctrl.h>
<richedit.h>
"resource.h"

1609978095 d:\codes\sqlite-gui\src\resource.h
1610981283 d:\codes\sqlite-gui\src\resource.h

1609924139 source:d:\codes\sqlite-gui\src\prefs.cpp
1611090146 source:d:\codes\sqlite-gui\src\prefs.cpp
<ctime>
"prefs.h"
"sqlite3.h"

1602007947 d:\codes\sqlite-gui\src\prefs.h
1611089165 d:\codes\sqlite-gui\src\prefs.h
<stdio.h>
<windows.h>
<tchar.h>

1583506689 d:\codes\sqlite-gui\src\sqlite3.h
<stdarg.h>

1610058432 source:d:\codes\sqlite-gui\src\main.cpp
1611003745 source:d:\codes\sqlite-gui\src\main.cpp
"global.h"
"missing.h"
"resource.h"
Expand All @@ -57,19 +57,19 @@

1583970008 d:\codes\sqlite-gui\src\main.h

1605587592 d:\codes\sqlite-gui\src\utils.h
1610994001 d:\codes\sqlite-gui\src\utils.h
<tchar.h>
<windows.h>
"sqlite3.h"

1605587816 source:d:\codes\sqlite-gui\src\utils.cpp
1610994064 source:d:\codes\sqlite-gui\src\utils.cpp
<windows.h>
<stdio.h>
<stdlib.h>
<ctype.h>
"utils.h"

1610099913 source:d:\codes\sqlite-gui\src\tools.cpp
1611001401 source:d:\codes\sqlite-gui\src\tools.cpp
"global.h"
"missing.h"
"resource.h"
Expand All @@ -78,7 +78,7 @@
"dialogs.h"
"prefs.h"

1610048754 d:\codes\sqlite-gui\src\global.h
1610376139 d:\codes\sqlite-gui\src\global.h
<windows.h>
<windowsx.h>
<commctrl.h>
Expand All @@ -90,20 +90,22 @@
<sys/stat.h>
<locale.h>
<math.h>
"missing.h"
"sqlite3.h"

1605592862 d:\codes\sqlite-gui\src\tools.h
<windows.h>

1609944947 d:\codes\sqlite-gui\src\dialogs.h
1610981781 d:\codes\sqlite-gui\src\dialogs.h
<windows.h>

1610099817 source:d:\codes\sqlite-gui\src\dialogs.cpp
1611092472 source:d:\codes\sqlite-gui\src\dialogs.cpp
"resource.h"
"global.h"
"prefs.h"
"utils.h"
"dialogs.h"
"tools.h"

1606840569 d:\codes\sqlite-gui\include\sqlite3.h
<stdarg.h>
Expand All @@ -116,7 +118,7 @@
"oaidl.h"
"ocidl.h"

1609795113 d:\codes\sqlite-gui\src\missing.h
1610377907 d:\codes\sqlite-gui\src\missing.h

1595499199 c:\mingw\include\windows.h
<winresrc.h>
Expand Down
56 changes: 28 additions & 28 deletions sqlite-gui.layout
Original file line number Diff line number Diff line change
Expand Up @@ -2,74 +2,74 @@
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Release" />
<File name="ToDo.txt" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src\utils.cpp" open="1" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2743" topLine="3" />
<Cursor1 position="3012" topLine="0" />
</Cursor>
</File>
<File name="src\dialogs.cpp" open="1" top="1" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src\missing.h" open="1" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="67638" topLine="1996" />
<Cursor1 position="588" topLine="0" />
</Cursor>
</File>
<File name="src\dialogs.h" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src\utils.h" open="1" top="1" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="263" topLine="0" />
<Cursor1 position="545" topLine="0" />
</Cursor>
</File>
<File name="src\global.h" open="1" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src\prefs.cpp" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2770" topLine="52" />
<Cursor1 position="1355" topLine="0" />
</Cursor>
</File>
<File name="src\main.cpp" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="-1" zoom_2="0">
<File name="src\prefs.h" open="1" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="109034" topLine="2967" />
<Cursor1 position="340" topLine="0" />
</Cursor>
</File>
<File name="src\missing.h" open="1" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src\resource.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="46" topLine="0" />
<Cursor1 position="484" topLine="0" />
</Cursor>
</File>
<File name="src\prefs.cpp" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src\resource.rc" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="120" topLine="0" />
<Cursor1 position="29269" topLine="664" />
</Cursor>
</File>
<File name="src\prefs.h" open="1" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src\tools.cpp" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="182" topLine="0" />
<Cursor1 position="27363" topLine="0" />
</Cursor>
</File>
<File name="src\resource.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="ToDo.txt" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2790" topLine="37" />
<Cursor1 position="1325" topLine="0" />
</Cursor>
</File>
<File name="src\resource.rc" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src\dialogs.cpp" open="1" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="17761" topLine="325" />
<Cursor1 position="9" topLine="0" />
</Cursor>
</File>
<File name="src\tools.cpp" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src\dialogs.h" open="1" top="0" tabpos="14" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="72441" topLine="1874" />
<Cursor1 position="874" topLine="0" />
</Cursor>
</File>
<File name="src\tools.h" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src\global.h" open="1" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="850" topLine="0" />
<Cursor1 position="903" topLine="15" />
</Cursor>
</File>
<File name="src\utils.cpp" open="1" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src\tools.h" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="3130" topLine="161" />
<Cursor1 position="850" topLine="0" />
</Cursor>
</File>
<File name="src\utils.h" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src\main.cpp" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="-1" zoom_2="0">
<Cursor>
<Cursor1 position="255" topLine="0" />
<Cursor1 position="16236" topLine="0" />
</Cursor>
</File>
</CodeBlocks_layout_file>
Loading

0 comments on commit fc83ba3

Please sign in to comment.