https://github.com/whjwnavy/sqllite_c_api
sqllite c api
https://github.com/whjwnavy/sqllite_c_api
sql sqlite sqlite-database sqlite3
Last synced: about 1 month ago
JSON representation
sqllite c api
- Host: GitHub
- URL: https://github.com/whjwnavy/sqllite_c_api
- Owner: WHJWNAVY
- Created: 2019-11-12T09:59:47.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-31T02:12:21.000Z (almost 6 years ago)
- Last Synced: 2025-07-21T09:55:25.679Z (11 months ago)
- Topics: sql, sqlite, sqlite-database, sqlite3
- Language: C
- Size: 2.78 MB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# sqllite_c_api
## sql_count
```c
/*****************************************************************************
Name : sql_count
Description : Get the number of entries in the specified table.
Input : sqlite3 *db : sqlite context.
const char *tbl : table name.
Output : NULL
Return : The number of entries in the specified table.
*****************************************************************************/
uint32_t sql_count(sqlite3 *db, const char *tbl);
```
## sql_test
```c
/*****************************************************************************
Name : sql_test
Description : Determine if the specified entry exists in the table.
Input : sqlite3 *db : sqlite context.
const char *tbl : table name.
sql_keyval_t *pkey : Primary key and value of this table.
Output : NULL
Return : Non-zero for Existence / Zero for Nonexistence
*****************************************************************************/
uint32_t sql_test(sqlite3 *db, const char *tbl, sql_keyval_t *pkey);
```
## sql_delete
```c
/*****************************************************************************
Name : sql_delete
Description : Delete the specified entry in the table.
Input : sqlite3 *db : sqlite context.
const char *tbl : table name.
sql_keyval_t *pkey : Primary key and value of this table.
Output : NULL
Return : Error code.
*****************************************************************************/
error_t sql_delete(sqlite3 *db, const char *tbl, sql_keyval_t *pkey);
```
## sql_read
```c
/*****************************************************************************
Name : sql_read
Description : Read the specified entry in the table.
Input : sqlite3 *db : sqlite context.
const char *tbl : table name.
sql_keyval_t *pkey : Primary key and value of this table.
const char *etykey : Specified field of table entry.
Output : char *outs : Read output string
Return : Error code.
*****************************************************************************/
error_t sql_read(sqlite3 *db, const char *tbl, sql_keyval_t *pkey,
const char *etykey, char *outs);
```
## sql_readi
```c
/*****************************************************************************
Name : sql_readi
Description : Read the specified entry line in the table.
Input : sqlite3 *db : sqlite context.
const char *tbl : table name.
homedb_keyval_t *pkey : Primary key and value of this table.
const char *etykey : Specified field of table entry.
Output : char *outs : Read output string
Return : Error code.
*****************************************************************************/
error_t sql_readi(sqlite3 *db, const char *tbl, uint32_t line,
const char *etykey, char *outs);
```
## sql_update
```c
/*****************************************************************************
Name : sql_update
Description : Update the specified entry in the table.
Input : sqlite3 *db : sqlite context.
const char *tbl : table name.
sql_keyval_t *pkey : Primary key and value of this table.
sql_keyval_t *etytbl : Field table that needs to be updated.
uint32_t etylen : Field table length that needs to be updated.
Output : NULL.
Return : Error code.
*****************************************************************************/
error_t sql_update(sqlite3 *db, const char *tbl, sql_keyval_t *pkey,
sql_keyval_t *etytbl, uint32_t etylen);
```
## sql_insert
```c
/*****************************************************************************
Name : sql_insert
Description : Insert entry to the specified table.
Input : sqlite3 *db : sqlite context.
const char *tbl : table name.
sql_keyval_t *etytbl : Field table that needs to be insert.
uint32_t etylen : Field table length that needs to be insert.
Output : NULL.
Return : Error code.
*****************************************************************************/
error_t sql_insert(sqlite3 *db, const char *tbl, sql_keyval_t *etytbl,
uint32_t etylen);
```
## sql_splout
```c
/*****************************************************************************
Name : sql_splout
Description : Split the output of the SQL statement.
Input : char *sql_out : Sql output.
Output : char out_tbl[tbl_hlen][tbl_vlen];
Return : Error code.
*****************************************************************************/
uint32_t sql_splout(void *out_tbl, uint32_t tbl_hlen, uint32_t tbl_vlen,
char *sql_out);
```