[gnome-db] [Newbie, libgda] Problem with libgda -
- From: Uzytkownik <uzytkownik2 poczta onet pl>
- To: gtk-app-devel-list gnome org
- Subject: [gnome-db] [Newbie, libgda] Problem with libgda -
- Date: Thu, 30 Jun 2005 21:08:34 +0200
I'd like to check if libgda could create SQLite db.
$ cat sqlite-create.c
#include <libgda/libgda.h>
void do_connection() {
GdaClient *client;
GdaConnection *connection;
GdaCommand *command;
client = gda_client_new();
g_print("CONNECTING\n");
connection = gda_client_open_connection_from_string(client,
"SQLite", "URI=/home/user/simple.db", 0);
g_print("CONNECTED\n");
command = gda_command_new("CREATE TABEL tabela (id INT, data
DATE);", GDA_COMMAND_TYPE_SQL, GDA_COMMAND_DEFAULT_OPTION);
gda_connection_execute_non_query(connection, command,
NULL); //*Here* *is* *segmentation* *fault*
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gda_command_free(command);
gda_client_close_all_connections(client);
g_object_unref(G_OBJECT(client));
gda_main_quit();
}
int main(int argc, char *argv[]) {
g_print("STARTING\n");
gda_init("CreateSQLite", "0.1", argc, argv);
gda_main_run((GdaInitFunc)do_connection, NULL);
g_print("ENDING\n");
}
Many fragments is from examples/manual.
1. What was wrong?
2. Why URI must start by / (I don't know word in en_US)?
When it's sample.db it show:
** (CreateSQLite:14652): CRITICAL **: gda_connection_execute_non_query:
assertion `GDA_IS_CONNECTION (cnc)' failed
Thanks in advance.
Regards.
--
Linux user: #376500 (patrz http://counter.li.org/)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]