Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Sqlite;
- class DB : GLib.Object {
- private Database db;
- private Statement stmt;
- public PkgDB( string filename ) {
- Database.open_v2( string filename, out this.db, OPEN_READWRITE);
- }
- public void rm_entry(string name, string ver) {
- this.db.prepare_v2(@"delete from pkgs where name = '$name' and version = '$ver'",
- -1, out this.stmt, null);
- this.stmt.step();
- }
- public void ad_entry(string inst, string name, string ver, string desc, string deps) {
- this.db.prepare_v2(@"insert into pkgs VALUES('$inst', '$name', '$ver', '$desc', 'deps')",
- -1, out this.stmt, null);
- this.stmt.step();
- }
- public void ch_entry(string name, string ver, string col, string newval) {
- this.db.prepare_v2(@"update pkgs set $col = '$newval' where name = '$name' and version = '$ver'",
- -1, out this.stmt, null);
- this.stmt.step();
- }
- public void inf_entry(string name, string ver) {
- this.db.prepare_v2(@"select $col from pkgs where name = '$name' and version = '$ver'", -1,
- out this.stmt, null);
- this.stmt.step();
- }
Add Comment
Please, Sign In to add comment