Are Vala and desktopcouch ready?
Posted
by
pavolzetor
on Ask Ubuntu
See other posts from Ask Ubuntu
or by pavolzetor
Published on 2011-01-17T09:30:51Z
Indexed on
2011/01/17
9:59 UTC
Read the original article
Hit count: 220
Hi, I have started writting rss reader in Vala, but I don't know, what database system should I use, I cannot connect to couchdb and sqlite works fine, but I would like use couchdb because of ubuntu one. I have natty with latest updates
public CouchDB.Session session; public CouchDB.Database db; public string feed_table = "feed"; public string item_table = "item"; public struct field { string name; string val; }
// constructor
public Database() {
try {
this.session = new CouchDB.Session();
} catch (Error e) {
stderr.printf ("%s a\n", e.message);
}
try {
this.db = new CouchDB.Database (this.session, "test");
} catch (Error e) {
stderr.printf ("%s a\n", e.message);
}
try {
this.session.get_database_info("test");
} catch (Error e) {
stderr.printf ("%s aa\n", e.message);
}
try {
var newdoc = new CouchDB.Document ();
newdoc.set_boolean_field ("awesome", true);
newdoc.set_string_field ("phone", "555-VALA");
newdoc.set_double_field ("pi", 3.14159);
newdoc.set_int_field ("meaning_of_life", 42);
this.db.put_document (newdoc); // store document
} catch (Error e) {
stderr.printf ("%s aaa\n", e.message);
}
reports
$ ./xml_parser rss.xmlCannot connect to destination (127.0.0.1) aa Cannot connect to destination (127.0.0.1) aaa
© Ask Ubuntu or respective owner