APUE course source code
guowenxue
2 hours ago 805b28fc2e633bcd9c823a4b23614378ebfd50a1
project/2.socketd/booster/database.h
@@ -22,13 +22,13 @@
 *              $db_file: sqlite database file name
 * return value: <0: failure   0:ok
 * */
extern int database_init(const char *db_file);
extern int db_open(const char *db_file);
/*  description: close sqlite database handler
 * return value: none
 */
extern void database_term(void);
extern void db_close(void);
/*  description: push a blob packet into database
@@ -37,24 +37,26 @@
 *               $size:  blob packet data bytes
 * return value: <0: failure   0:ok
 */
extern int database_push_packet(void *pack, int size);
extern int db_write(const void *pack, int size);
/*  description: pop the first blob packet from database
 *   input args:
 *               $pack:  blob packet output buffer address
 *               $size:  blob packet output buffer size
 *               $byte:  blob packet bytes
 *               $pack :  blob packet output buffer address
 *               $size :  blob packet output buffer size
 *               $byte :  blob packet bytes
 *               $rowid:  rowid of the record
 * return value: <0: failure   0:ok
 */
extern int database_pop_packet(void *pack, int size, int *bytes);
extern int db_read(void *pack, int size, int *bytes, int *rowid);
/*  description: remove the first blob packet from database
 *   input args: none
 *   input args:
 *               $rowid:  rowid of the record
 * return value: <0: failure   0:ok
 */
extern int database_del_packet(void);
extern int db_remove(int rowid);
#endif   /* ----- #ifndef _DATABASE_H_  ----- */