Quoting Rick Keiner <[EMAIL PROTECTED]>:
What's the status of the API change?
Here is the required MySQL driver change for the new TXN API to work.
--
Bojan
Index: apr_dbd_mysql.c
===================================================================
--- apr_dbd_mysql.c (revision 45)
+++ apr_dbd_mysql.c (working copy)
@@ -64,6 +64,9 @@
};
struct apr_dbd_transaction_t {
+#if APU_MAJOR_VERSION >= 2 || (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 3)
+ int mode;
+#endif
int errnum;
apr_dbd_t *handle;
};
@@ -115,7 +118,11 @@
ret = mysql_errno(sql->conn);
}
+#if APU_MAJOR_VERSION >= 2 || (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 3)
+ if (TXN_NOTICE_ERRORS(sql->trans)) {
+#else
if (sql->trans) {
+#endif
sql->trans->errnum = ret;
}
return ret;
@@ -244,7 +251,11 @@
ret = mysql_errno(sql->conn);
}
*nrows = mysql_affected_rows(sql->conn);
+#if APU_MAJOR_VERSION >= 2 || (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 3)
+ if (TXN_NOTICE_ERRORS(sql->trans)) {
+#else
if (sql->trans) {
+#endif
sql->trans->errnum = ret;
}
return ret;
@@ -343,7 +354,11 @@
}
*nrows = mysql_stmt_affected_rows(statement->stmt);
}
+#if APU_MAJOR_VERSION >= 2 || (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 3)
+ if (TXN_NOTICE_ERRORS(sql->trans)) {
+#else
if (sql->trans) {
+#endif
sql->trans->errnum = ret;
}
return ret;
@@ -386,7 +401,11 @@
}
*nrows = mysql_stmt_affected_rows(statement->stmt);
}
+#if APU_MAJOR_VERSION >= 2 || (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 3)
+ if (TXN_NOTICE_ERRORS(sql->trans)) {
+#else
if (sql->trans) {
+#endif
sql->trans->errnum = ret;
}
return ret;
@@ -467,7 +486,11 @@
if (ret != 0) {
ret = mysql_stmt_errno(statement->stmt);
}
+#if APU_MAJOR_VERSION >= 2 || (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 3)
+ if (TXN_NOTICE_ERRORS(sql->trans)) {
+#else
if (sql->trans) {
+#endif
sql->trans->errnum = ret;
}
return ret;
@@ -549,7 +572,11 @@
if (ret != 0) {
ret = mysql_stmt_errno(statement->stmt);
}
+#if APU_MAJOR_VERSION >= 2 || (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 3)
+ if (TXN_NOTICE_ERRORS(sql->trans)) {
+#else
if (sql->trans) {
+#endif
sql->trans->errnum = ret;
}
return ret;
@@ -558,7 +585,12 @@
{
int ret = -1;
if (trans) {
+#if APU_MAJOR_VERSION >= 2 || (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 3)
+ /* rollback on error or explicit rollback request */
+ if (trans->errnum || TXN_DO_ROLLBACK(trans)) {
+#else
if (trans->errnum) {
+#endif
trans->errnum = 0;
ret = mysql_rollback(trans->handle->conn);
}
@@ -589,6 +621,24 @@
handle->trans = *trans;
return (*trans)->errnum;
}
+#if APU_MAJOR_VERSION >= 2 || (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 3)
+static int dbd_mysql_transaction_mode_get(apr_dbd_transaction_t *trans)
+{
+ if (!trans)
+ return APR_DBD_TRANSACTION_COMMIT;
+
+ return trans->mode;
+}
+
+static int dbd_mysql_transaction_mode_set(apr_dbd_transaction_t *trans,
+ int mode)
+{
+ if (!trans)
+ return APR_DBD_TRANSACTION_COMMIT;
+
+ return trans->mode = (mode & TXN_MODE_BITS);
+}
+#endif
static apr_dbd_t *dbd_mysql_open(apr_pool_t *pool, const char *params)
{
static const char *const delims = " \r\n\t;|,";
@@ -739,7 +789,9 @@
dbd_mysql_pselect
#if APU_MAJOR_VERSION >= 2 || (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 3)
,
- dbd_mysql_get_name
+ dbd_mysql_get_name,
+ dbd_mysql_transaction_mode_get,
+ dbd_mysql_transaction_mode_set
#endif
};