Sample C code not working for me.When I tried in terminal its working good but by using sample C code DB also not created. Please help to solve the issues.Thank you
=========================================================================
Sample Output: in terminal
kmani@kmani:~/Documents/LiteSync_64$ sqlite3 "file:app.db?node=primary&bind=tcp://0.0.0.0:1234"
SQLite version 3.36.0 2020-02-06 20:46:08
Enter ".help" for usage hints.
sqlite> pragma sync_status;
{
"use_litesync": true,
"node_type": "primary",
"node_id": 0,
"db_is_ready": false,
"sync_down_state": "unknown",
"sync_up_state": "unknown",
"log_storage": "keep",
"peers": []
}
sqlite> pragma sync_status;
{
"use_litesync": true,
"node_type": "primary",
"node_id": 1,
"db_is_ready": true,
"sync_down_state": "unknown",
"sync_up_state": "unknown",
"log_storage": "keep",
"peers": [{
"node_type": "secondary",
"node_id": 2,
"conn_type": "incoming",
"address": "192.168.1.12:45044",
"conn_state": "connected",
"db_state": "unknown",
"log_storage": "discard"
}]
}
sqlite>
===========================================================================
Sample C Code I tried:
#include <sqlite3.h>
char *uri = "file:app.db?node=primary&bind=tcp://0.0.0.0:1234";
int main() {
sqlite3 *db;
sqlite3_open(uri, &db); /* open the database */
while(1) sleep(1); /* keep the app open */
}
=====================================================================
kmani@kmani:~/Documents/LiteSync_64$ ls
litesync.c litesync-jdbc
kmani@kmani:~/Documents/LiteSync_64$ gcc litesync.c -o litesynout -lsqlite3
litesync.c: In function ‘main’:
litesync.c:11:12: warning: implicit declaration of function ‘sleep’ [-Wimplicit-function-declaration]
while(1) sleep(1); /* keep the app open */
^~~~~
kmani@kmani:~/Documents/LiteSync_64$ ls
litesync.c litesync-jdbc litesynout
kmani@kmani:~/Documents/LiteSync_64$ ./litesynout
Start
Open DB
^C
kmani@kmani:~/Documents/LiteSync_64$ ls
litesync.c litesync-jdbc litesynout
Note: DB is not created