[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/geas/src/objectstore objectstore.c objects...
From: |
Neil Tiffin |
Subject: |
gnue/geas/src/objectstore objectstore.c objects... |
Date: |
Wed, 06 Jun 2001 09:01:24 -0700 |
CVSROOT: /home/cvs
Module name: gnue
Changes by: Neil Tiffin <address@hidden> 01/06/06 09:01:23
Modified files:
geas/src/objectstore: objectstore.c objectstore.h
Added files:
geas/src/objectstore: mysql.c objectstore_private.h postgresql.c
Removed files:
geas/src/objectstore: mysql_access.h postgresql_access.h
Log message:
This is a restucturing of the objectstore library to allow both mysql
and postgresql to be compiled in GEAS. No major functionality was
changed. mysql_access.h and postgresql.h was removed and the code
moved to mysql.c and postgresql.c. objectstore_private.h was added and
code from objectstore.c was moved there. This update probably breaks
GEAS for the time being.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/objectstore/mysql.c?cvsroot=OldCVS&rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/objectstore/objectstore_private.h?cvsroot=OldCVS&rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/objectstore/postgresql.c?cvsroot=OldCVS&rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/objectstore/objectstore.c.diff?cvsroot=OldCVS&tr1=1.61&tr2=1.62&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/objectstore/objectstore.h.diff?cvsroot=OldCVS&tr1=1.19&tr2=1.20&r1=text&r2=text
Patches:
Index: gnue/geas/src/objectstore/objectstore.c
diff -u gnue/geas/src/objectstore/objectstore.c:1.61
gnue/geas/src/objectstore/objectstore.c:1.62
--- gnue/geas/src/objectstore/objectstore.c:1.61 Sat Jun 2 15:16:47 2001
+++ gnue/geas/src/objectstore/objectstore.c Wed Jun 6 09:01:23 2001
@@ -19,7 +19,7 @@
along with GEAS; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- $Id: objectstore.c,v 1.61 2001/06/02 22:16:47 ntiffin Exp $
+ $Id: objectstore.c,v 1.62 2001/06/06 16:01:23 ntiffin Exp $
*/
#include "config.h"
@@ -30,6 +30,7 @@
#include "geas-server.h"
#include "classdata.h"
#include "datamonitor/datamonitor.h"
+#include "objectstore_private.h"
/* compile time hard limit */
#ifdef MAX_DATABASE_CONNECTIONS
@@ -39,100 +40,11 @@
database */
#endif
-/* forward references */
-struct active_connection;
-struct database_handle;
-typedef GList *DatabaseResultRow_t;
-
#define add_field_to_result_row(row,field) \
row = g_list_append(row,field)
+
-/* database operations supported */
-typedef gboolean (*connect_function) (struct database_handle * h,
- unsigned long int index);
-typedef gboolean (*disconnect_function) (struct database_handle * h,
- unsigned long int index);
-typedef struct query_result *(*execute_query_function) (struct database_handle
- * h,
- QueryData * query,
- int *errorcode,
- char **errormsg);
-
-typedef struct query_result *(*delete_object_function) (struct database_handle
- * h,
- const char *classname,
- const char *key,
- int *errorcode,
- char **errormsg);
-typedef struct query_result *(*delete_all_objects_function) (struct
- database_handle *
- h,
- const char
- *classname,
- const char
- *fieldname,
- const char *key,
- int *errorcode,
- char **errormsg);
-typedef struct query_result *(*write_object_function) (struct database_handle
- * h,
- const gchar *classname,
- const gchar *key,
- GHashTable *values,
- gboolean update,
- int *errorcode,
- char **errormsg);
-
-typedef struct query_result *(*update_tables_function) (struct database_handle
- * h,
- gboolean remove_items,
- int *errorcode,
- char **errormsg);
-
-typedef void (*delete_database_function) (struct database_handle * h);
-typedef struct active_connection *(*get_connection_function) (struct
- database_handle
- * h);
-
-/* base structures */
-struct database_handle
-{
- /* generic data */
- char *name; /* name this entry */
- char *type; /* what DB server is on the other end? */
-
- /* semi-generic database config */
- /* used by most servers */
- char *dbname, *username, *password, *hostname, *unixsocket;
- signed long int port;
- unsigned long int retries; /* times to retry before giving up */
-
- /* list of connections in use */
- unsigned long int num_connections;
- void *connections;
-
- /* functions to execute database operations */
- execute_query_function execute;
- connect_function connect;
- disconnect_function disconnect;
- delete_database_function delete_database;
- get_connection_function get_connection;
- delete_object_function delete_object;
- delete_all_objects_function delete_all_objects;
- write_object_function write_object;
- update_tables_function update_tables;
-};
-
-struct active_connection
-{
- /* general data */
- int index;
- gboolean available; /* TRUE if no other threads are using it */
- gboolean connected; /* TRUE if currently connected to database */
- unsigned long int queue; /* count of threads waiting for this
- connection */
-};
/* maintain a list of databases in use */
static GList *database_list = NULL;
@@ -141,24 +53,7 @@
static struct database_handle *find_database_handle (GList * list,
const char *database,
int *err, char **errmsg);
-static gboolean generic_database_config (configuration config,
- const char *database,
- struct database_handle *h);
-static void free_generic_database (struct database_handle *h);
-static struct query_result *new_query_result ();
-static void remove_message (FILE * fp, DBchange * c);
-static void add_message (FILE * fp, DBchange * c);
-/* create database handles for each supported database */
-#ifdef USE_MYSQL
-#include "mysql_access.h"
-#endif
-#ifdef USE_POSTGRESQL
-#include "postgresql_access.h"
-#endif
-#ifdef USE_LIBGDA
-#include "libgda_access.h"
-#endif
/* ========================================================================= *\
* public functions
@@ -460,7 +355,6 @@
/* somewhat messy nested #ifdefs, to control selection of databases
to use */
-#ifdef USE_MYSQL
if (g_strcasecmp (type, "MySQL") == 0)
{
h =
@@ -468,22 +362,13 @@
dbname);
succeeded = TRUE;
}
-#endif
-
- /* ******************** */
-
-#ifdef USE_POSTGRESQL
if (!succeeded && g_strcasecmp (type, "PostgreSQL") == 0)
{
- h =
- (struct database_handle *)
- PostgreSQL_create_database_handle (config, dbname);
+ h = postgresql_create_database_handle (config, dbname);
succeeded = TRUE;
}
-#endif
- /* ******************** */
#ifdef USE_LIBGDA
@@ -523,7 +408,7 @@
*
\* ------------------------------------------------------------------------- */
gboolean
-close_object_store ()
+close_object_store (void)
{
GList *l;
int i;
@@ -596,7 +481,7 @@
/* ------------------------------------------------------------------------- *\
*
\* ------------------------------------------------------------------------- */
-static gboolean
+gboolean
generic_database_config (configuration config, const char *database,
struct database_handle *h)
{
@@ -662,7 +547,7 @@
/* ------------------------------------------------------------------------- *\
*
\* ------------------------------------------------------------------------- */
-static void
+void
free_generic_database (struct database_handle *h)
{
if (h)
@@ -691,8 +576,8 @@
/* ------------------------------------------------------------------------- *\
*
\* ------------------------------------------------------------------------- */
-static struct query_result *
-new_query_result ()
+struct query_result *
+new_query_result (void)
{
struct query_result *n =
(struct query_result *) g_malloc (sizeof (struct query_result));
@@ -708,7 +593,7 @@
/* ------------------------------------------------------------------------- *\
*
\* ------------------------------------------------------------------------- */
-static void
+void
remove_message (FILE * fp, DBchange * c)
{
GList *l;
@@ -744,7 +629,7 @@
/* ------------------------------------------------------------------------- *\
*
\* ------------------------------------------------------------------------- */
-static void
+void
add_message (FILE * fp, DBchange * c)
{
GList *l;
@@ -825,10 +710,10 @@
*
\* ------------------------------------------------------------------------- */
static void
-display_objectstore_status ()
+display_objectstore_status (void)
{
GList *l;
- int i;
+ /* int i; */
l = database_list;
while (l)
@@ -870,9 +755,9 @@
*
\* ------------------------------------------------------------------------- */
void
-self_test_objectstore ()
+self_test_objectstore (void)
{
- char buf[1024];
+ /* char buf[1024]; */
int err = 0;
char *errmsg = NULL;
struct QueryData *query;
@@ -930,3 +815,4 @@
}
#endif
+/* end of self test */
\ No newline at end of file
Index: gnue/geas/src/objectstore/objectstore.h
diff -u gnue/geas/src/objectstore/objectstore.h:1.19
gnue/geas/src/objectstore/objectstore.h:1.20
--- gnue/geas/src/objectstore/objectstore.h:1.19 Fri May 25 16:46:22 2001
+++ gnue/geas/src/objectstore/objectstore.h Wed Jun 6 09:01:23 2001
@@ -1,5 +1,6 @@
/*
- Interface to the database backend(s)
+ objectstore.h - Public Interface to the objectstore library and
+ therefore the database backend(s)
Copyright (C) 2001 Free Software Foundation
@@ -19,7 +20,7 @@
along with GEAS; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- $Id: objectstore.h,v 1.19 2001/05/25 23:46:22 reinhard Exp $
+ $Id: objectstore.h,v 1.20 2001/06/06 16:01:23 ntiffin Exp $
*/
#ifndef _OBJECTSTORE_H
@@ -78,7 +79,7 @@
};
gboolean initialise_objectstore (configuration config);
-gboolean close_object_store ();
+gboolean close_object_store (void);
void free_query_result (struct query_result *result);
/* NOTE: pass in NULL for errcode and/or errmsg if you don't wish
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue/geas/src/objectstore objectstore.c objects...,
Neil Tiffin <=