~ubuntu-branches/ubuntu/lucid/apache2/lucid-201005171706

« back to all changes in this revision

Viewing changes to srclib/apr-util/test/testdbd.c

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2009-08-04 20:04:24 UTC
  • mfrom: (14.3.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090804200424-8t635jc8zq5kjq06
Tags: 2.2.12-1ubuntu1
* Merge from debian unstable, remaining changes:
  - debian/{control,rules}: enable PIE hardening.
  - debian/{control, rules, apache2.2-common.ufw.profile}: add ufw profiles.
  - Dropped debian/patches/203_fix-ssl-timeftm-ignored.dpatch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
}
32
32
 
33
33
#if APU_HAVE_SQLITE2 || APU_HAVE_SQLITE3
34
 
static void test_statement(abts_case *tc, apr_dbd_t* handle, 
 
34
static void test_statement(abts_case *tc, apr_dbd_t* handle,
35
35
                           const apr_dbd_driver_t* driver, const char* sql)
36
36
{
37
37
    int nrows;
42
42
    ABTS_ASSERT(tc, sql, rv == APR_SUCCESS);
43
43
}
44
44
 
45
 
static void create_table(abts_case *tc, apr_dbd_t* handle, 
 
45
static void create_table(abts_case *tc, apr_dbd_t* handle,
46
46
                         const apr_dbd_driver_t* driver)
47
47
{
48
48
    const char *sql = "CREATE TABLE apr_dbd_test ("
53
53
    test_statement(tc, handle, driver, sql);
54
54
}
55
55
 
56
 
static void drop_table(abts_case *tc, apr_dbd_t* handle, 
 
56
static void drop_table(abts_case *tc, apr_dbd_t* handle,
57
57
                       const apr_dbd_driver_t* driver)
58
58
{
59
59
    const char *sql = "DROP TABLE apr_dbd_test";
60
60
    test_statement(tc, handle, driver, sql);
61
61
}
62
62
 
63
 
static void delete_rows(abts_case *tc, apr_dbd_t* handle, 
 
63
static void delete_rows(abts_case *tc, apr_dbd_t* handle,
64
64
                        const apr_dbd_driver_t* driver)
65
65
{
66
66
    const char *sql = "DELETE FROM apr_dbd_test";
68
68
}
69
69
 
70
70
 
71
 
static void insert_data(abts_case *tc, apr_dbd_t* handle, 
 
71
static void insert_data(abts_case *tc, apr_dbd_t* handle,
72
72
                        const apr_dbd_driver_t* driver, int count)
73
73
{
74
74
    apr_pool_t* pool = p;
86
86
    }
87
87
}
88
88
 
89
 
static void select_rows(abts_case *tc, apr_dbd_t* handle, 
 
89
static void select_rows(abts_case *tc, apr_dbd_t* handle,
90
90
                        const apr_dbd_driver_t* driver, int count)
91
91
{
92
92
    apr_status_t rv;
144
144
  ABTS_STR_EQUAL(tc, "foo''bar", escaped);
145
145
}
146
146
 
147
 
static void test_dbd_generic(abts_case *tc, apr_dbd_t* handle, 
 
147
static void test_dbd_generic(abts_case *tc, apr_dbd_t* handle,
148
148
                             const apr_dbd_driver_t* driver)
149
149
{
150
150
    void* native;
182
182
    rv = apr_dbd_get_driver(pool, "sqlite2", &driver);
183
183
    ABTS_ASSERT(tc, "failed to fetch driver", rv == APR_SUCCESS);
184
184
    ABTS_PTR_NOTNULL(tc, driver);
 
185
    if (!driver) {
 
186
        return;
 
187
    }
185
188
 
186
189
    ABTS_STR_EQUAL(tc, "sqlite2", apr_dbd_name(driver));
187
190
 
188
191
    rv = apr_dbd_open(driver, pool, "data/sqlite2.db:600", &handle);
189
192
    ABTS_ASSERT(tc, "failed to open database", rv == APR_SUCCESS);
190
193
    ABTS_PTR_NOTNULL(tc, handle);
 
194
    if (!handle) {
 
195
        return;
 
196
    }
191
197
 
192
198
    test_dbd_generic(tc, handle, driver);
193
199
}
204
210
    rv = apr_dbd_get_driver(pool, "sqlite3", &driver);
205
211
    ABTS_ASSERT(tc, "failed to fetch driver", rv == APR_SUCCESS);
206
212
    ABTS_PTR_NOTNULL(tc, driver);
 
213
    if (!driver) {
 
214
        return;
 
215
    }
207
216
 
208
217
    ABTS_STR_EQUAL(tc, "sqlite3", apr_dbd_name(driver));
209
218
 
210
219
    rv = apr_dbd_open(driver, pool, "data/sqlite3.db", &handle);
211
220
    ABTS_ASSERT(tc, "failed to open database", rv == APR_SUCCESS);
212
221
    ABTS_PTR_NOTNULL(tc, handle);
 
222
    if (!handle) {
 
223
        return;
 
224
    }
213
225
 
214
226
    test_dbd_generic(tc, handle, driver);
215
227
}