return id;
}
-int my_postgresql_lock_table(B_DB *mdb, const char *table)
-{
- my_postgresql_query(mdb, "BEGIN");
- Mmsg(mdb->cmd, "LOCK TABLE %s IN SHARE ROW EXCLUSIVE MODE", table);
- return my_postgresql_query(mdb, mdb->cmd);
-}
-
-int my_postgresql_unlock_table(B_DB *mdb)
-{
- return my_postgresql_query(mdb, "COMMIT");
-}
-
-int my_postgresql_batch_start(B_DB *mdb)
+int my_postgresql_batch_start(JCR *jcr, B_DB *mdb)
{
Dmsg0(500, "my_postgresql_batch_start started\n");
// how many fields in the set?
mdb->num_fields = (int) PQnfields(mdb->result);
mdb->num_rows = 0;
- mdb->status = 0;
+ mdb->status = 1;
} else {
Dmsg0(500, "we failed\n");
- mdb->status = 1;
+ mdb->status = 0;
}
Dmsg0(500, "my_postgresql_batch_start finishing\n");
}
/* set error to something to abort operation */
-int my_postgresql_batch_end(B_DB *mdb, const char *error)
+int my_postgresql_batch_end(JCR *jcr, B_DB *mdb, const char *error)
{
int res;
int count=30;
if (res == 1) {
Dmsg0(500, "ok\n");
- mdb->status = 0;
+ mdb->status = 1;
}
if (res <= 0) {
Dmsg0(500, "we failed\n");
- mdb->status = 1;
+ mdb->status = 0;
Mmsg1(&mdb->errmsg, _("error ending batch mode: %s\n"), PQerrorMessage(mdb->db));
}
return mdb->status;
}
-int my_postgresql_batch_insert(B_DB *mdb, ATTR_DBR *ar)
+int my_postgresql_batch_insert(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
{
int res;
int count=30;
if (res == 1) {
Dmsg0(500, "ok\n");
mdb->changes++;
- mdb->status = 0;
+ mdb->status = 1;
}
if (res <= 0) {
Dmsg0(500, "we failed\n");
- mdb->status = 1;
+ mdb->status = 0;
Mmsg1(&mdb->errmsg, _("error ending batch mode: %s\n"), PQerrorMessage(mdb->db));
}