Gnome Data Access | ||
---|---|---|
Prev | Chapter 3. GDA Providers |
As a sample implementation of a GDA provider the gda-odbc will be used.
First the relevant parts of the Makefile.am will be introduced.
(1) bin_PROGRAMS = gda-odbc-srv (2) lib_LTLIBRARIES = libgda_odbc.la (3) IDLFILES = $(top_srcdir)/gda/gda.idl \ $(top_srcdir)/gda/gda-command.idl \ $(top_srcdir)/gda/gda-connection.idl \ $(top_srcdir)/gda/gda-error.idl \ $(top_srcdir)/gda/gda-fieldx.idl \ $(top_srcdir)/gda/gda-parameter.idl \ $(top_srcdir)/gda/gda-recordset.idl (4) INCLUDES = -I. \ -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ -I$(includedir) \ $(ORB_CFLAGS) \ $(GNOME_INCLUDEDIR) (5) gda_odbc_srv_SOURCES = main.c (6) gda_odbc_srv_LDADD = \ libgda_odbc.la \ $(top_builddir)/iodbc/libiodbc.la \ $(GNORBA_LIBS) \ $(INTLLIBS) (7) libgda_odbc_la_SOURCES = \ gda-types.h \ gda-command.h \ .......... (8) gnome-shlib.c (9) gda.h: $(IDLFILES) orbit-idl -I$(top_srcdir)/gda $(top_srcdir)/gda/gda.idl gda-common.c: $(IDLFIaLES) orbit-idl -I$(top_srcdir)/gda $(top_srcdir)/gda/gda.idl |
31Makefile.am Entries
int main(int argc, char* argv[]) { CORBA_ORB orb; CORBA_Environment* ev; CORBA_Object connection_factory_obj; CORBA_Object name_service; gpointer servant; PortableServer_POA root_poa; PortableServer_POAManager pm; CORBA_char* objref; FILE* logstream; struct sigaction sa; int output_fd; sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, 0); logstream = fopen("/tmp/gda-odbc-srv.log", "a"); g_log_set_handler("GDA ODBC", 0xffffffff, g_log_2_file, logstream); ev = g_new0(CORBA_Environment,1); CORBA_exception_init(ev); orb = gnome_CORBA_init("gda-odbc-srv", "0.1", &argc, argv, GNORBA_INIT_SERVER_FUNC, ev); Exception(ev); root_poa = (PortableServer_POA)CORBA_ORB_resolve_initial_references(orb, "RootPOA", ev); Exception(ev); connection_factory_obj = connection_factory__create(root_poa, &servant, ev); Exception(ev); objref = CORBA_ORB_object_to_string(orb, connection_factory_obj, ev); Exception(ev); name_service = gnome_name_service_get(); if (!CORBA_Object_is_nil(name_service, ev)) { goad_server_register(name_service, connection_factory_obj, "gda-odbc", "object", ev); printf("%s\n", objref); fflush(stdout); } output_fd = fileno(logstream); setvbuf(stderr, 0, _IOLBF, 0); setvbuf(stdout, 0, _IOLBF, 0); dup2(output_fd, fileno(stdout)); dup2(output_fd, fileno(stderr)); close(output_fd); pm = PortableServer_POA__get_the_POAManager(root_poa, ev); Exception(ev); PortableServer_POAManager_activate(pm, ev); Exception(ev); CORBA_ORB_run(orb, ev); return 0; } |