Archive / / / / / Echo.Database.SQL.Statement.vala
2008-11-27 23:48:48 UTC
previous next
/* vim: set noexpandtab tabstop=4 shiftwidth=4 nowrap textwidth=100 * * Echo Media Player * Copyright (C) 2008 Shane O'Connell * * [ The original file includes a copyright header in this location describing * the file as being released under the terms of the GNU General Public * License. It has been removed in order to display the file as part of the * archive. ] */ public class Echo.Database.SQL.Statement : GLib.Object { private Sqlite.Statement stmt; public Statement(Sqlite.Statement# stmt) { this.stmt = #stmt; } public void bind_int(int index, int value) throws SQLError { int rc = this.stmt.bind_int(index, value); if (rc != Sqlite.OK) throw new SQLError.CANT_BIND(this.stmt.db_handle().errmsg()); } public void bind_int64(int index, int64 value) throws SQLError { int rc = this.stmt.bind_int64(index, value); if (rc != Sqlite.OK) throw new SQLError.CANT_BIND(this.stmt.db_handle().errmsg()); } public void bind_string(int index, string value) throws SQLError { int rc = this.stmt.bind_text(index, value); if (rc != Sqlite.OK) throw new SQLError.CANT_BIND(this.stmt.db_handle().errmsg()); } public bool step() throws SQLError { int rc = this.stmt.step(); if (rc != Sqlite.DONE && rc != Sqlite.ROW) throw new SQLError.CANT_STEP(this.stmt.db_handle().errmsg()); return (rc == Sqlite.ROW); } public int get_int_column(int index) { return this.stmt.column_int(index); } public int64 get_int64_column(int index) { return this.stmt.column_int64(index); } public weak string get_string_column(int index) { return this.stmt.column_text(index); } }