+/*
+ * Copyright (C) 2009 Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+
+#include "helper.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char **argv)
+{
+ sqlite3 *db;
+ char *dbname;
+ char *title;
+ char *email;
+ int talk_id;
+ int ids[16];
+ int nids;
+ int i;
+ if (argc < 3) {
+ fprintf(stderr, "<program> <db> <id>\n");
+ return 1;
+ }
+ dbname = argv[1];
+ talk_id = atoi(argv[2]);
+ sqlite3_open(dbname, &db);
+ title = get_talk_title(db, talk_id);
+ if (title) {
+ printf("Talk title is %s\n", title);
+ free(title);
+ } else {
+ fprintf(stderr, "Could not find talk\n");
+ }
+ nids = get_talk_talkers(db, talk_id, ids, 16);
+ for (i = 0; i < nids; i++) {
+ email = get_talker_email(db, ids[i]);
+ if (email) {
+ printf("Talker email is %s\n", email);
+ free(email);
+ } else {
+ fprintf(stderr, "Could not find talker\n");
+ }
+ }
+ sqlite3_close(db);
+ return 0;
+}