Bump up to 1.2.10.
This commit is contained in:
parent
829637c631
commit
8018febc44
@ -1 +1 @@
|
|||||||
apr-util-1.2.8.tar.gz
|
apr-util-1.2.10.tar.bz2
|
||||||
|
@ -1,294 +0,0 @@
|
|||||||
--- apr-util-1.2.8/xml/apr_xml.c.autoexpat
|
|
||||||
+++ apr-util-1.2.8/xml/apr_xml.c
|
|
||||||
@@ -25,10 +25,14 @@
|
|
||||||
|
|
||||||
#include "apu_config.h"
|
|
||||||
|
|
||||||
-#ifdef APR_HAVE_OLD_EXPAT
|
|
||||||
-#include "xmlparse.h"
|
|
||||||
+#if defined(HAVE_XMLPARSE_XMLPARSE_H)
|
|
||||||
+#include <xmlparse/xmlparse.h>
|
|
||||||
+#elif defined(HAVE_XMLTOK_XMLPARSE_H)
|
|
||||||
+#include <xmltok/xmlparse.h>
|
|
||||||
+#elif defined(HAVE_XML_XMLPARSE_H)
|
|
||||||
+#include <xml/xmlparse.h>
|
|
||||||
#else
|
|
||||||
-#include "expat.h"
|
|
||||||
+#include <expat.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DEBUG_CR "\r\n"
|
|
||||||
--- apr-util-1.2.8/build/apu-conf.m4.autoexpat
|
|
||||||
+++ apr-util-1.2.8/build/apu-conf.m4
|
|
||||||
@@ -46,92 +46,75 @@
|
|
||||||
AC_SUBST(APR_BUILD_DIR)
|
|
||||||
])
|
|
||||||
|
|
||||||
-
|
|
||||||
-dnl
|
|
||||||
-dnl APU_TEST_EXPAT(directory): test if Expat is located in the specified dir
|
|
||||||
dnl
|
|
||||||
-dnl if present: sets expat_include_dir, expat_libs, possibly expat_old
|
|
||||||
+dnl APU_TRY_EXPAT_LINK(
|
|
||||||
+dnl test-message, cache-var-name, hdrs, libs,
|
|
||||||
+dnl [actions-on-success], [actions-on-failure])
|
|
||||||
+dnl
|
|
||||||
+dnl Tests linking against expat with libraries 'libs' and includes
|
|
||||||
+dnl 'hdrs', passing message + cache-var-name to AC_CACHE_CHECK.
|
|
||||||
+dnl On success, sets $expat_libs to libs, sets $apu_have_expat to 1,
|
|
||||||
+dnl and runs actions-on-success; on failure runs actions-on-failure.
|
|
||||||
+dnl
|
|
||||||
+AC_DEFUN([APU_TRY_EXPAT_LINK], [
|
|
||||||
+AC_CACHE_CHECK([$1], [$2], [
|
|
||||||
+ apu_expat_LIBS=$LIBS
|
|
||||||
+ LIBS="$LIBS $4"
|
|
||||||
+ AC_TRY_LINK([#include <stdlib.h>
|
|
||||||
+#include <$3>], [XML_ParserCreate(NULL);],
|
|
||||||
+ [$2=yes], [$2=no])
|
|
||||||
+ LIBS=$apu_expat_LIBS
|
|
||||||
+])
|
|
||||||
+
|
|
||||||
+if test $[$2] = yes; then
|
|
||||||
+ AC_DEFINE([HAVE_]translit([$3], [a-z./], [A-Z__]), 1,
|
|
||||||
+ [Define if $3 is available])
|
|
||||||
+ apu_expat_libs="$4"
|
|
||||||
+ apu_has_expat=1
|
|
||||||
+ $5
|
|
||||||
+else
|
|
||||||
+ apu_has_expat=0
|
|
||||||
+ $6
|
|
||||||
+fi
|
|
||||||
+])
|
|
||||||
+
|
|
||||||
dnl
|
|
||||||
-AC_DEFUN([APU_TEST_EXPAT], [
|
|
||||||
- AC_MSG_CHECKING(for Expat in ifelse($2,,$1,$2))
|
|
||||||
+dnl APU_SYSTEM_EXPAT: tests for a system expat installation
|
|
||||||
+dnl If present, sets $apu_has_expat to 1 and adjusts LDFLAGS/CPPFLAGS
|
|
||||||
+dnl appropriately. This is mostly for compatibility with existing
|
|
||||||
+dnl expat releases; all but the first APU_TRY_EXPAT_LINK call could
|
|
||||||
+dnl be dropped later.
|
|
||||||
+dnl
|
|
||||||
+AC_DEFUN([APU_SYSTEM_EXPAT], [
|
|
||||||
+
|
|
||||||
+ APU_TRY_EXPAT_LINK([Expat 1.95.x], apu_cv_expat_system,
|
|
||||||
+ [expat.h], [-lexpat])
|
|
||||||
+
|
|
||||||
+ if test $apu_has_expat = 0; then
|
|
||||||
+ APU_TRY_EXPAT_LINK([old Debian-packaged expat], apu_cv_expat_debian,
|
|
||||||
+ [xmltok/xmlparse.h], [-lxmlparse -lxmltok])
|
|
||||||
+ fi
|
|
||||||
|
|
||||||
- expat_libtool=""
|
|
||||||
+ if test $apu_has_expat = 0; then
|
|
||||||
+ APU_TRY_EXPAT_LINK([old FreeBSD-packaged expat], apu_cv_expat_freebsd,
|
|
||||||
+ [xml/xmlparse.h], [-lexpat])
|
|
||||||
+ fi
|
|
||||||
|
|
||||||
- if test -r "$1/lib/expat.h.in"; then
|
|
||||||
- dnl Expat 1.95.* distribution
|
|
||||||
- expat_include_dir="$1/lib"
|
|
||||||
- expat_ldflags="-L$1/lib"
|
|
||||||
- expat_libs="-lexpat"
|
|
||||||
- expat_libtool="$1/lib/libexpat.la"
|
|
||||||
- elif test -r "$1/include/expat.h" -a \
|
|
||||||
- -r "$1/lib/libexpat.la"; then
|
|
||||||
- dnl Expat 1.95.* installation (with libtool)
|
|
||||||
- expat_include_dir="$1/include"
|
|
||||||
- expat_ldflags="-L$1/lib"
|
|
||||||
- expat_libs="-lexpat"
|
|
||||||
- expat_libtool="$1/lib/libexpat.la"
|
|
||||||
- elif test -r "$1/include/expat.h" -a \
|
|
||||||
- -r "$1/lib64/libexpat.la"; then
|
|
||||||
- dnl Expat 1.95.* installation on certain 64-bit platforms (with libtool)
|
|
||||||
- expat_include_dir="$1/include"
|
|
||||||
- expat_ldflags="-L$1/lib64"
|
|
||||||
- expat_libs="-lexpat"
|
|
||||||
- expat_libtool="$1/lib64/libexpat.la"
|
|
||||||
- elif test -r "$1/include/expat.h" -a \
|
|
||||||
- -r "$1/lib/libexpat.a"; then
|
|
||||||
- dnl Expat 1.95.* installation (without libtool)
|
|
||||||
- dnl FreeBSD textproc/expat2
|
|
||||||
- expat_include_dir="$1/include"
|
|
||||||
- expat_ldflags="-L$1/lib"
|
|
||||||
- expat_libs="-lexpat"
|
|
||||||
- elif test -r "$1/xmlparse.h"; then
|
|
||||||
- dnl maybe an expat-lite. use this dir for both includes and libs
|
|
||||||
- expat_include_dir="$1"
|
|
||||||
- expat_ldflags="-L$1"
|
|
||||||
- expat_libs="-lexpat"
|
|
||||||
- expat_libtool="$1/libexpat.la"
|
|
||||||
- expat_old=yes
|
|
||||||
- elif test -r "$1/include/xmlparse.h" -a \
|
|
||||||
- -r "$1/lib/libexpat.a"; then
|
|
||||||
- dnl previously installed expat
|
|
||||||
- expat_include_dir="$1/include"
|
|
||||||
- expat_ldflags="-L$1/lib"
|
|
||||||
- expat_libs="-lexpat"
|
|
||||||
- expat_old=yes
|
|
||||||
- elif test -r "$1/include/xml/xmlparse.h" -a \
|
|
||||||
- -r "$1/lib/xml/libexpat.a"; then
|
|
||||||
- dnl previously installed expat
|
|
||||||
- expat_include_dir="$1/include/xml"
|
|
||||||
- expat_ldflags="-L$1/lib"
|
|
||||||
- expat_libs="-lexpat"
|
|
||||||
- expat_old=yes
|
|
||||||
- elif test -r "$1/include/xmltok/xmlparse.h"; then
|
|
||||||
- dnl Debian distribution
|
|
||||||
- expat_include_dir="$1/include/xmltok"
|
|
||||||
- expat_ldflags="-L$1/lib"
|
|
||||||
- expat_libs="-lxmlparse -lxmltok"
|
|
||||||
- expat_old=yes
|
|
||||||
- elif test -r "$1/include/xml/xmlparse.h" -a \
|
|
||||||
- -r "$1/lib/libexpat.a"; then
|
|
||||||
- dnl FreeBSD textproc/expat package
|
|
||||||
- expat_include_dir="$1/include/xml"
|
|
||||||
- expat_ldflags="-L$1/lib"
|
|
||||||
- expat_libs="-lexpat"
|
|
||||||
- expat_old=yes
|
|
||||||
- elif test -r "$1/xmlparse/xmlparse.h"; then
|
|
||||||
- dnl Expat 1.0 or 1.1 source directory
|
|
||||||
- expat_include_dir="$1/xmlparse"
|
|
||||||
- expat_ldflags="-L$1"
|
|
||||||
- expat_libs="-lexpat"
|
|
||||||
- expat_old=yes
|
|
||||||
+ if test $apu_has_expat = 0; then
|
|
||||||
+ APU_TRY_EXPAT_LINK([Expat 1.0/1.1], apu_cv_expat_1011,
|
|
||||||
+ [xmlparse/xmlparse.h], [-lexpat])
|
|
||||||
fi
|
|
||||||
- dnl ### test for installed Expat 1.95.* distros
|
|
||||||
|
|
||||||
- if test -n "$expat_include_dir"; then
|
|
||||||
- dnl ### more info about what we found there? version? using .la?
|
|
||||||
- AC_MSG_RESULT(yes)
|
|
||||||
- else
|
|
||||||
- AC_MSG_RESULT(no)
|
|
||||||
+ if test $apu_has_expat = 0; then
|
|
||||||
+ APR_ADDTO(LDFLAGS, [-L/usr/local/lib])
|
|
||||||
+ APR_ADDTO(CPPFLAGS, [-I/usr/local/include])
|
|
||||||
+
|
|
||||||
+ APU_TRY_EXPAT_LINK([Expat 1.95.x in /usr/local],
|
|
||||||
+ apu_cv_expat_usrlocal, [expat.h], [-lexpat],
|
|
||||||
+ [APR_ADDTO(APRUTIL_INCLUDES, [-I/usr/local/include])],[
|
|
||||||
+ APR_REMOVEFROM(LDFLAGS, [-L/usr/local/lib])
|
|
||||||
+ APR_REMOVEFROM(CPPFLAGS, [-I/usr/local/include])
|
|
||||||
+ ])
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
|
|
||||||
@@ -141,90 +124,51 @@
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([APU_FIND_EXPAT], [
|
|
||||||
|
|
||||||
+apu_has_expat=0
|
|
||||||
+
|
|
||||||
+# Default: will use either external or bundled expat.
|
|
||||||
+apu_try_external_expat=1
|
|
||||||
+apu_try_builtin_expat=1
|
|
||||||
+
|
|
||||||
AC_ARG_WITH([expat],
|
|
||||||
-[ --with-expat=DIR specify Expat location or 'builtin'], [
|
|
||||||
+[ --with-expat=DIR specify Expat location, or 'builtin'], [
|
|
||||||
if test "$withval" = "yes"; then
|
|
||||||
AC_MSG_ERROR([a directory must be specified for --with-expat])
|
|
||||||
elif test "$withval" = "no"; then
|
|
||||||
AC_MSG_ERROR([Expat cannot be disabled (at this time)])
|
|
||||||
elif test "$withval" = "builtin"; then
|
|
||||||
- abs_expatdir="`cd $srcdir/xml/expat && pwd`"
|
|
||||||
- if test -d $abs_expatdir/. -a ! -d xml/expat/.; then
|
|
||||||
- $mkdir_p xml/expat
|
|
||||||
- fi
|
|
||||||
- APU_TEST_EXPAT($abs_expatdir, xml/expat)
|
|
||||||
+ apu_try_external_expat=0
|
|
||||||
else
|
|
||||||
- abs_expatdir="`cd $withval && pwd`"
|
|
||||||
- APU_TEST_EXPAT($abs_expatdir, $withval)
|
|
||||||
- if test -z "$expat_include_dir"; then
|
|
||||||
- AC_MSG_ERROR([Expat was not found (or recognized) in \"$withval\"])
|
|
||||||
+ # Add given path to standard search paths if appropriate:
|
|
||||||
+ if test "$withval" != "/usr"; then
|
|
||||||
+ APR_ADDTO(LDFLAGS, [-L$withval/lib])
|
|
||||||
+ APR_ADDTO(CPPFLAGS, [-I$withval/include])
|
|
||||||
+ APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include])
|
|
||||||
fi
|
|
||||||
+ # ...and refuse to fall back on the builtin expat.
|
|
||||||
+ apu_try_builtin_expat=0
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
|
|
||||||
-if test -z "$expat_include_dir"; then
|
|
||||||
- for d in /usr /usr/local xml/expat-cvs xml/expat $srcdir/xml/expat ; do
|
|
||||||
- APU_TEST_EXPAT($d)
|
|
||||||
- if test -n "$expat_include_dir"; then
|
|
||||||
- dnl For /usr installs of expat, we can't specify -L/usr/lib
|
|
||||||
- if test "$d" = "/usr"; then
|
|
||||||
- expat_ldflags=""
|
|
||||||
- fi
|
|
||||||
- break
|
|
||||||
- fi
|
|
||||||
- done
|
|
||||||
-fi
|
|
||||||
-if test -z "$expat_include_dir"; then
|
|
||||||
- AC_MSG_ERROR([could not locate Expat. use --with-expat])
|
|
||||||
-fi
|
|
||||||
-
|
|
||||||
-dnl If this expat doesn't use libtool natively, we'll mimic it for our
|
|
||||||
-dnl dependency library generation.
|
|
||||||
-if test -z "$expat_libtool"; then
|
|
||||||
- expat_libtool="$expat_ldflags $expat_libs"
|
|
||||||
+if test $apu_try_external_expat = 1; then
|
|
||||||
+ APU_SYSTEM_EXPAT
|
|
||||||
fi
|
|
||||||
|
|
||||||
-if test -n "$expat_old"; then
|
|
||||||
- AC_DEFINE(APR_HAVE_OLD_EXPAT, 1, [define if Expat 1.0 or 1.1 was found])
|
|
||||||
-fi
|
|
||||||
-
|
|
||||||
-dnl special-case the bundled distribution (use absolute dirs)
|
|
||||||
-if test "$expat_include_dir" = "xml/expat/lib" -o "$expat_include_dir" = "xml/expat-cvs/lib"; then
|
|
||||||
- bundled_subdir="`echo $expat_include_dir | sed -e 's%/lib%%'`"
|
|
||||||
- APR_SUBDIR_CONFIG($bundled_subdir, [--prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir --includedir=$includedir --bindir=$bindir])
|
|
||||||
- expat_include_dir=$top_builddir/$bundled_subdir/lib
|
|
||||||
- expat_ldflags="-L$top_builddir/$bundled_subdir/lib"
|
|
||||||
- expat_libs="-lexpat"
|
|
||||||
- expat_libtool=$top_builddir/$bundled_subdir/lib/libexpat.la
|
|
||||||
- APR_XML_SUBDIRS="`echo $bundled_subdir | sed -e 's%xml/%%'`"
|
|
||||||
- APR_ADDTO(APRUTIL_EXPORT_LIBS, [$expat_libtool])
|
|
||||||
-else
|
|
||||||
-if test "$expat_include_dir" = "$abs_srcdir/xml/expat/include" -o "$expat_include_dir" = "$abs_srcdir/xml/expat/lib"; then
|
|
||||||
+if test "${apu_has_expat}${apu_try_builtin_expat}" = "01"; then
|
|
||||||
dnl This is a bit of a hack. This only works because we know that
|
|
||||||
dnl we are working with the bundled version of the software.
|
|
||||||
bundled_subdir="xml/expat"
|
|
||||||
APR_SUBDIR_CONFIG($bundled_subdir, [--prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir --includedir=$includedir --bindir=$bindir])
|
|
||||||
- expat_include_dir=$top_builddir/$bundled_subdir/lib
|
|
||||||
- expat_ldflags="-L$top_builddir/$bundled_subdir/lib"
|
|
||||||
- expat_libs="-lexpat"
|
|
||||||
- expat_libtool=$top_builddir/$bundled_subdir/lib/libexpat.la
|
|
||||||
- APR_XML_SUBDIRS="`echo $bundled_subdir | sed -e 's%xml/%%'`"
|
|
||||||
- APR_ADDTO(APRUTIL_EXPORT_LIBS, [$expat_libtool])
|
|
||||||
-else
|
|
||||||
- APR_ADDTO(APRUTIL_EXPORT_LIBS, [$expat_libs])
|
|
||||||
-fi
|
|
||||||
+ APR_ADDTO(APRUTIL_INCLUDES, [-I$top_builddir/$bundled_subdir/lib])
|
|
||||||
+ APR_ADDTO(LDFLAGS, [-L$top_builddir/$bundled_subdir/lib])
|
|
||||||
+ apu_expat_libs="$top_builddir/$bundled_subdir/lib/libexpat.la"
|
|
||||||
fi
|
|
||||||
+
|
|
||||||
+APR_ADDTO(APRUTIL_EXPORT_LIBS, [$apu_expat_libs])
|
|
||||||
+APR_ADDTO(APRUTIL_LIBS, [$apu_expat_libs])
|
|
||||||
+
|
|
||||||
APR_XML_DIR=$bundled_subdir
|
|
||||||
-APR_XML_EXPAT_OLD=$expat_old
|
|
||||||
-AC_SUBST(APR_XML_SUBDIRS)
|
|
||||||
AC_SUBST(APR_XML_DIR)
|
|
||||||
-AC_SUBST(APR_XML_EXPAT_OLD)
|
|
||||||
-
|
|
||||||
-if test "$expat_include_dir" != "/usr/include"; then
|
|
||||||
- APR_ADDTO(APRUTIL_INCLUDES, [-I$expat_include_dir])
|
|
||||||
-fi
|
|
||||||
-APR_ADDTO(APRUTIL_LDFLAGS, [$expat_ldflags])
|
|
||||||
-APR_ADDTO(APRUTIL_LIBS, [$expat_libtool])
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
@ -229,7 +229,7 @@
|
|||||||
#if APU_HAVE_MYSQL
|
#if APU_HAVE_MYSQL
|
||||||
DRIVER_LOAD("mysql", apr_dbd_mysql_driver, pool);
|
DRIVER_LOAD("mysql", apr_dbd_mysql_driver, pool);
|
||||||
#endif
|
#endif
|
||||||
@@ -94,62 +92,68 @@
|
@@ -94,64 +92,70 @@
|
||||||
#if APU_HAVE_SOME_OTHER_BACKEND
|
#if APU_HAVE_SOME_OTHER_BACKEND
|
||||||
DRIVER_LOAD("firebird", apr_dbd_other_driver, pool);
|
DRIVER_LOAD("firebird", apr_dbd_other_driver, pool);
|
||||||
#endif
|
#endif
|
||||||
@ -285,16 +285,18 @@
|
|||||||
+ pool = apr_hash_pool_get(drivers);
|
+ pool = apr_hash_pool_get(drivers);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
sprintf(path, "apr_dbd_%s.dll", name);
|
apr_snprintf(path, sizeof path, "apr_dbd_%s.dll", name);
|
||||||
|
#elif defined(NETWARE)
|
||||||
|
apr_snprintf(path, sizeof path, "dbd%s.nlm", name);
|
||||||
#else
|
#else
|
||||||
- sprintf(path, "apr_dbd_%s.so", name);
|
- apr_snprintf(path, sizeof path, "apr_dbd_%s.so", name);
|
||||||
+ apr_snprintf(path, sizeof path, APU_DSO_LIBDIR "/apr_dbd_%s.so", name);
|
+ apr_snprintf(path, sizeof path, APU_DSO_LIBDIR "/apr_dbd_%s.so", name);
|
||||||
#endif
|
#endif
|
||||||
rv = apr_dso_load(&dlhandle, path, pool);
|
rv = apr_dso_load(&dlhandle, path, pool);
|
||||||
if (rv != APR_SUCCESS) { /* APR_EDSOOPEN */
|
if (rv != APR_SUCCESS) { /* APR_EDSOOPEN */
|
||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
sprintf(path, "apr_dbd_%s_driver", name);
|
apr_snprintf(path, sizeof path, "apr_dbd_%s_driver", name);
|
||||||
- rv = apr_dso_sym((void*)driver, dlhandle, path);
|
- rv = apr_dso_sym((void*)driver, dlhandle, path);
|
||||||
+ rv = apr_dso_sym(&symbol, dlhandle, path);
|
+ rv = apr_dso_sym(&symbol, dlhandle, path);
|
||||||
if (rv != APR_SUCCESS) { /* APR_ESYMNOTFOUND */
|
if (rv != APR_SUCCESS) { /* APR_ESYMNOTFOUND */
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
--- apr-util-1.2.8/dbd/apr_dbd.c.dbdopen
|
|
||||||
+++ apr-util-1.2.8/dbd/apr_dbd.c
|
|
||||||
@@ -164,7 +164,7 @@
|
|
||||||
apr_dbd_t **handle)
|
|
||||||
{
|
|
||||||
apr_status_t rv;
|
|
||||||
- *handle = driver->open(pool, params);
|
|
||||||
+ *handle = (driver->open)(pool, params);
|
|
||||||
if (*handle == NULL) {
|
|
||||||
return APR_EGENERAL;
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
|
|
||||||
Author: jorton
|
|
||||||
Date: Mon Mar 26 14:19:44 2007
|
|
||||||
New Revision: 522630
|
|
||||||
|
|
||||||
URL: http://svn.apache.org/viewvc?view=rev&rev=522630
|
|
||||||
Log:
|
|
||||||
* xml/apr_xml.c (elem_size, write_elem): Fix attribute namespace
|
|
||||||
handling; where applicable, use the mapped namespace index.
|
|
||||||
|
|
||||||
PR: 41908
|
|
||||||
|
|
||||||
--- apr-util-1.2.8/xml/apr_xml.c.xmlns
|
|
||||||
+++ apr-util-1.2.8/xml/apr_xml.c
|
|
||||||
@@ -666,7 +666,8 @@
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* compute size of: ' ns%d:%s="%s"' */
|
|
||||||
- size += 3 + APR_XML_NS_LEN(attr->ns) + 1 + strlen(attr->name) + 2 + strlen(attr->value) + 1;
|
|
||||||
+ int ns = ns_map ? ns_map[attr->ns] : attr->ns;
|
|
||||||
+ size += 3 + APR_XML_NS_LEN(ns) + 1 + strlen(attr->name) + 2 + strlen(attr->value) + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -736,8 +737,10 @@
|
|
||||||
for (attr = elem->attr; attr; attr = attr->next) {
|
|
||||||
if (attr->ns == APR_XML_NS_NONE)
|
|
||||||
len = sprintf(s, " %s=\"%s\"", attr->name, attr->value);
|
|
||||||
- else
|
|
||||||
- len = sprintf(s, " ns%d:%s=\"%s\"", attr->ns, attr->name, attr->value);
|
|
||||||
+ else {
|
|
||||||
+ ns = ns_map ? ns_map[attr->ns] : attr->ns;
|
|
||||||
+ len = sprintf(s, " ns%d:%s=\"%s\"", ns, attr->name, attr->value);
|
|
||||||
+ }
|
|
||||||
s += len;
|
|
||||||
}
|
|
||||||
|
|
@ -3,19 +3,16 @@
|
|||||||
|
|
||||||
Summary: Apache Portable Runtime Utility library
|
Summary: Apache Portable Runtime Utility library
|
||||||
Name: apr-util
|
Name: apr-util
|
||||||
Version: 1.2.8
|
Version: 1.2.10
|
||||||
Release: 12
|
Release: 1
|
||||||
License: ASL 2.0
|
License: ASL 2.0
|
||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
URL: http://apr.apache.org/
|
URL: http://apr.apache.org/
|
||||||
Source0: http://www.apache.org/dist/apr/%{name}-%{version}.tar.gz
|
Source0: http://www.apache.org/dist/apr/%{name}-%{version}.tar.bz2
|
||||||
Source1: http://apache.webthing.com/svn/apache/apr/apr_dbd_mysql.c
|
Source1: http://svn.apache.org/repos/asf/apr/apr-util/branches/1.2.x/dbd/apr_dbd_mysql.c
|
||||||
Patch0: apr-util-1.2.2-exports.patch
|
Patch0: apr-util-1.2.2-exports.patch
|
||||||
Patch2: apr-util-1.2.7-pkgconf.patch
|
Patch2: apr-util-1.2.7-pkgconf.patch
|
||||||
Patch3: apr-util-1.2.8-dbddso.patch
|
Patch3: apr-util-1.2.8-dbddso.patch
|
||||||
Patch4: apr-util-1.2.8-xmlns.patch
|
|
||||||
Patch5: apr-util-1.2.8-autoexpat.patch
|
|
||||||
Patch6: apr-util-1.2.8-dbdopen.patch
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
|
||||||
BuildRequires: autoconf, apr-devel >= 1.2.0
|
BuildRequires: autoconf, apr-devel >= 1.2.0
|
||||||
BuildRequires: openldap-devel, db4-devel, expat-devel, e2fsprogs-devel
|
BuildRequires: openldap-devel, db4-devel, expat-devel, e2fsprogs-devel
|
||||||
@ -73,9 +70,6 @@ This package provides the SQLite driver for the apr-util DBD
|
|||||||
%patch0 -p1 -b .exports
|
%patch0 -p1 -b .exports
|
||||||
%patch2 -p1 -b .pkgconf
|
%patch2 -p1 -b .pkgconf
|
||||||
%patch3 -p1 -b .dbddso
|
%patch3 -p1 -b .dbddso
|
||||||
%patch4 -p1 -b .xmlns
|
|
||||||
%patch5 -p1 -b .autoexpat
|
|
||||||
%patch6 -p1 -b .dbdopen
|
|
||||||
|
|
||||||
cp $RPM_SOURCE_DIR/apr_dbd_mysql.c dbd
|
cp $RPM_SOURCE_DIR/apr_dbd_mysql.c dbd
|
||||||
|
|
||||||
@ -155,6 +149,13 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%{_libdir}/pkgconfig/*.pc
|
%{_libdir}/pkgconfig/*.pc
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sun Sep 9 2007 Bojan Smojver <bojan@rexursive.com> 1.2.10-1
|
||||||
|
- bump up to 1.2.10
|
||||||
|
- pick up newly checked in MySQL DBD driver directly from ASF
|
||||||
|
- remove dbdopen patch (fixed upstream)
|
||||||
|
- remove xmlns patch (fixed upstream)
|
||||||
|
- remove autoexpat patch (fixed upstream)
|
||||||
|
|
||||||
* Sun Sep 2 2007 Joe Orton <jorton@redhat.com> 1.2.8-12
|
* Sun Sep 2 2007 Joe Orton <jorton@redhat.com> 1.2.8-12
|
||||||
- rebuild for fixed APR 32-bit ABI
|
- rebuild for fixed APR 32-bit ABI
|
||||||
- remove sqlite driver from main package (#274521)
|
- remove sqlite driver from main package (#274521)
|
||||||
|
884
apr_dbd_mysql.c
884
apr_dbd_mysql.c
@ -1,50 +1,19 @@
|
|||||||
/*
|
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
Copyright (c) 2003-7, WebThing Ltd and other contributors
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
This program is free software; you can redistribute it and/or modify
|
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
it under the terms of the GNU General Public License as published by
|
* (the "License"); you may not use this file except in compliance with
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
* the License. You may obtain a copy of the License at
|
||||||
(at your option) any later version. Alternatively, where this program
|
|
||||||
is aggregated with the Apache APR-UTIL package version 1.2 or later,
|
|
||||||
you can distribute and/or modify it under the terms of the Apache
|
|
||||||
License 2.0 as published by the Apache Software Foundation.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
applicable License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
You may obtain a copy of the Apache License 2.0 at:
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* LICENSE NOTE
|
|
||||||
*
|
*
|
||||||
* The current GPL satisfies MySQL licensing terms without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* invoking any exceptions. ASF policy doesn't permit GPL
|
|
||||||
* software to be distributed by apache.org, but this should
|
|
||||||
* not be a problem for third-parties who wish to distribute
|
|
||||||
* it alongside the APR and other Apache software.
|
|
||||||
*
|
|
||||||
* It is updated to dual license after discussion with Debian
|
|
||||||
* and taking into account MySQL's FOSS exception.
|
|
||||||
* http://bahumbug.wordpress.com/2007/01/09/re-licensing-apr_dbd_mysql/
|
|
||||||
* http://www.mysql.com/company/legal/licensing/foss-exception.html
|
|
||||||
*
|
|
||||||
* MAINTAINERS
|
|
||||||
*
|
|
||||||
* This code was originally written by Nick Kew for MySQL 4.1.
|
|
||||||
* and subsequently updated by others to support MySQL 5.0.
|
|
||||||
* The current lead maintainer is Bojan Smojver, with others
|
|
||||||
* contributing via the developer list at apr.apache.org.
|
|
||||||
*
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "apu.h"
|
#include "apu.h"
|
||||||
#define HAVE_MYSQL_MYSQL_H
|
#define HAVE_MYSQL_MYSQL_H
|
||||||
|
|
||||||
@ -74,17 +43,9 @@ http://www.apache.org/licenses/LICENSE-2.0
|
|||||||
|
|
||||||
struct apr_dbd_prepared_t {
|
struct apr_dbd_prepared_t {
|
||||||
MYSQL_STMT* stmt;
|
MYSQL_STMT* stmt;
|
||||||
#if APU_MAJOR_VERSION >= 2 || (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 3)
|
|
||||||
int nargs;
|
|
||||||
int nvals;
|
|
||||||
apr_dbd_type_e *types;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct apr_dbd_transaction_t {
|
struct apr_dbd_transaction_t {
|
||||||
#if APU_MAJOR_VERSION >= 2 || (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 3)
|
|
||||||
int mode;
|
|
||||||
#endif
|
|
||||||
int errnum;
|
int errnum;
|
||||||
apr_dbd_t *handle;
|
apr_dbd_t *handle;
|
||||||
};
|
};
|
||||||
@ -100,156 +61,12 @@ struct apr_dbd_results_t {
|
|||||||
MYSQL_RES *res;
|
MYSQL_RES *res;
|
||||||
MYSQL_STMT *statement;
|
MYSQL_STMT *statement;
|
||||||
MYSQL_BIND *bind;
|
MYSQL_BIND *bind;
|
||||||
#if APU_MAJOR_VERSION >= 2 || (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 3)
|
|
||||||
apr_pool_t *pool;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
struct apr_dbd_row_t {
|
struct apr_dbd_row_t {
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
apr_dbd_results_t *res;
|
apr_dbd_results_t *res;
|
||||||
#if APU_MAJOR_VERSION >= 2 || (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 3)
|
|
||||||
unsigned long *len;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#if APU_MAJOR_VERSION >= 2 || (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 3)
|
|
||||||
/* MySQL specific bucket for BLOB types */
|
|
||||||
typedef struct apr_bucket_lob apr_bucket_lob;
|
|
||||||
/**
|
|
||||||
* A bucket referring to a MySQL BLOB
|
|
||||||
*/
|
|
||||||
struct apr_bucket_lob {
|
|
||||||
/** Number of buckets using this memory */
|
|
||||||
apr_bucket_refcount refcount;
|
|
||||||
/** The row this bucket refers to */
|
|
||||||
const apr_dbd_row_t *row;
|
|
||||||
/** The column this bucket refers to */
|
|
||||||
int col;
|
|
||||||
/** The pool into which any needed structures should
|
|
||||||
* be created while reading from this bucket */
|
|
||||||
apr_pool_t *readpool;
|
|
||||||
};
|
|
||||||
|
|
||||||
static void lob_bucket_destroy(void *data);
|
|
||||||
static apr_status_t lob_bucket_read(apr_bucket *e, const char **str,
|
|
||||||
apr_size_t *len, apr_read_type_e block);
|
|
||||||
static apr_bucket *apr_bucket_lob_make(apr_bucket *b,
|
|
||||||
const apr_dbd_row_t *row, int col,
|
|
||||||
apr_off_t offset, apr_size_t len,
|
|
||||||
apr_pool_t *p);
|
|
||||||
static apr_bucket *apr_bucket_lob_create(const apr_dbd_row_t *row, int col,
|
|
||||||
apr_off_t offset,
|
|
||||||
apr_size_t len, apr_pool_t *p,
|
|
||||||
apr_bucket_alloc_t *list);
|
|
||||||
|
|
||||||
static const apr_bucket_type_t apr_bucket_type_lob = {
|
|
||||||
"LOB", 5, APR_BUCKET_DATA,
|
|
||||||
lob_bucket_destroy,
|
|
||||||
lob_bucket_read,
|
|
||||||
apr_bucket_setaside_notimpl,
|
|
||||||
apr_bucket_shared_split,
|
|
||||||
apr_bucket_shared_copy
|
|
||||||
};
|
|
||||||
|
|
||||||
static void lob_bucket_destroy(void *data)
|
|
||||||
{
|
|
||||||
apr_bucket_lob *f = data;
|
|
||||||
|
|
||||||
if (apr_bucket_shared_destroy(f)) {
|
|
||||||
/* no need to destroy database objects here; it will get
|
|
||||||
* done automatically when the pool gets cleaned up */
|
|
||||||
apr_bucket_free(f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static apr_status_t lob_bucket_read(apr_bucket *e, const char **str,
|
|
||||||
apr_size_t *len, apr_read_type_e block)
|
|
||||||
{
|
|
||||||
apr_bucket_lob *a = e->data;
|
|
||||||
const apr_dbd_row_t *row = a->row;
|
|
||||||
apr_dbd_results_t *res = row->res;
|
|
||||||
int col = a->col;
|
|
||||||
apr_bucket *b = NULL;
|
|
||||||
int rv;
|
|
||||||
apr_size_t blength = e->length; /* bytes remaining in file past offset */
|
|
||||||
apr_off_t boffset = e->start;
|
|
||||||
MYSQL_BIND *bind = &res->bind[col];
|
|
||||||
|
|
||||||
*str = NULL; /* in case we die prematurely */
|
|
||||||
|
|
||||||
/* fetch from offset if not at the beginning */
|
|
||||||
if (boffset > 0) {
|
|
||||||
rv = mysql_stmt_fetch_column(res->statement, bind, col, boffset);
|
|
||||||
if (rv != 0) {
|
|
||||||
return APR_EGENERAL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
blength -= blength > bind->buffer_length ? bind->buffer_length : blength;
|
|
||||||
*len = e->length - blength;
|
|
||||||
*str = bind->buffer;
|
|
||||||
|
|
||||||
/* allocate new buffer, since we used this one for the bucket */
|
|
||||||
bind->buffer = apr_palloc(res->pool, bind->buffer_length);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Change the current bucket to refer to what we read,
|
|
||||||
* even if we read nothing because we hit EOF.
|
|
||||||
*/
|
|
||||||
apr_bucket_pool_make(e, *str, *len, res->pool);
|
|
||||||
|
|
||||||
/* If we have more to read from the field, then create another bucket */
|
|
||||||
if (blength > 0) {
|
|
||||||
/* for efficiency, we can just build a new apr_bucket struct
|
|
||||||
* to wrap around the existing LOB bucket */
|
|
||||||
b = apr_bucket_alloc(sizeof(*b), e->list);
|
|
||||||
b->start = boffset + *len;
|
|
||||||
b->length = blength;
|
|
||||||
b->data = a;
|
|
||||||
b->type = &apr_bucket_type_lob;
|
|
||||||
b->free = apr_bucket_free;
|
|
||||||
b->list = e->list;
|
|
||||||
APR_BUCKET_INSERT_AFTER(e, b);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
lob_bucket_destroy(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
return APR_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static apr_bucket *apr_bucket_lob_make(apr_bucket *b,
|
|
||||||
const apr_dbd_row_t *row, int col,
|
|
||||||
apr_off_t offset, apr_size_t len,
|
|
||||||
apr_pool_t *p)
|
|
||||||
{
|
|
||||||
apr_bucket_lob *f;
|
|
||||||
|
|
||||||
f = apr_bucket_alloc(sizeof(*f), b->list);
|
|
||||||
f->row = row;
|
|
||||||
f->col = col;
|
|
||||||
f->readpool = p;
|
|
||||||
|
|
||||||
b = apr_bucket_shared_make(b, f, offset, len);
|
|
||||||
b->type = &apr_bucket_type_lob;
|
|
||||||
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
|
|
||||||
static apr_bucket *apr_bucket_lob_create(const apr_dbd_row_t *row, int col,
|
|
||||||
apr_off_t offset,
|
|
||||||
apr_size_t len, apr_pool_t *p,
|
|
||||||
apr_bucket_alloc_t *list)
|
|
||||||
{
|
|
||||||
apr_bucket *b = apr_bucket_alloc(sizeof(*b), list);
|
|
||||||
|
|
||||||
APR_BUCKET_INIT(b);
|
|
||||||
b->free = apr_bucket_free;
|
|
||||||
b->list = list;
|
|
||||||
return apr_bucket_lob_make(b, row, col, offset, len, p);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static apr_status_t free_result(void *data)
|
static apr_status_t free_result(void *data)
|
||||||
{
|
{
|
||||||
mysql_free_result(data);
|
mysql_free_result(data);
|
||||||
@ -273,9 +90,6 @@ static int dbd_mysql_select(apr_pool_t *pool, apr_dbd_t *sql,
|
|||||||
}
|
}
|
||||||
(*results)->random = seek;
|
(*results)->random = seek;
|
||||||
(*results)->statement = NULL;
|
(*results)->statement = NULL;
|
||||||
#if APU_MAJOR_VERSION >= 2 || (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 3)
|
|
||||||
(*results)->pool = pool;
|
|
||||||
#endif
|
|
||||||
if (seek) {
|
if (seek) {
|
||||||
(*results)->res = mysql_store_result(sql->conn);
|
(*results)->res = mysql_store_result(sql->conn);
|
||||||
}
|
}
|
||||||
@ -289,27 +103,12 @@ static int dbd_mysql_select(apr_pool_t *pool, apr_dbd_t *sql,
|
|||||||
ret = mysql_errno(sql->conn);
|
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) {
|
if (sql->trans) {
|
||||||
#endif
|
|
||||||
sql->trans->errnum = ret;
|
sql->trans->errnum = ret;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if APU_MAJOR_VERSION >= 2 || (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 3)
|
|
||||||
static const char *dbd_mysql_get_name(const apr_dbd_results_t *res, int n)
|
|
||||||
{
|
|
||||||
if ((n < 0) || (n >= mysql_num_fields(res->res))) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return mysql_fetch_fields(res->res)[n].name;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int dbd_mysql_get_row(apr_pool_t *pool, apr_dbd_results_t *res,
|
static int dbd_mysql_get_row(apr_pool_t *pool, apr_dbd_results_t *res,
|
||||||
apr_dbd_row_t **row, int rownum)
|
apr_dbd_row_t **row, int rownum)
|
||||||
{
|
{
|
||||||
@ -352,9 +151,6 @@ static int dbd_mysql_get_row(apr_pool_t *pool, apr_dbd_results_t *res,
|
|||||||
}
|
}
|
||||||
(*row)->row = r;
|
(*row)->row = r;
|
||||||
(*row)->res = res;
|
(*row)->res = res;
|
||||||
#if APU_MAJOR_VERSION >= 2 || (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 3)
|
|
||||||
(*row)->len = mysql_fetch_lengths(res->res);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
apr_pool_cleanup_run(pool, res->res, free_result);
|
apr_pool_cleanup_run(pool, res->res, free_result);
|
||||||
@ -412,160 +208,6 @@ static const char *dbd_mysql_get_entry(const apr_dbd_row_t *row, int n)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if APU_MAJOR_VERSION >= 2 || (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 3)
|
|
||||||
static apr_status_t dbd_mysql_datum_get(const apr_dbd_row_t *row, int n,
|
|
||||||
apr_dbd_type_e type, void *data)
|
|
||||||
{
|
|
||||||
if (row->res->statement) {
|
|
||||||
MYSQL_BIND *bind = &row->res->bind[n];
|
|
||||||
unsigned long len = *bind->length;
|
|
||||||
|
|
||||||
if (mysql_stmt_fetch_column(row->res->statement, bind, n, 0) != 0) {
|
|
||||||
return APR_EGENERAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*bind->is_null) {
|
|
||||||
return APR_ENOENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (type) {
|
|
||||||
case APR_DBD_TYPE_TINY:
|
|
||||||
*(char*)data = atoi(bind->buffer);
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_UTINY:
|
|
||||||
*(unsigned char*)data = atoi(bind->buffer);
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_SHORT:
|
|
||||||
*(short*)data = atoi(bind->buffer);
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_USHORT:
|
|
||||||
*(unsigned short*)data = atoi(bind->buffer);
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_INT:
|
|
||||||
*(int*)data = atoi(bind->buffer);
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_UINT:
|
|
||||||
*(unsigned int*)data = atoi(bind->buffer);
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_LONG:
|
|
||||||
*(long*)data = atol(bind->buffer);
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_ULONG:
|
|
||||||
*(unsigned long*)data = atol(bind->buffer);
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_LONGLONG:
|
|
||||||
*(apr_int64_t*)data = apr_atoi64(bind->buffer);
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_ULONGLONG:
|
|
||||||
*(apr_uint64_t*)data = apr_atoi64(bind->buffer);
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_FLOAT:
|
|
||||||
*(float*)data = atof(bind->buffer);
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_DOUBLE:
|
|
||||||
*(double*)data = atof(bind->buffer);
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_STRING:
|
|
||||||
case APR_DBD_TYPE_TEXT:
|
|
||||||
case APR_DBD_TYPE_TIME:
|
|
||||||
case APR_DBD_TYPE_DATE:
|
|
||||||
case APR_DBD_TYPE_DATETIME:
|
|
||||||
case APR_DBD_TYPE_TIMESTAMP:
|
|
||||||
case APR_DBD_TYPE_ZTIMESTAMP:
|
|
||||||
*((char*)bind->buffer+bind->buffer_length-1) = '\0';
|
|
||||||
*(char**)data = bind->buffer;
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_BLOB:
|
|
||||||
case APR_DBD_TYPE_CLOB:
|
|
||||||
{
|
|
||||||
apr_bucket *e;
|
|
||||||
apr_bucket_brigade *b = (apr_bucket_brigade*)data;
|
|
||||||
|
|
||||||
e = apr_bucket_lob_create(row, n, 0, len,
|
|
||||||
row->res->pool, b->bucket_alloc);
|
|
||||||
APR_BRIGADE_INSERT_TAIL(b, e);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_NULL:
|
|
||||||
*(void**)data = NULL;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return APR_EGENERAL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (row->row[n] == NULL) {
|
|
||||||
return APR_ENOENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (type) {
|
|
||||||
case APR_DBD_TYPE_TINY:
|
|
||||||
*(char*)data = atoi(row->row[n]);
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_UTINY:
|
|
||||||
*(unsigned char*)data = atoi(row->row[n]);
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_SHORT:
|
|
||||||
*(short*)data = atoi(row->row[n]);
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_USHORT:
|
|
||||||
*(unsigned short*)data = atoi(row->row[n]);
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_INT:
|
|
||||||
*(int*)data = atoi(row->row[n]);
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_UINT:
|
|
||||||
*(unsigned int*)data = atoi(row->row[n]);
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_LONG:
|
|
||||||
*(long*)data = atol(row->row[n]);
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_ULONG:
|
|
||||||
*(unsigned long*)data = atol(row->row[n]);
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_LONGLONG:
|
|
||||||
*(apr_int64_t*)data = apr_atoi64(row->row[n]);
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_ULONGLONG:
|
|
||||||
*(apr_uint64_t*)data = apr_atoi64(row->row[n]);
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_FLOAT:
|
|
||||||
*(float*)data = atof(row->row[n]);
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_DOUBLE:
|
|
||||||
*(double*)data = atof(row->row[n]);
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_STRING:
|
|
||||||
case APR_DBD_TYPE_TEXT:
|
|
||||||
case APR_DBD_TYPE_TIME:
|
|
||||||
case APR_DBD_TYPE_DATE:
|
|
||||||
case APR_DBD_TYPE_DATETIME:
|
|
||||||
case APR_DBD_TYPE_TIMESTAMP:
|
|
||||||
case APR_DBD_TYPE_ZTIMESTAMP:
|
|
||||||
*(char**)data = row->row[n];
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_BLOB:
|
|
||||||
case APR_DBD_TYPE_CLOB:
|
|
||||||
{
|
|
||||||
apr_bucket *e;
|
|
||||||
apr_bucket_brigade *b = (apr_bucket_brigade*)data;
|
|
||||||
|
|
||||||
e = apr_bucket_pool_create(row->row[n], row->len[n],
|
|
||||||
row->res->pool, b->bucket_alloc);
|
|
||||||
APR_BRIGADE_INSERT_TAIL(b, e);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_NULL:
|
|
||||||
*(void**)data = NULL;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return APR_EGENERAL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static const char *dbd_mysql_error(apr_dbd_t *sql, int n)
|
static const char *dbd_mysql_error(apr_dbd_t *sql, int n)
|
||||||
{
|
{
|
||||||
return mysql_error(sql->conn);
|
return mysql_error(sql->conn);
|
||||||
@ -582,11 +224,7 @@ static int dbd_mysql_query(apr_dbd_t *sql, int *nrows, const char *query)
|
|||||||
ret = mysql_errno(sql->conn);
|
ret = mysql_errno(sql->conn);
|
||||||
}
|
}
|
||||||
*nrows = mysql_affected_rows(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) {
|
if (sql->trans) {
|
||||||
#endif
|
|
||||||
sql->trans->errnum = ret;
|
sql->trans->errnum = ret;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -607,467 +245,6 @@ static apr_status_t stmt_close(void *data)
|
|||||||
return APR_SUCCESS;
|
return APR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if APU_MAJOR_VERSION >= 2 || (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 3)
|
|
||||||
static int dbd_mysql_prepare(apr_pool_t *pool, apr_dbd_t *sql,
|
|
||||||
const char *query, const char *label,
|
|
||||||
int nargs, int nvals, apr_dbd_type_e *types,
|
|
||||||
apr_dbd_prepared_t **statement)
|
|
||||||
{
|
|
||||||
/* Translate from apr_dbd to native query format */
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (!*statement) {
|
|
||||||
*statement = apr_palloc(pool, sizeof(apr_dbd_prepared_t));
|
|
||||||
}
|
|
||||||
(*statement)->stmt = mysql_stmt_init(sql->conn);
|
|
||||||
|
|
||||||
if ((*statement)->stmt) {
|
|
||||||
apr_pool_cleanup_register(pool, (*statement)->stmt,
|
|
||||||
stmt_close, apr_pool_cleanup_null);
|
|
||||||
ret = mysql_stmt_prepare((*statement)->stmt, query, strlen(query));
|
|
||||||
|
|
||||||
if (ret != 0) {
|
|
||||||
ret = mysql_stmt_errno((*statement)->stmt);
|
|
||||||
}
|
|
||||||
|
|
||||||
(*statement)->nargs = nargs;
|
|
||||||
(*statement)->nvals = nvals;
|
|
||||||
(*statement)->types = types;
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CR_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void dbd_mysql_bind(apr_dbd_prepared_t *statement,
|
|
||||||
const char **values, MYSQL_BIND *bind)
|
|
||||||
{
|
|
||||||
int i, j;
|
|
||||||
|
|
||||||
for (i = 0, j = 0; i < statement->nargs; i++, j++) {
|
|
||||||
bind[i].length = &bind[i].buffer_length;
|
|
||||||
bind[i].is_unsigned = 0;
|
|
||||||
bind[i].is_null = NULL;
|
|
||||||
|
|
||||||
if (values[j] == NULL) {
|
|
||||||
bind[i].buffer_type = MYSQL_TYPE_NULL;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
switch (statement->types[i]) {
|
|
||||||
case APR_DBD_TYPE_BLOB:
|
|
||||||
case APR_DBD_TYPE_CLOB:
|
|
||||||
bind[i].buffer_type = MYSQL_TYPE_LONG_BLOB;
|
|
||||||
bind[i].buffer = (void*)values[j];
|
|
||||||
bind[i].buffer_length = atol(values[++j]);
|
|
||||||
|
|
||||||
/* skip table and column */
|
|
||||||
j += 2;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
bind[i].buffer_type = MYSQL_TYPE_VAR_STRING;
|
|
||||||
bind[i].buffer = (void*)values[j];
|
|
||||||
bind[i].buffer_length = strlen(values[j]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int dbd_mysql_pquery_internal(apr_pool_t *pool, apr_dbd_t *sql,
|
|
||||||
int *nrows, apr_dbd_prepared_t *statement,
|
|
||||||
MYSQL_BIND *bind)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = mysql_stmt_bind_param(statement->stmt, bind);
|
|
||||||
if (ret != 0) {
|
|
||||||
*nrows = 0;
|
|
||||||
ret = mysql_stmt_errno(statement->stmt);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ret = mysql_stmt_execute(statement->stmt);
|
|
||||||
if (ret != 0) {
|
|
||||||
ret = mysql_stmt_errno(statement->stmt);
|
|
||||||
}
|
|
||||||
*nrows = mysql_stmt_affected_rows(statement->stmt);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int dbd_mysql_pquery(apr_pool_t *pool, apr_dbd_t *sql,
|
|
||||||
int *nrows, apr_dbd_prepared_t *statement,
|
|
||||||
const char **values)
|
|
||||||
{
|
|
||||||
MYSQL_BIND *bind;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (sql->trans && sql->trans->errnum) {
|
|
||||||
return sql->trans->errnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
bind = apr_palloc(pool, statement->nargs * sizeof(MYSQL_BIND));
|
|
||||||
|
|
||||||
dbd_mysql_bind(statement, values, bind);
|
|
||||||
|
|
||||||
ret = dbd_mysql_pquery_internal(pool, sql, nrows, statement, bind);
|
|
||||||
|
|
||||||
if (TXN_NOTICE_ERRORS(sql->trans)) {
|
|
||||||
sql->trans->errnum = ret;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int dbd_mysql_pvquery(apr_pool_t *pool, apr_dbd_t *sql, int *nrows,
|
|
||||||
apr_dbd_prepared_t *statement, va_list args)
|
|
||||||
{
|
|
||||||
const char **values;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (sql->trans && sql->trans->errnum) {
|
|
||||||
return sql->trans->errnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
values = apr_palloc(pool, sizeof(*values) * statement->nvals);
|
|
||||||
|
|
||||||
for (i = 0; i < statement->nvals; i++) {
|
|
||||||
values[i] = va_arg(args, const char*);
|
|
||||||
}
|
|
||||||
|
|
||||||
return dbd_mysql_pquery(pool, sql, nrows, statement, values);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int dbd_mysql_pselect_internal(apr_pool_t *pool, apr_dbd_t *sql,
|
|
||||||
apr_dbd_results_t **res,
|
|
||||||
apr_dbd_prepared_t *statement,
|
|
||||||
int random, MYSQL_BIND *bind)
|
|
||||||
{
|
|
||||||
int nfields, i;
|
|
||||||
my_bool *is_nullr;
|
|
||||||
#if MYSQL_VERSION_ID >= 50000
|
|
||||||
my_bool *error;
|
|
||||||
#endif
|
|
||||||
int ret;
|
|
||||||
unsigned long *length, maxlen;
|
|
||||||
|
|
||||||
ret = mysql_stmt_bind_param(statement->stmt, bind);
|
|
||||||
if (ret == 0) {
|
|
||||||
ret = mysql_stmt_execute(statement->stmt);
|
|
||||||
if (!ret) {
|
|
||||||
if (!*res) {
|
|
||||||
*res = apr_pcalloc(pool, sizeof(apr_dbd_results_t));
|
|
||||||
}
|
|
||||||
(*res)->random = random;
|
|
||||||
(*res)->statement = statement->stmt;
|
|
||||||
(*res)->res = mysql_stmt_result_metadata(statement->stmt);
|
|
||||||
(*res)->pool = pool;
|
|
||||||
apr_pool_cleanup_register(pool, (*res)->res,
|
|
||||||
free_result, apr_pool_cleanup_null);
|
|
||||||
nfields = mysql_num_fields((*res)->res);
|
|
||||||
if (!(*res)->bind) {
|
|
||||||
(*res)->bind = apr_palloc(pool, nfields*sizeof(MYSQL_BIND));
|
|
||||||
length = apr_pcalloc(pool, nfields*sizeof(unsigned long));
|
|
||||||
#if MYSQL_VERSION_ID >= 50000
|
|
||||||
error = apr_palloc(pool, nfields*sizeof(my_bool));
|
|
||||||
#endif
|
|
||||||
is_nullr = apr_pcalloc(pool, nfields*sizeof(my_bool));
|
|
||||||
for ( i = 0; i < nfields; ++i ) {
|
|
||||||
maxlen = ((*res)->res->fields[i].length < sql->fldsz ?
|
|
||||||
(*res)->res->fields[i].length : sql->fldsz) + 1;
|
|
||||||
if ((*res)->res->fields[i].type == MYSQL_TYPE_BLOB) {
|
|
||||||
(*res)->bind[i].buffer_type = MYSQL_TYPE_LONG_BLOB;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
(*res)->bind[i].buffer_type = MYSQL_TYPE_VAR_STRING;
|
|
||||||
}
|
|
||||||
(*res)->bind[i].buffer_length = maxlen;
|
|
||||||
(*res)->bind[i].length = &length[i];
|
|
||||||
(*res)->bind[i].buffer = apr_palloc(pool, maxlen);
|
|
||||||
(*res)->bind[i].is_null = is_nullr+i;
|
|
||||||
#if MYSQL_VERSION_ID >= 50000
|
|
||||||
(*res)->bind[i].error = error+i;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ret = mysql_stmt_bind_result(statement->stmt, (*res)->bind);
|
|
||||||
if (!ret) {
|
|
||||||
ret = mysql_stmt_store_result(statement->stmt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ret != 0) {
|
|
||||||
ret = mysql_stmt_errno(statement->stmt);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int dbd_mysql_pselect(apr_pool_t *pool, apr_dbd_t *sql,
|
|
||||||
apr_dbd_results_t **res,
|
|
||||||
apr_dbd_prepared_t *statement, int random,
|
|
||||||
const char **args)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
MYSQL_BIND *bind;
|
|
||||||
|
|
||||||
if (sql->trans && sql->trans->errnum) {
|
|
||||||
return sql->trans->errnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
bind = apr_palloc(pool, statement->nargs * sizeof(MYSQL_BIND));
|
|
||||||
|
|
||||||
dbd_mysql_bind(statement, args, bind);
|
|
||||||
|
|
||||||
ret = dbd_mysql_pselect_internal(pool, sql, res, statement, random, bind);
|
|
||||||
|
|
||||||
if (TXN_NOTICE_ERRORS(sql->trans)) {
|
|
||||||
sql->trans->errnum = ret;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int dbd_mysql_pvselect(apr_pool_t *pool, apr_dbd_t *sql,
|
|
||||||
apr_dbd_results_t **res,
|
|
||||||
apr_dbd_prepared_t *statement, int random,
|
|
||||||
va_list args)
|
|
||||||
{
|
|
||||||
const char **values;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (sql->trans && sql->trans->errnum) {
|
|
||||||
return sql->trans->errnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
values = apr_palloc(pool, sizeof(*values) * statement->nvals);
|
|
||||||
|
|
||||||
for (i = 0; i < statement->nvals; i++) {
|
|
||||||
values[i] = va_arg(args, const char*);
|
|
||||||
}
|
|
||||||
|
|
||||||
return dbd_mysql_pselect(pool, sql, res, statement, random, values);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void dbd_mysql_bbind(apr_pool_t *pool, apr_dbd_prepared_t *statement,
|
|
||||||
const void **values, MYSQL_BIND *bind)
|
|
||||||
{
|
|
||||||
void *arg;
|
|
||||||
int i, j;
|
|
||||||
apr_dbd_type_e type;
|
|
||||||
|
|
||||||
for (i = 0, j = 0; i < statement->nargs; i++, j++) {
|
|
||||||
arg = (void *)values[j];
|
|
||||||
|
|
||||||
bind[i].length = &bind[i].buffer_length;
|
|
||||||
bind[i].is_null = NULL;
|
|
||||||
|
|
||||||
type = (arg == NULL ? APR_DBD_TYPE_NULL : statement->types[i]);
|
|
||||||
switch (type) {
|
|
||||||
case APR_DBD_TYPE_TINY:
|
|
||||||
bind[i].buffer = arg;
|
|
||||||
bind[i].buffer_type = MYSQL_TYPE_TINY;
|
|
||||||
bind[i].is_unsigned = 0;
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_UTINY:
|
|
||||||
bind[i].buffer = arg;
|
|
||||||
bind[i].buffer_type = MYSQL_TYPE_TINY;
|
|
||||||
bind[i].is_unsigned = 1;
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_SHORT:
|
|
||||||
bind[i].buffer = arg;
|
|
||||||
bind[i].buffer_type = MYSQL_TYPE_SHORT;
|
|
||||||
bind[i].is_unsigned = 0;
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_USHORT:
|
|
||||||
bind[i].buffer = arg;
|
|
||||||
bind[i].buffer_type = MYSQL_TYPE_SHORT;
|
|
||||||
bind[i].is_unsigned = 1;
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_INT:
|
|
||||||
bind[i].buffer = arg;
|
|
||||||
bind[i].buffer_type = MYSQL_TYPE_LONG;
|
|
||||||
bind[i].is_unsigned = 0;
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_UINT:
|
|
||||||
bind[i].buffer = arg;
|
|
||||||
bind[i].buffer_type = MYSQL_TYPE_LONG;
|
|
||||||
bind[i].is_unsigned = 1;
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_LONG:
|
|
||||||
if (sizeof(int) == sizeof(long)) {
|
|
||||||
bind[i].buffer = arg;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
bind[i].buffer = apr_palloc(pool, sizeof(int));
|
|
||||||
*(int*)bind[i].buffer = *(long*)arg;
|
|
||||||
}
|
|
||||||
bind[i].buffer_type = MYSQL_TYPE_LONG;
|
|
||||||
bind[i].is_unsigned = 0;
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_ULONG:
|
|
||||||
if (sizeof(unsigned int) == sizeof(unsigned long)) {
|
|
||||||
bind[i].buffer = arg;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
bind[i].buffer = apr_palloc(pool, sizeof(unsigned int));
|
|
||||||
*(unsigned int*)bind[i].buffer = *(unsigned long*)arg;
|
|
||||||
}
|
|
||||||
bind[i].buffer_type = MYSQL_TYPE_LONG;
|
|
||||||
bind[i].is_unsigned = 1;
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_LONGLONG:
|
|
||||||
if (sizeof(long long) == sizeof(apr_int64_t)) {
|
|
||||||
bind[i].buffer = arg;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
bind[i].buffer = apr_palloc(pool, sizeof(long long));
|
|
||||||
*(long long*)bind[i].buffer = *(apr_int64_t*)arg;
|
|
||||||
}
|
|
||||||
bind[i].buffer_type = MYSQL_TYPE_LONGLONG;
|
|
||||||
bind[i].is_unsigned = 0;
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_ULONGLONG:
|
|
||||||
if (sizeof(unsigned long long) == sizeof(apr_uint64_t)) {
|
|
||||||
bind[i].buffer = arg;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
bind[i].buffer = apr_palloc(pool, sizeof(unsigned long long));
|
|
||||||
*(unsigned long long*)bind[i].buffer = *(apr_uint64_t*)arg;
|
|
||||||
}
|
|
||||||
bind[i].buffer_type = MYSQL_TYPE_LONGLONG;
|
|
||||||
bind[i].is_unsigned = 1;
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_FLOAT:
|
|
||||||
bind[i].buffer = arg;
|
|
||||||
bind[i].buffer_type = MYSQL_TYPE_FLOAT;
|
|
||||||
bind[i].is_unsigned = 0;
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_DOUBLE:
|
|
||||||
bind[i].buffer = arg;
|
|
||||||
bind[i].buffer_type = MYSQL_TYPE_DOUBLE;
|
|
||||||
bind[i].is_unsigned = 0;
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_STRING:
|
|
||||||
case APR_DBD_TYPE_TEXT:
|
|
||||||
case APR_DBD_TYPE_TIME:
|
|
||||||
case APR_DBD_TYPE_DATE:
|
|
||||||
case APR_DBD_TYPE_DATETIME:
|
|
||||||
case APR_DBD_TYPE_TIMESTAMP:
|
|
||||||
case APR_DBD_TYPE_ZTIMESTAMP:
|
|
||||||
bind[i].buffer = arg;
|
|
||||||
bind[i].buffer_type = MYSQL_TYPE_VAR_STRING;
|
|
||||||
bind[i].is_unsigned = 0;
|
|
||||||
bind[i].buffer_length = strlen((const char *)arg);
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_BLOB:
|
|
||||||
case APR_DBD_TYPE_CLOB:
|
|
||||||
bind[i].buffer = (void *)arg;
|
|
||||||
bind[i].buffer_type = MYSQL_TYPE_LONG_BLOB;
|
|
||||||
bind[i].is_unsigned = 0;
|
|
||||||
bind[i].buffer_length = *(apr_size_t*)values[++j];
|
|
||||||
|
|
||||||
/* skip table and column */
|
|
||||||
j += 2;
|
|
||||||
break;
|
|
||||||
case APR_DBD_TYPE_NULL:
|
|
||||||
default:
|
|
||||||
bind[i].buffer_type = MYSQL_TYPE_NULL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int dbd_mysql_pbquery(apr_pool_t *pool, apr_dbd_t *sql,
|
|
||||||
int *nrows, apr_dbd_prepared_t *statement,
|
|
||||||
const void **values)
|
|
||||||
{
|
|
||||||
MYSQL_BIND *bind;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (sql->trans && sql->trans->errnum) {
|
|
||||||
return sql->trans->errnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
bind = apr_palloc(pool, statement->nargs * sizeof(MYSQL_BIND));
|
|
||||||
|
|
||||||
dbd_mysql_bbind(pool, statement, values, bind);
|
|
||||||
|
|
||||||
ret = dbd_mysql_pquery_internal(pool, sql, nrows, statement, bind);
|
|
||||||
|
|
||||||
if (TXN_NOTICE_ERRORS(sql->trans)) {
|
|
||||||
sql->trans->errnum = ret;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int dbd_mysql_pvbquery(apr_pool_t *pool, apr_dbd_t *sql, int *nrows,
|
|
||||||
apr_dbd_prepared_t *statement, va_list args)
|
|
||||||
{
|
|
||||||
const void **values;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (sql->trans && sql->trans->errnum) {
|
|
||||||
return sql->trans->errnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
values = apr_palloc(pool, sizeof(*values) * statement->nvals);
|
|
||||||
|
|
||||||
for (i = 0; i < statement->nvals; i++) {
|
|
||||||
values[i] = va_arg(args, const void*);
|
|
||||||
}
|
|
||||||
|
|
||||||
return dbd_mysql_pbquery(pool, sql, nrows, statement, values);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int dbd_mysql_pbselect(apr_pool_t *pool, apr_dbd_t *sql,
|
|
||||||
apr_dbd_results_t **res,
|
|
||||||
apr_dbd_prepared_t *statement, int random,
|
|
||||||
const void **args)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
MYSQL_BIND *bind;
|
|
||||||
|
|
||||||
if (sql->trans && sql->trans->errnum) {
|
|
||||||
return sql->trans->errnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
bind = apr_palloc(pool, statement->nargs * sizeof(MYSQL_BIND));
|
|
||||||
|
|
||||||
dbd_mysql_bbind(pool, statement, args, bind);
|
|
||||||
|
|
||||||
ret = dbd_mysql_pselect_internal(pool, sql, res, statement, random, bind);
|
|
||||||
|
|
||||||
if (TXN_NOTICE_ERRORS(sql->trans)) {
|
|
||||||
sql->trans->errnum = ret;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int dbd_mysql_pvbselect(apr_pool_t *pool, apr_dbd_t *sql,
|
|
||||||
apr_dbd_results_t **res,
|
|
||||||
apr_dbd_prepared_t *statement, int random,
|
|
||||||
va_list args)
|
|
||||||
{
|
|
||||||
const void **values;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (sql->trans && sql->trans->errnum) {
|
|
||||||
return sql->trans->errnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
values = apr_palloc(pool, sizeof(*values) * statement->nvals);
|
|
||||||
|
|
||||||
for (i = 0; i < statement->nvals; i++) {
|
|
||||||
values[i] = va_arg(args, const void*);
|
|
||||||
}
|
|
||||||
|
|
||||||
return dbd_mysql_pbselect(pool, sql, res, statement, random, values);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
static int dbd_mysql_prepare(apr_pool_t *pool, apr_dbd_t *sql,
|
static int dbd_mysql_prepare(apr_pool_t *pool, apr_dbd_t *sql,
|
||||||
const char *query, const char *label,
|
const char *query, const char *label,
|
||||||
apr_dbd_prepared_t **statement)
|
apr_dbd_prepared_t **statement)
|
||||||
@ -1368,18 +545,12 @@ static int dbd_mysql_pvselect(apr_pool_t *pool, apr_dbd_t *sql,
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static int dbd_mysql_end_transaction(apr_dbd_transaction_t *trans)
|
static int dbd_mysql_end_transaction(apr_dbd_transaction_t *trans)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
if (trans) {
|
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) {
|
if (trans->errnum) {
|
||||||
#endif
|
|
||||||
trans->errnum = 0;
|
trans->errnum = 0;
|
||||||
ret = mysql_rollback(trans->handle->conn);
|
ret = mysql_rollback(trans->handle->conn);
|
||||||
}
|
}
|
||||||
@ -1412,25 +583,6 @@ static int dbd_mysql_transaction(apr_pool_t *pool, apr_dbd_t *handle,
|
|||||||
return (*trans)->errnum;
|
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 apr_dbd_t *dbd_mysql_open(apr_pool_t *pool, const char *params)
|
||||||
{
|
{
|
||||||
static const char *const delims = " \r\n\t;|,";
|
static const char *const delims = " \r\n\t;|,";
|
||||||
@ -1608,18 +760,6 @@ APU_DECLARE_DATA const apr_dbd_driver_t apr_dbd_mysql_driver = {
|
|||||||
dbd_mysql_pvselect,
|
dbd_mysql_pvselect,
|
||||||
dbd_mysql_pquery,
|
dbd_mysql_pquery,
|
||||||
dbd_mysql_pselect
|
dbd_mysql_pselect
|
||||||
#if APU_MAJOR_VERSION >= 2 || (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 3)
|
|
||||||
,
|
|
||||||
dbd_mysql_get_name,
|
|
||||||
dbd_mysql_transaction_mode_get,
|
|
||||||
dbd_mysql_transaction_mode_set,
|
|
||||||
"?",
|
|
||||||
dbd_mysql_pvbquery,
|
|
||||||
dbd_mysql_pvbselect,
|
|
||||||
dbd_mysql_pbquery,
|
|
||||||
dbd_mysql_pbselect,
|
|
||||||
dbd_mysql_datum_get
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user