/******************************************************************************** * Copyright: (C) 2020 LingYun IoT System Studio * All rights reserved. * * Filename: sqlite_cli.h * Description: This head file is for client to save TLV packet in sqlite. * * Version: 1.0.0(2020年05月13日) * Author: Guo Wenxue * ChangeLog: 1, Release initial version on "2020年05月13日 12时14分23秒" * ********************************************************************************/ #ifndef _SQLITE_CLI_H_ #define _SQLITE_CLI_H_ #include "sqlite3.h" #include "tlv_pack.h" #define SQL_COMMAND_LEN 256 /* description: open or create sqlite database if not exist * input args: * $db_file: sqlite database file name * return value: <0: failure 0:ok * */ extern int clidb_init(const char *db_file); /* description: close sqlite database handler * return value: none */ extern void clidb_term(void); /* description: push TLV packet into database * input args: * $pack: tlv packet pointer * return value: <0: failure 0:ok */ extern int clidb_push_tlvpack(tlv_buf_t *pack); /* description: pop one TLV packet from database * input args: * $pack: tlv packet pointer * $id: item ID pointer, which can be used as key when remove * return value: <0: failure 0:ok */ extern int clidb_pop_tlvpack(tlv_buf_t *pack, int *id); /* description: remove sepcified TLV packet from database * input args: * $id: remove item ID * return value: <0: failure 0:ok */ extern int clidb_del_tlvpack(int id); #endif /* ----- #ifndef _SQLITE_CLI_H_ ----- */