[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/geas/src/objectstore mysql.c objectstore.c...
From: |
Neil Tiffin |
Subject: |
gnue/geas/src/objectstore mysql.c objectstore.c... |
Date: |
Wed, 06 Jun 2001 16:45:34 -0700 |
CVSROOT: /home/cvs
Module name: gnue
Changes by: Neil Tiffin <address@hidden> 01/06/06 16:45:34
Modified files:
geas/src/objectstore: mysql.c objectstore.c objectstore.h
postgresql.c
Added files:
geas/src/objectstore: template.c
Removed files:
geas/src/objectstore: template.h
Log message:
Clean up MySQL code and add comments.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/objectstore/template.c?cvsroot=OldCVS&rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/objectstore/mysql.c.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/objectstore/objectstore.c.diff?cvsroot=OldCVS&tr1=1.62&tr2=1.63&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/objectstore/objectstore.h.diff?cvsroot=OldCVS&tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/objectstore/postgresql.c.diff?cvsroot=OldCVS&tr1=1.2&tr2=1.3&r1=text&r2=text
Patches:
Index: gnue/geas/src/objectstore/mysql.c
diff -u gnue/geas/src/objectstore/mysql.c:1.1
gnue/geas/src/objectstore/mysql.c:1.2
--- gnue/geas/src/objectstore/mysql.c:1.1 Wed Jun 6 09:01:23 2001
+++ gnue/geas/src/objectstore/mysql.c Wed Jun 6 16:45:33 2001
@@ -1,6 +1,6 @@
/*
- mysql_access.c - Interface to MySql Database
- ALL MySql code should go into this file.
+ mysql.c - Interface to MySql Database.
+ ALL MySql code should go into this file.
Copyright (C) 2001 Free Software Foundation
@@ -20,17 +20,19 @@
along with GEAS; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- $Id: mysql.c,v 1.1 2001/06/06 16:01:23 ntiffin Exp $
+ $Id: mysql.c,v 1.2 2001/06/06 23:45:33 ntiffin Exp $
*/
-/* This is not really a header file. It's rather a piece of code that is
- included conditionally. */
-
+#include "config.h"
+#include <string.h>
+#include <ctype.h>
+#include <stdlib.h>
#include "objectstore.h"
#include "objectstore_private.h"
#include "geas-server.h"
#ifdef USE_MYSQL
+#include <mysql.h>
/* Private Functions */
struct active_connection * MySQL_get_connection (struct database_handle *hnd);
@@ -63,9 +65,9 @@
{
struct MySQL_handle *h = (struct MySQL_handle *) hnd;
struct active_connection *retval = NULL;
- struct active_connection *tmp = NULL;
+ /* struct active_connection *tmp = NULL; */
int i;
- unsigned long int queue = UINT_MAX;
+ /* unsigned long int queue = UINT_MAX; */
trace_functioncall ();
/*
@@ -292,7 +294,8 @@
fieldname = (char *) oql_query_get_field_name (query, i);
val =
oql_translate_from_read (row[i], c, fieldname, dbtype);
- add_field_to_result_row (r, val);
+ /* add_field_to_result_row(r,val); */
+ r = g_list_append(r,val); /* add_field_to_result_row */
}
/* add entry to list */
result->data = g_list_prepend (result->data, r);
@@ -425,7 +428,7 @@
MYSQL_RES *res;
MYSQL_ROW row;
char *buf;
- GList *l;
+ /* GList *l; */
int i;
DatabaseDefinition *db = NULL;
char *p;
@@ -799,7 +802,7 @@
}
/* initialise a connection to a specific MySQL database */
-static struct database_handle *
+struct database_handle *
MySQL_create_database_handle (configuration config, const char *dbname)
{
int i;
@@ -861,7 +864,7 @@
c->handle = NULL; /* no connection yet */
}
}
- return (h);
+ return ((struct database_handle *) h);
}
Index: gnue/geas/src/objectstore/objectstore.c
diff -u gnue/geas/src/objectstore/objectstore.c:1.62
gnue/geas/src/objectstore/objectstore.c:1.63
--- gnue/geas/src/objectstore/objectstore.c:1.62 Wed Jun 6 09:01:23 2001
+++ gnue/geas/src/objectstore/objectstore.c Wed Jun 6 16:45:33 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.62 2001/06/06 16:01:23 ntiffin Exp $
+ $Id: objectstore.c,v 1.63 2001/06/06 23:45:33 ntiffin Exp $
*/
#include "config.h"
@@ -209,7 +209,7 @@
{
struct database_handle *h = NULL;
struct query_result *retval = NULL;
- const char *database = get_first_active_database (configdata); /*
HACK */
+ const char *database = get_first_active_database (configdata); /*
TODO HACK */
trace_functioncall ();
if (!classname || !key)
Index: gnue/geas/src/objectstore/objectstore.h
diff -u gnue/geas/src/objectstore/objectstore.h:1.20
gnue/geas/src/objectstore/objectstore.h:1.21
--- gnue/geas/src/objectstore/objectstore.h:1.20 Wed Jun 6 09:01:23 2001
+++ gnue/geas/src/objectstore/objectstore.h Wed Jun 6 16:45:33 2001
@@ -20,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.20 2001/06/06 16:01:23 ntiffin Exp $
+ $Id: objectstore.h,v 1.21 2001/06/06 23:45:33 ntiffin Exp $
*/
#ifndef _OBJECTSTORE_H
@@ -78,39 +78,52 @@
data - check success field */
};
+/** \brief Connect and initialize a database connection.
+ */
gboolean initialise_objectstore (configuration config);
+
+/** \brief Close connection to database.
+ */
gboolean close_object_store (void);
+
+/** \brief Free query result.
+ */
void free_query_result (struct query_result *result);
-/* NOTE: pass in NULL for errcode and/or errmsg if you don't wish
+/** \brief Perform a query.
+ * NOTE: pass in NULL for errcode and/or errmsg if you don't wish
* to receive them. if you do pass values in, you must free the string
- * allocated and stored in *errmsg */
-
-/* perform a query */
+ * allocated and stored in *errmsg.
+ */
struct query_result *query_objectstore (QueryData * query, int *err,
char **errmsg);
-/* delete an object from the database */
+/** \brief Delete a matching object from the database.
+ */
struct query_result *delete_from_objectstore (const char *classname,
const char *key, int *err,
char **errmsg);
-
+/** \brief Delete all matching objects from a database.
+ */
struct query_result *delete_all_from_objectstore (const char *classname,
const char *field,
const char *key, int *err,
char **errmsg);
-/* write data from object cache to the datastore */
-/* once this function returns, the object may be removed instantly,
- so should not be accessed again, such as from another thread */
+/** \brief Write data from object cache to the datastore
+ *
+ * Once this function returns, the object may be removed instantly,
+ * so should not be accessed again, such as from another thread.
+ */
struct query_result *write_to_objectstore (const gchar *classname,
const gchar *key,
GHashTable *values,
gboolean update,
int *err, char **errmsg);
-/* go through all active databases, and make sure they contain */
-/* the appropriate tables */
+/** \brief Go through all active databases, and make sure they contain
+ * the appropriate tables.
+ */
void update_objectstore_databases (gboolean remove_items);
#endif /* not _OBJECTSTORE_H */
Index: gnue/geas/src/objectstore/postgresql.c
diff -u gnue/geas/src/objectstore/postgresql.c:1.2
gnue/geas/src/objectstore/postgresql.c:1.3
--- gnue/geas/src/objectstore/postgresql.c:1.2 Wed Jun 6 10:56:18 2001
+++ gnue/geas/src/objectstore/postgresql.c Wed Jun 6 16:45:33 2001
@@ -20,17 +20,17 @@
along with GEAS; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- $Id: postgresql.c,v 1.2 2001/06/06 17:56:18 reinhard Exp $
+ $Id: postgresql.c,v 1.3 2001/06/06 23:45:33 ntiffin Exp $
*/
#include "config.h"
#include <string.h>
-#include "libpq-fe.h"
#include "objectstore.h"
#include "objectstore_private.h"
#include "geas-server.h"
#ifdef USE_POSTGRESQL
+#include "libpq-fe.h"
/* Private Functions */
struct active_connection * postgresql_get_connection (struct database_handle
*hnd);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue/geas/src/objectstore mysql.c objectstore.c...,
Neil Tiffin <=