gnomemm r1565 - in libgdamm/branches/libgdamm-4-0: examples/simple libgda/src
- From: jhs svn gnome org
- To: svn-commits-list gnome org
- Subject: gnomemm r1565 - in libgdamm/branches/libgdamm-4-0: examples/simple libgda/src
- Date: Tue, 17 Jun 2008 09:25:22 +0000 (UTC)
Author: jhs
Date: Tue Jun 17 09:25:22 2008
New Revision: 1565
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1565&view=rev
Log:
2008-06-17 Johannes Schmid <jhs gnome org>
* examples/simple/main.cc:
Completed example
* libgda/src/connection.ccg:
Use Glib::unwrap instead of gobj()
Modified:
libgdamm/branches/libgdamm-4-0/examples/simple/main.cc
libgdamm/branches/libgdamm-4-0/libgda/src/connection.ccg
Modified: libgdamm/branches/libgdamm-4-0/examples/simple/main.cc
==============================================================================
--- libgdamm/branches/libgdamm-4-0/examples/simple/main.cc (original)
+++ libgdamm/branches/libgdamm-4-0/examples/simple/main.cc Tue Jun 17 09:25:22 2008
@@ -24,29 +24,6 @@
using namespace Gnome;
-int main (int argc, char** argv)
-{
- Gda::init();
- Glib::RefPtr<Gda::Connection> cnc;
- try
- {
- cnc = Gda::Connection::open_from_string ("SQLite", "DB_DIR=.;DB_NAME=example_db", "",
- Gda::CONNECTION_OPTIONS_NONE);
- }
- catch (Glib::Error& err)
- {
- std::cerr << err.what() << std::endl;
- return 1;
- }
- /* create an SQL parser */
- Glib::RefPtr<Gda::SqlParser> parser = cnc->create_parser();
- if (!parser) /* @cnc doe snot provide its own parser => use default one */
- parser = Gda::SqlParser::create();
-
-
- return 0;
-}
-
/*
* run a non SELECT command and stops if an error occurs
*/
@@ -77,7 +54,7 @@
}
catch (Glib::Error& err)
{
- std::cerr << err.what() << std::endl;
+ std::cerr << "Error: " << err.what() << std::endl;
return;
}
}
@@ -129,3 +106,28 @@
}
std::cout << data_model->dump_as_string() << std::endl;
}
+
+int main (int argc, char** argv)
+{
+ Gda::init();
+ Glib::RefPtr<Gda::Connection> cnc;
+ try
+ {
+ cnc = Gda::Connection::open_from_string ("SQLite", "DB_DIR=.;DB_NAME=example_db", "",
+ Gda::CONNECTION_OPTIONS_NONE);
+ }
+ catch (Glib::Error& err)
+ {
+ std::cerr << err.what() << std::endl;
+ return 1;
+ }
+ /* create an SQL parser */
+ Glib::RefPtr<Gda::SqlParser> parser = cnc->create_parser();
+ if (!parser) /* @cnc doe snot provide its own parser => use default one */
+ parser = Gda::SqlParser::create();
+
+ create_table(cnc, parser);
+ display_products_contents(cnc, parser);
+
+ return 0;
+}
Modified: libgdamm/branches/libgdamm-4-0/libgda/src/connection.ccg
==============================================================================
--- libgdamm/branches/libgdamm-4-0/libgda/src/connection.ccg (original)
+++ libgdamm/branches/libgdamm-4-0/libgda/src/connection.ccg Tue Jun 17 09:25:22 2008
@@ -89,7 +89,7 @@
GError* gerror = 0;
GdaSet* lir = 0;
Glib::RefPtr<Glib::Object> retval = Glib::wrap(
- gda_connection_statement_execute(gobj(), cmd->gobj(), params->gobj(), (GdaStatementModelUsage)model_usage, &lir, &gerror));
+ gda_connection_statement_execute(gobj(), cmd->gobj(), Glib::unwrap(params), (GdaStatementModelUsage)model_usage, &lir, &gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
@@ -113,7 +113,7 @@
{
GError* gerror = 0;
GdaSet* lir = 0;
- int retval = gda_connection_statement_execute_non_select(gobj(), cmd->gobj(), params->gobj(), &lir, &gerror);
+ int retval = gda_connection_statement_execute_non_select(gobj(), Glib::unwrap(cmd), Glib::unwrap(params), &lir, &gerror);
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]