static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-int QueryDB(char *file, int line, void *jcr, B_DB *db, char *select_cmd);
+int QueryDB(char *file, int line, JCR *jcr, B_DB *db, char *select_cmd);
/*
* never have errors, or it is really fatal.
*/
B_DB *
-db_init_database(void *jcr, char *db_name, char *db_user, char *db_password,
+db_init_database(JCR *jcr, char *db_name, char *db_user, char *db_password,
char *db_address, int db_port, char *db_socket)
{
B_DB *mdb;
* which are returned in the errmsg
*/
int
-db_open_database(void *jcr, B_DB *mdb)
+db_open_database(JCR *jcr, B_DB *mdb)
{
char *db_name;
int len;
}
void
-db_close_database(void *jcr, B_DB *mdb)
+db_close_database(JCR *jcr, B_DB *mdb)
{
P(mutex);
mdb->ref_count--;
* Return the next unique index (auto-increment) for
* the given table. Return 0 on error.
*/
-int db_next_index(void *jcr, B_DB *mdb, char *table, char *index)
+int db_next_index(JCR *jcr, B_DB *mdb, char *table, char *index)
{
SQL_ROW row;
* Escape strings so that SQLite is happy
*
* NOTE! len is the length of the old string. Your new
- * string must be long enough (max 2*old) to hold
+ * string must be long enough (max 2*old+1) to hold
* the escaped output.
*/
void
* list on one line horizontally.
*/
void
-list_result(B_DB *mdb, DB_LIST_HANDLER *send, void *ctx, int full_list)
+list_result(B_DB *mdb, DB_LIST_HANDLER *send, void *ctx, e_list_type type)
{
SQL_FIELD *field;
SQL_ROW row;
for (i = 0; i < sql_num_fields(mdb); i++) {
field = sql_fetch_field(mdb);
col_len = strlen(field->name);
- if (full_list) {
+ if (type == VERT_LIST) {
if (col_len > max_len) {
max_len = col_len;
}
}
}
- if (full_list) {
- goto horizontal_list;
+ if (type == VERT_LIST) {
+ goto vertical_list;
}
list_dashes(mdb, send, ctx);
list_dashes(mdb, send, ctx);
return;
-horizontal_list:
+vertical_list:
while ((row = sql_fetch_row(mdb)) != NULL) {
sql_field_seek(mdb, 0);