Return-Path: Delivered-To: apmail-apr-commits-archive@www.apache.org Received: (qmail 2561 invoked from network); 27 Jan 2006 04:28:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 27 Jan 2006 04:28:51 -0000 Received: (qmail 14452 invoked by uid 500); 27 Jan 2006 04:28:50 -0000 Delivered-To: apmail-apr-commits-archive@apr.apache.org Received: (qmail 14425 invoked by uid 500); 27 Jan 2006 04:28:50 -0000 Mailing-List: contact commits-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: Reply-To: dev@apr.apache.org List-Id: Delivered-To: mailing list commits@apr.apache.org Received: (qmail 14414 invoked by uid 99); 27 Jan 2006 04:28:49 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Jan 2006 20:28:49 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 26 Jan 2006 20:28:49 -0800 Received: (qmail 2215 invoked by uid 65534); 27 Jan 2006 04:28:28 -0000 Message-ID: <20060127042828.2212.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r372724 - in /apr/apr-util/trunk: CHANGES dbd/apr_dbd_sqlite2.c dbd/apr_dbd_sqlite3.c test/testdbd.c Date: Fri, 27 Jan 2006 04:28:27 -0000 To: commits@apr.apache.org From: rooneg@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: rooneg Date: Thu Jan 26 20:28:25 2006 New Revision: 372724 URL: http://svn.apache.org/viewcvs?rev=372724&view=rev Log: Fix the escape implementation in the sqlite dbd back ends. Submitted by: Ronen Mizrahi Tests by: rooneg * dbd/apr_dbd_sqlite2.c (dbd_sqlite_escape): Use the %q format string. * dbd/apr_dbd_sqlite3.c (dbd_sqlite_escape): Ditto. * test/testdbd.c (test_escape): New test. (test_dbd_generic): Call test_escape. * CHANGES: Note fix. Modified: apr/apr-util/trunk/CHANGES apr/apr-util/trunk/dbd/apr_dbd_sqlite2.c apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c apr/apr-util/trunk/test/testdbd.c Modified: apr/apr-util/trunk/CHANGES URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/CHANGES?rev=372724&r1=372723&r2=372724&view=diff ============================================================================== --- apr/apr-util/trunk/CHANGES (original) +++ apr/apr-util/trunk/CHANGES Thu Jan 26 20:28:25 2006 @@ -1,5 +1,9 @@ Changes with APR-util 1.3.0 + *) Fix the escape implementations for the sqlite2 and sqlite3 dbd + back ends. + [Ronen Mizrahi , Garrett Rooney] + *) On platforms that use autoconf stop automatically linking against apr-iconv when an apr-iconv source dir is found in ../apr-iconv. Instead, add a --with-apr-iconv option to configure that lets you Modified: apr/apr-util/trunk/dbd/apr_dbd_sqlite2.c URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/dbd/apr_dbd_sqlite2.c?rev=372724&r1=372723&r2=372724&view=diff ============================================================================== --- apr/apr-util/trunk/dbd/apr_dbd_sqlite2.c (original) +++ apr/apr-util/trunk/dbd/apr_dbd_sqlite2.c Thu Jan 26 20:28:25 2006 @@ -211,7 +211,7 @@ static const char *dbd_sqlite_escape(apr_pool_t * pool, const char *arg, apr_dbd_t * sql) { - char *ret = sqlite_mprintf(arg); + char *ret = sqlite_mprintf("%q", arg); apr_pool_cleanup_register(pool, ret, (void *) sqlite_freemem, apr_pool_cleanup_null); return ret; Modified: apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c?rev=372724&r1=372723&r2=372724&view=diff ============================================================================== --- apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c (original) +++ apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c Thu Jan 26 20:28:25 2006 @@ -260,7 +260,7 @@ static const char *dbd_sqlite3_escape(apr_pool_t *pool, const char *arg, apr_dbd_t *sql) { - char *ret = sqlite3_mprintf(arg); + char *ret = sqlite3_mprintf("%q", arg); apr_pool_cleanup_register(pool, ret, (void *) sqlite3_free, apr_pool_cleanup_null); return ret; Modified: apr/apr-util/trunk/test/testdbd.c URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/test/testdbd.c?rev=372724&r1=372723&r2=372724&view=diff ============================================================================== --- apr/apr-util/trunk/test/testdbd.c (original) +++ apr/apr-util/trunk/test/testdbd.c Thu Jan 26 20:28:25 2006 @@ -136,6 +136,14 @@ ABTS_ASSERT(tc, "If we overseek, get_row should return -1", rv == -1); } +static void test_escape(abts_case *tc, apr_dbd_t *handle, + const apr_dbd_driver_t *driver) +{ + const char *escaped = apr_dbd_escape(driver, p, "foo'bar", handle); + + ABTS_STR_EQUAL(tc, "foo''bar", escaped); +} + static void test_dbd_generic(abts_case *tc, apr_dbd_t* handle, const apr_dbd_driver_t* driver) { @@ -155,6 +163,8 @@ delete_rows(tc, handle, driver); select_rows(tc, handle, driver, 0); drop_table(tc, handle, driver); + + test_escape(tc, handle, driver); rv = apr_dbd_close(driver, handle); ABTS_ASSERT(tc, "failed to close database", rv == APR_SUCCESS);