blob: 841b2b79518bf3d797c2a4e0f81ffee33adca328 [file] [log] [blame]
Mike Lockwood16864ba2010-05-11 17:16:59 -04001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef _SQLITE_DATABASE_H
18#define _SQLITE_DATABASE_H
19
20typedef struct sqlite3 sqlite3;
21
22class SqliteDatabase {
23private:
24 sqlite3* mDatabaseHandle;
25
26public:
27 SqliteDatabase();
28 virtual ~SqliteDatabase();
29
30 virtual bool open(const char* path, bool create);
31 virtual void close();
32
33 bool exec(const char* sql);
34 int lastInsertedRow();
35
36 void beginTransaction();
37 void commitTransaction();
38 void rollbackTransaction();
39
40 int getVersion();
41 void setVersion(int version);
42
43 inline sqlite3* getDatabaseHandle() const { return mDatabaseHandle; }
44
45};
46
47#endif // _SQLITE_DATABASE_H