blob: 0fd8a1ecaea4d3ec35de2955a15defc373f3dd6f [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
20typedef struct sqlite3 sqlite3;
21typedef struct sqlite3_stmt sqlite3_stmt;
22class SqliteDatabase;
23
24#include <stdint.h>
25
26class SqliteStatement {
27private:
28 sqlite3* mDatabaseHandle;
29 sqlite3_stmt* mStatement;
30 bool mDone;
31
32public:
33 SqliteStatement(SqliteDatabase* db);
34 virtual ~SqliteStatement();
35
36 bool prepare(const char* sql);
37 bool step();
38 void reset();
39 void finalize();
40
41 void bind(int column, int value);
42 void bind(int column, const char* value);
43
44 int getColumnInt(int column);
45 int64_t getColumnInt64(int column);
46 const char* getColumnString(int column);
47
48 inline bool isDone() const { return mDone; }
49};
50
51#endif // _SQLITE_STATEMENT_H