blob: c0ebfff2ec4d0a636893812ce3011b10f5ea344c [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_STATEMENT_H
18#define _SQLITE_STATEMENT_H
19
Mike Lockwood7850ef92010-05-14 10:10:36 -040020#include <stdint.h>
21
Mike Lockwood16864ba2010-05-11 17:16:59 -040022typedef struct sqlite3 sqlite3;
23typedef struct sqlite3_stmt sqlite3_stmt;
Mike Lockwood16864ba2010-05-11 17:16:59 -040024
Mike Lockwood7850ef92010-05-14 10:10:36 -040025namespace android {
26
27class SqliteDatabase;
Mike Lockwood16864ba2010-05-11 17:16:59 -040028
29class SqliteStatement {
30private:
31 sqlite3* mDatabaseHandle;
32 sqlite3_stmt* mStatement;
33 bool mDone;
34
35public:
36 SqliteStatement(SqliteDatabase* db);
37 virtual ~SqliteStatement();
38
39 bool prepare(const char* sql);
40 bool step();
41 void reset();
42 void finalize();
43
44 void bind(int column, int value);
45 void bind(int column, const char* value);
46
47 int getColumnInt(int column);
48 int64_t getColumnInt64(int column);
49 const char* getColumnString(int column);
50
51 inline bool isDone() const { return mDone; }
52};
53
Mike Lockwood7850ef92010-05-14 10:10:36 -040054}; // namespace android
55
Mike Lockwood16864ba2010-05-11 17:16:59 -040056#endif // _SQLITE_STATEMENT_H