+void my_dbi_free_result(B_DB *mdb);
+DBI_ROW my_dbi_fetch_row (B_DB *mdb);
+int my_dbi_query (B_DB *mdb, const char *query);
+void my_dbi_data_seek (B_DB *mdb, int row);
+void my_dbi_field_seek (B_DB *mdb, int row);
+DBI_FIELD * my_dbi_fetch_field(B_DB *mdb);
+const char * my_dbi_strerror (B_DB *mdb);
+int my_dbi_getisnull (dbi_result *result, int row_number, int column_number);
+char * my_dbi_getvalue (dbi_result *result, int row_number, unsigned int column_number);
+//int my_dbi_getvalue (dbi_result *result, int row_number, unsigned int column_number, char *value);
+int my_dbi_insert_autokey_record(B_DB *mdb, const char *query, const char *table_name);
+
+int my_dbi_batch_start(JCR *jcr, B_DB *mdb);
+int my_dbi_batch_end(JCR *jcr, B_DB *mdb, const char *error);
+typedef struct ATTR_DBR ATTR_DBR;
+int my_dbi_batch_insert(JCR *jcr, B_DB *mdb, ATTR_DBR *ar);
+char *my_postgresql_copy_escape(char *dest, char *src, size_t len);
+// typedefs for libdbi work with postgresql copy insert
+typedef int (*custom_function_insert_t)(void*, const char*, int);
+typedef char* (*custom_function_error_t)(void*);
+typedef int (*custom_function_end_t)(void*, const char*);
+
+extern const char* my_dbi_batch_lock_path_query[5];
+extern const char* my_dbi_batch_lock_filename_query[5];
+extern const char* my_dbi_batch_unlock_tables_query[5];
+extern const char* my_dbi_batch_fill_filename_query[5];
+extern const char* my_dbi_batch_fill_path_query[5];
+extern const char* my_dbi_match[5];
+
+/* "Generic" names for easier conversion */
+#define sql_store_result(x) (x)->result
+#define sql_free_result(x) my_dbi_free_result(x)
+#define sql_fetch_row(x) my_dbi_fetch_row(x)
+#define sql_query(x, y) my_dbi_query((x), (y))
+#define sql_close(x) dbi_conn_close((x)->db)
+#define sql_strerror(x) my_dbi_strerror(x)
+#define sql_num_rows(x) dbi_result_get_numrows((x)->result)
+#define sql_data_seek(x, i) my_dbi_data_seek((x), (i))
+#define SQL_MATCH my_dbi_match[db_type]
+/* #define sql_affected_rows(x) dbi_result_get_numrows_affected((x)->result) */
+#define sql_affected_rows(x) 1
+#define sql_insert_autokey_record(x, y, z) my_dbi_insert_autokey_record((x), (y), (z))
+#define sql_field_seek(x, y) my_dbi_field_seek((x), (y))
+#define sql_fetch_field(x) my_dbi_fetch_field(x)
+#define sql_num_fields(x) ((x)->num_fields)
+#define sql_batch_start(x,y) my_dbi_batch_start(x,y)
+#define sql_batch_end(x,y,z) my_dbi_batch_end(x,y,z)
+#define sql_batch_insert(x,y,z) my_dbi_batch_insert(x,y,z)
+#define sql_batch_lock_path_query my_dbi_batch_lock_path_query[db_type]
+#define sql_batch_lock_filename_query my_dbi_batch_lock_filename_query[db_type]
+#define sql_batch_unlock_tables_query my_dbi_batch_unlock_tables_query[db_type]
+#define sql_batch_fill_filename_query my_dbi_batch_fill_filename_query[db_type]
+#define sql_batch_fill_path_query my_dbi_batch_fill_path_query[db_type]
+
+#define SQL_ROW DBI_ROW
+#define SQL_FIELD DBI_FIELD
+