commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnue/geas/src collectiondata.c connection.c gea...


From: Reinhard Mueller
Subject: gnue/geas/src collectiondata.c connection.c gea...
Date: Mon, 28 Jan 2002 17:26:40 -0500

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Changes by:     Reinhard Mueller <address@hidden>       02/01/28 17:26:40

Modified files:
        geas/src       : collectiondata.c connection.c 
                         geas-internal-classes.h objectlist.c query.c 
        geas/src/classdef: classdef.c classdef.h 
        geas/src/objectcache: objectcache.c objectcache_internal.h 

Log message:
        Changed internal fieldnames "position" and "constraint" to "posit" and 
"constr"
        to not match postgres reserved words.
        Implemented fieldlists for indexes in classdef.
        Changed objectcache to use the new parser.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/geas/src/collectiondata.c.diff?tr1=1.31&tr2=1.32&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/geas/src/connection.c.diff?tr1=1.67&tr2=1.68&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/geas/src/geas-internal-classes.h.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/geas/src/objectlist.c.diff?tr1=1.31&tr2=1.32&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/geas/src/query.c.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/geas/src/classdef/classdef.c.diff?tr1=1.33&tr2=1.34&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/geas/src/classdef/classdef.h.diff?tr1=1.28&tr2=1.29&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/geas/src/objectcache/objectcache.c.diff?tr1=1.62&tr2=1.63&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/geas/src/objectcache/objectcache_internal.h.diff?tr1=1.5&tr2=1.6&r1=text&r2=text

Patches:
Index: gnue/geas/src/classdef/classdef.c
diff -c gnue/geas/src/classdef/classdef.c:1.33 
gnue/geas/src/classdef/classdef.c:1.34
*** gnue/geas/src/classdef/classdef.c:1.33      Mon Jan 28 15:07:41 2002
--- gnue/geas/src/classdef/classdef.c   Mon Jan 28 17:26:40 2002
***************
*** 19,25 ****
     along with GEAS; if not, write to the Free Software Foundation, Inc.,
     59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  
!    $Id: classdef.c,v 1.33 2002/01/28 20:07:41 reinhard Exp $
  */
  
  #include "config.h"
--- 19,25 ----
     along with GEAS; if not, write to the Free Software Foundation, Inc.,
     59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  
!    $Id: classdef.c,v 1.34 2002/01/28 22:26:40 reinhard Exp $
  */
  
  #include "config.h"
***************
*** 164,169 ****
--- 164,170 ----
    geas_cd_module *builtin;
    geas_cd_class *c;
    geas_cd_field *f;
+   geas_cd_index *i;
  
    _modules = g_hash_table_new (g_str_hash, g_str_equal);
  
***************
*** 201,209 ****
--- 202,212 ----
  
    /* class geas::user */
    c = geas_cd_module_class_new (_geas_module, "user");
+   i = geas_cd_class_index_new (c, FALSE);
    f = geas_cd_class_field_new (c, _geas_module, "username",
                                 geas_cd_module_find_type (builtin, "char"));
    geas_cd_field_set_format (f, 32);
+   geas_cd_index_add_field (i, f);
    f = geas_cd_class_field_new (c, _geas_module, "password",
                                 geas_cd_module_find_type (builtin, "char"));
    geas_cd_field_set_format (f, 32);
***************
*** 217,225 ****
  
    /* class geas::listitem */
    c = geas_cd_module_class_new (_geas_module, "listitem");
!   f = geas_cd_class_field_new (c, _geas_module, "position",
!                                geas_cd_module_find_type (builtin, "int16"));
    f = geas_cd_class_field_new (c, _geas_module, "listid", _id_type);
    f = geas_cd_class_field_new (c, _geas_module, "reference", _id_type);
  
    /* class geas::listholder */
--- 220,231 ----
  
    /* class geas::listitem */
    c = geas_cd_module_class_new (_geas_module, "listitem");
!   i = geas_cd_class_index_new (c, FALSE);
    f = geas_cd_class_field_new (c, _geas_module, "listid", _id_type);
+   geas_cd_index_add_field (i, f);
+   f = geas_cd_class_field_new (c, _geas_module, "posit",
+                                geas_cd_module_find_type (builtin, "int16"));
+   geas_cd_index_add_field (i, f);
    f = geas_cd_class_field_new (c, _geas_module, "reference", _id_type);
  
    /* class geas::listholder */
***************
*** 267,273 ****
                                 geas_cd_module_find_type (builtin, "char"));
    geas_cd_field_set_format (f, 128);
    geas_cd_field_set_default (f, "");
!   f = geas_cd_class_field_new (c, _geas_module, "constraint", _id_type);
  }
  
  /* ------------------------------------------------------------------------- 
*\
--- 273,279 ----
                                 geas_cd_module_find_type (builtin, "char"));
    geas_cd_field_set_format (f, 128);
    geas_cd_field_set_default (f, "");
!   f = geas_cd_class_field_new (c, _geas_module, "constr", _id_type);
  }
  
  /* ------------------------------------------------------------------------- 
*\
***************
*** 1745,1747 ****
--- 1751,1767 ----
    i->fields = g_list_append (i->fields, f);
    f->indexes = g_list_append (f->indexes, i);
  }
+ 
+ /* ------------------------------------------------------------------------- 
*\
+  * Create the fieldlist for the index
+ \* ------------------------------------------------------------------------- 
*/
+ geas_cd_fieldlist *
+ geas_cd_index_fieldlist_new (const geas_cd_index *i)
+ {
+   geas_cd_fieldlist *fl;
+ 
+   fl = g_new0 (geas_cd_fieldlist, 1);
+   fl->root = i->fields;
+   return (fl);
+ }
+ 
Index: gnue/geas/src/classdef/classdef.h
diff -c gnue/geas/src/classdef/classdef.h:1.28 
gnue/geas/src/classdef/classdef.h:1.29
*** gnue/geas/src/classdef/classdef.h:1.28      Sat Jan 26 17:16:42 2002
--- gnue/geas/src/classdef/classdef.h   Mon Jan 28 17:26:40 2002
***************
*** 19,25 ****
     along with GEAS; if not, write to the Free Software Foundation, Inc.,
     59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  
!    $Id: classdef.h,v 1.28 2002/01/26 22:16:42 reinhard Exp $
  */
  
  #ifndef _CLASSDEF_H
--- 19,25 ----
     along with GEAS; if not, write to the Free Software Foundation, Inc.,
     59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  
!    $Id: classdef.h,v 1.29 2002/01/28 22:26:40 reinhard Exp $
  */
  
  #ifndef _CLASSDEF_H
***************
*** 224,233 ****
  geas_cd_index *geas_cd_indexlist_next (geas_cd_indexlist *il);
  void           geas_cd_indexlist_free (geas_cd_indexlist *il);
  
- #endif /* _CLASSDEF_H */
  /* ------------------------------------------------------------------------- 
*\
   * Indexes
  \* ------------------------------------------------------------------------- 
*/
  
! void geas_cd_index_add_field (geas_cd_index *i, geas_cd_field *f);
  
--- 224,234 ----
  geas_cd_index *geas_cd_indexlist_next (geas_cd_indexlist *il);
  void           geas_cd_indexlist_free (geas_cd_indexlist *il);
  
  /* ------------------------------------------------------------------------- 
*\
   * Indexes
  \* ------------------------------------------------------------------------- 
*/
  
! void               geas_cd_index_add_field (geas_cd_index *i, geas_cd_field 
*f);
! geas_cd_fieldlist *geas_cd_index_fieldlist_new (const geas_cd_index *i);
  
+ #endif /* _CLASSDEF_H */
Index: gnue/geas/src/collectiondata.c
diff -c gnue/geas/src/collectiondata.c:1.31 gnue/geas/src/collectiondata.c:1.32
*** gnue/geas/src/collectiondata.c:1.31 Wed Nov 14 16:17:14 2001
--- gnue/geas/src/collectiondata.c      Mon Jan 28 17:26:40 2002
***************
*** 19,25 ****
     along with this program; if not, write to the Free Software Foundation,
     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
     
!    $Id: collectiondata.c,v 1.31 2001/11/14 21:17:14 reinhard Exp $
  
  */
  
--- 19,25 ----
     along with this program; if not, write to the Free Software Foundation,
     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
     
!    $Id: collectiondata.c,v 1.32 2002/01/28 22:26:40 reinhard Exp $
  
  */
  
***************
*** 172,178 ****
            hacklist = g_list_prepend( hacklist , ob );
            g_free (keydata);
            sprintf (buf, "%d", i);
!           oc_set_object_field_quick (ob, "position" , buf, FALSE);
            oc_set_object_field_quick (ob, "reference", id, FALSE);
  /*       printf( "reference: '%s' '%s'\n" , id , 
oc_get_object_field(ob,"reference") ); */
  
--- 172,178 ----
            hacklist = g_list_prepend( hacklist , ob );
            g_free (keydata);
            sprintf (buf, "%d", i);
!           oc_set_object_field_quick (ob, "posit" , buf, FALSE);
            oc_set_object_field_quick (ob, "reference", id, FALSE);
  /*       printf( "reference: '%s' '%s'\n" , id , 
oc_get_object_field(ob,"reference") ); */
  
Index: gnue/geas/src/connection.c
diff -c gnue/geas/src/connection.c:1.67 gnue/geas/src/connection.c:1.68
*** gnue/geas/src/connection.c:1.67     Thu Dec 13 14:54:50 2001
--- gnue/geas/src/connection.c  Mon Jan 28 17:26:40 2002
***************
*** 19,25 ****
     along with this program; if not, write to the Free Software Foundation,
     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
     
!    $Id: connection.c,v 1.67 2001/12/13 19:54:50 reinhard Exp $
   
  */
  
--- 19,25 ----
     along with this program; if not, write to the Free Software Foundation,
     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
     
!    $Id: connection.c,v 1.68 2002/01/28 22:26:40 reinhard Exp $
   
  */
  
***************
*** 665,671 ****
  
    /* get all fields with 'constraint' == queryid */
    list =
!     Connection_loadObjects (id, "geas::searchfield", "constraint",
                              (char *) queryid, ev);
    if (ev->_major != CORBA_NO_EXCEPTION)
      {
--- 665,671 ----
  
    /* get all fields with 'constraint' == queryid */
    list =
!     Connection_loadObjects (id, "geas::searchfield", "constr",
                              (char *) queryid, ev);
    if (ev->_major != CORBA_NO_EXCEPTION)
      {
***************
*** 1008,1014 ****
  
    /* read fields */
    query2 = oql_load_object ("geas::searchfield");
!   do_oql_add_query_constraint (query2, "geas::searchfield", "constraint", "=",
                                 queryid, q_hackish, TRUE);
    result = query_objectstore (query2, NULL, NULL);
    if (!result)
--- 1008,1014 ----
  
    /* read fields */
    query2 = oql_load_object ("geas::searchfield");
!   do_oql_add_query_constraint (query2, "geas::searchfield", "constr", "=",
                                 queryid, q_hackish, TRUE);
    result = query_objectstore (query2, NULL, NULL);
    if (!result)
Index: gnue/geas/src/geas-internal-classes.h
diff -c gnue/geas/src/geas-internal-classes.h:1.18 
gnue/geas/src/geas-internal-classes.h:1.19
*** gnue/geas/src/geas-internal-classes.h:1.18  Sun Sep  2 02:49:16 2001
--- gnue/geas/src/geas-internal-classes.h       Mon Jan 28 17:26:40 2002
***************
*** 20,26 ****
     along with this program; if not, write to the Free Software Foundation,
     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
     
!    $Id: geas-internal-classes.h,v 1.18 2001/09/02 06:49:16 reinhard Exp $
   
  */
  
--- 20,26 ----
     along with this program; if not, write to the Free Software Foundation,
     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
     
!    $Id: geas-internal-classes.h,v 1.19 2002/01/28 22:26:40 reinhard Exp $
   
  */
  
***************
*** 180,192 ****
    odl_container_insert_container (m, c);
    c->base.parent = (odl_base *) m;
    body = NULL;
!   c->orderby = g_strdup ("position");
  
    /* add field unsigned int position */
    f = alloc_odl_item ();
    f->base.parent = (odl_base *) c;
    f->base.access = ODL_ACCESS_SYSTEM;
!   f->base.name = g_strdup ("position");
    f->base.type = IT_field;
    f->fieldtype = FT_basic;
    f->datatype = DT_unsignedint;
--- 180,192 ----
    odl_container_insert_container (m, c);
    c->base.parent = (odl_base *) m;
    body = NULL;
!   c->orderby = g_strdup ("posi");
  
    /* add field unsigned int position */
    f = alloc_odl_item ();
    f->base.parent = (odl_base *) c;
    f->base.access = ODL_ACCESS_SYSTEM;
!   f->base.name = g_strdup ("posi");
    f->base.type = IT_field;
    f->fieldtype = FT_basic;
    f->datatype = DT_unsignedint;
***************
*** 226,232 ****
      }
  
    /* add indexes */
!   fields = g_list_append (NULL, g_strdup ("position"));
    fields = g_list_append (fields, g_strdup ("listid"));
    odl_make_index (c, TRUE, fields);
  
--- 226,232 ----
      }
  
    /* add indexes */
!   fields = g_list_append (NULL, g_strdup ("posit"));
    fields = g_list_append (fields, g_strdup ("listid"));
    odl_make_index (c, TRUE, fields);
  
***************
*** 432,438 ****
    f = alloc_odl_item ();
    f->base.parent = (odl_base *) c;
    f->base.access = ODL_ACCESS_SYSTEM;
!   f->base.name = g_strdup ("constraint");
    f->base.type = IT_field;
    f->fieldtype = FT_basic;
    f->datatype = DT_object;
--- 432,438 ----
    f = alloc_odl_item ();
    f->base.parent = (odl_base *) c;
    f->base.access = ODL_ACCESS_SYSTEM;
!   f->base.name = g_strdup ("constr");
    f->base.type = IT_field;
    f->fieldtype = FT_basic;
    f->datatype = DT_object;
Index: gnue/geas/src/objectcache/objectcache.c
diff -c gnue/geas/src/objectcache/objectcache.c:1.62 
gnue/geas/src/objectcache/objectcache.c:1.63
*** gnue/geas/src/objectcache/objectcache.c:1.62        Sat Jan 26 15:50:34 2002
--- gnue/geas/src/objectcache/objectcache.c     Mon Jan 28 17:26:40 2002
***************
*** 19,25 ****
     along with this program; if not, write to the Free Software Foundation,
     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
     
!    $Id: objectcache.c,v 1.62 2002/01/26 20:50:34 reinhard Exp $
  */
  
  #include "config.h"
--- 19,25 ----
     along with this program; if not, write to the Free Software Foundation,
     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
     
!    $Id: objectcache.c,v 1.63 2002/01/28 22:26:40 reinhard Exp $
  */
  
  #include "config.h"
***************
*** 78,85 ****
                                      oc_index_identifier * indexid);
  static void oc_free_index_identifier_list (GList * list);
  static oc_index_identifier *oc_make_index_identifier (_ObjectData * object,
!                                                       _odl_index * i);
! static char *oc_make_object_index_hash (_ObjectData * o, _odl_index * idx);
  static GList *oc_object_to_start_of_list (GList * l, ObjectData * obj);
  static GList *oc_object_to_end_of_list (GList * l, ObjectData * obj);
  
--- 78,85 ----
                                      oc_index_identifier * indexid);
  static void oc_free_index_identifier_list (GList * list);
  static oc_index_identifier *oc_make_index_identifier (_ObjectData * object,
!                                                       geas_cd_index * i);
! static char *oc_make_object_index_hash (_ObjectData * o, geas_cd_index * idx);
  static GList *oc_object_to_start_of_list (GList * l, ObjectData * obj);
  static GList *oc_object_to_end_of_list (GList * l, ObjectData * obj);
  
***************
*** 713,720 ****
                       const char *value, gboolean readonly, gboolean system)
  {
    _FieldData *f;
!   GList *idxs, *l, *ids;
!   odl_class *c;
  
    trace_functioncall ();
    if (g_strcasecmp ("sys_id", fieldname) == 0)
--- 713,723 ----
                       const char *value, gboolean readonly, gboolean system)
  {
    _FieldData *f;
!   GList *l, *l2, *ids;
!   geas_cd_class *c;
!   geas_cd_field *field;
!   geas_cd_indexlist *il;
!   geas_cd_index *i;
  
    trace_functioncall ();
    if (g_strcasecmp ("sys_id", fieldname) == 0)
***************
*** 746,794 ****
            f->readonly = TRUE;
          }
        /* make a list of all indexes that this field is attached to */
-       idxs = NULL;
        ids = NULL;
!       c = odl_find_class (all_classes, object->classname, NULL);
        if (c)
          {
!           GList *l = c->indexes;
!           while (l)
              {
!               _odl_index *i = (_odl_index *) l->data;
!               if (!i->primary
!                   && odl_namelist_contains (i->fields, fieldname, FALSE))
                  {
!                   idxs = g_list_append (idxs, i);
                  }
!               l = g_list_next (l);
              }
          }
-       if (idxs)
-         {
-           l = idxs;
-           while (l)
-             {
-               oc_index_identifier *identifier = NULL;
-               _odl_index *i = (_odl_index *) l->data;
- 
-               identifier = oc_make_index_identifier (object, i);
-               ids = g_list_append (ids, identifier);
- 
-               l = l->next;
-             }
-           g_list_free (idxs);
-         }
  
        /* remove the object from any indexes in the 'ids' list */
        if (ids)
          {
!           GList *l = object->indexes;
            while (l)
              {
                _CacheIndex *i = l->data;
!               if (odl_namelist_contains (ids, i->hashkey, TRUE))
                  {
!                   oc_remove_from_index (i, object);
                  }
                l = g_list_next (l);
              }
--- 749,788 ----
            f->readonly = TRUE;
          }
        /* make a list of all indexes that this field is attached to */
        ids = NULL;
!       c = geas_cd_class_find (object->classname);
        if (c)
          {
!           field = geas_cd_class_find_field (c, NULL /* FIXME */, fieldname);
!           if (field)
              {
!               il = geas_cd_field_indexlist_new (field);
!               while ((i = geas_cd_indexlist_next (il)))
                  {
!                   ids = g_list_append (ids,
!                                        oc_make_index_identifier (object, i));
                  }
!               geas_cd_indexlist_free (il);
              }
          }
  
        /* remove the object from any indexes in the 'ids' list */
        if (ids)
          {
!           l = object->indexes;
            while (l)
              {
                _CacheIndex *i = l->data;
!               l2 = ids;
! 
!               while (l2)
                  {
!                   if (g_strcasecmp (l2->data, i->hashkey))
!                     {
!                       oc_remove_from_index (i, object);
!                       break;
!                     }
!                   l2 = g_list_next (l2);
                  }
                l = g_list_next (l);
              }
***************
*** 1023,1047 ****
   * 
  \* ------------------------------------------------------------------------- 
*/
  static oc_index_identifier *
! oc_make_index_identifier (_ObjectData * object, _odl_index * i)
  {
    oc_index_identifier *id = g_new0 (oc_index_identifier, 1);
    trace_functioncall ();
    if (id)
      {
!       GList *f;
        GString *buf;
  
        buf = g_string_new (object->classname);
        g_string_append (buf, "/");
!       f = i->fields;
!       while (f)
          {
!           g_string_append (buf, f->data);
!           if (f->next)
!             g_string_append (buf, ",");
!           f = f->next;
          }
        id->classname = g_strdup (object->classname);
        id->indexid = buf->str;
        id->index = i;
--- 1017,1045 ----
   * 
  \* ------------------------------------------------------------------------- 
*/
  static oc_index_identifier *
! oc_make_index_identifier (_ObjectData * object, geas_cd_index * i)
  {
    oc_index_identifier *id = g_new0 (oc_index_identifier, 1);
    trace_functioncall ();
    if (id)
      {
!       geas_cd_fieldlist *fl;
!       geas_cd_field *f;
        GString *buf;
  
        buf = g_string_new (object->classname);
        g_string_append (buf, "/");
!       fl = geas_cd_index_fieldlist_new (i);
!       if ((f = geas_cd_fieldlist_next (fl)))
!         {
!           g_string_append (buf, geas_cd_field_get_name (f));
!         }
!       while ((f = geas_cd_fieldlist_next (fl)))
          {
!           g_string_append (buf, ",");
!           g_string_append (buf, geas_cd_field_get_name (f));
          }
+       geas_cd_fieldlist_free (fl);
        id->classname = g_strdup (object->classname);
        id->indexid = buf->str;
        id->index = i;
***************
*** 1224,1236 ****
    _CacheIndexLink *link;
    char *classname;
    GString *buf;
-   /* GString *hash; */
    GList *l;
-   /* gboolean needcomma = TRUE; */
    char *key = NULL;
  
    trace_functioncall ();
! //   return( NULL ); /* XYZ */
    if (!q)
      {
        return (NULL);
--- 1222,1234 ----
    _CacheIndexLink *link;
    char *classname;
    GString *buf;
    GList *l;
    char *key = NULL;
+   geas_cd_fieldlist *fl;
+   geas_cd_field *f;
  
    trace_functioncall ();
! 
    if (!q)
      {
        return (NULL);
***************
*** 1304,1330 ****
        return (NULL);
      }
    g_string_free (buf, TRUE); 
  
    /* make appropriate object hash key for finding 'classname' in 'idx' */
    buf = g_string_new ("");
!   l = idx->index->fields;
!   while (l)
      {
        GList *cl;
        char *field;
        _QueryCondition *c;
  
!       /* find condition 'classname.(l->data) = value' */
        if (debuglevel == OC_TEMP_DEBUG)
          {
!           printf ("OCCACHE:  index field: %s\n", (char *) (l->data));
          }
        cl = q->conditions;
        field = NULL;
        while (cl)
          {
            c = cl->data;
!           if (g_strcasecmp (c->field, l->data) == 0)
              {
                if (debuglevel == OC_TEMP_DEBUG)
                  {
--- 1302,1331 ----
        return (NULL);
      }
    g_string_free (buf, TRUE); 
+   g_message ("drei");
  
    /* make appropriate object hash key for finding 'classname' in 'idx' */
    buf = g_string_new ("");
!   fl = geas_cd_index_fieldlist_new (idx->index);
!   while ((f = geas_cd_fieldlist_next (fl)))
      {
        GList *cl;
+       const char *fieldname;
        char *field;
        _QueryCondition *c;
  
!       fieldname = geas_cd_field_get_name (f);
! 
        if (debuglevel == OC_TEMP_DEBUG)
          {
!           printf ("OCCACHE:  index field: %s\n", fieldname);
          }
        cl = q->conditions;
        field = NULL;
        while (cl)
          {
            c = cl->data;
!           if (g_strcasecmp (c->field, fieldname) == 0)
              {
                if (debuglevel == OC_TEMP_DEBUG)
                  {
***************
*** 1339,1349 ****
  
        if (field)
          {
!           g_string_append (buf, field);
!           if (l->next)
              {
                g_string_append (buf, ":");
              }
          }
        else
          {
--- 1340,1350 ----
  
        if (field)
          {
!           if (buf->len)
              {
                g_string_append (buf, ":");
              }
+           g_string_append (buf, field);
          }
        else
          {
***************
*** 1354,1362 ****
            g_string_free (buf, TRUE);
            return (NULL);
          }
- 
-       l = g_list_next (l);
      }
  
    /* found an index, now look for the object in that index */
    if (debuglevel == OC_TEMP_DEBUG)
--- 1355,1362 ----
            g_string_free (buf, TRUE);
            return (NULL);
          }
      }
+   geas_cd_fieldlist_free (fl);
  
    /* found an index, now look for the object in that index */
    if (debuglevel == OC_TEMP_DEBUG)
***************
*** 1397,1409 ****
   * 
  \* ------------------------------------------------------------------------- 
*/
  static char *
! oc_make_object_index_hash (_ObjectData * object, _odl_index * idx)
  {
-   GList *l;
    GString *buf;
    char *retval = NULL;
!   odl_class *c;
!   odl_field *f;
  
    trace_functioncall ();
    /* get the contents of the object's fields and add them to the object hash 
*/
--- 1397,1409 ----
   * 
  \* ------------------------------------------------------------------------- 
*/
  static char *
! oc_make_object_index_hash (_ObjectData * object, geas_cd_index * idx)
  {
    GString *buf;
    char *retval = NULL;
!   geas_cd_class *c;
!   geas_cd_fieldlist *fl;
!   geas_cd_field *f;
  
    trace_functioncall ();
    /* get the contents of the object's fields and add them to the object hash 
*/
***************
*** 1411,1431 ****
      {
        printf ("OCCACHE: creating object's index hash key\n");
      }
-   l = idx->fields;
    buf = g_string_new ("");
!   c = odl_find_class (all_classes, object->classname, NULL);
!   while (l)
      {
-       /* TODO add a quote character to fields to quote any : characters */
        char *field;
  
!       field = oc_get_object_field (object, l->data);
!       f = odl_class_get_field (c, l->data);
        if (field)
          {
            g_string_append (buf, field);
          }
!       else if ((f->properties & ODL_PROP_NOTNULL) != ODL_PROP_NOTNULL)
          {
            /* NULL field, allowed */
            g_string_append (buf, "(null)");
--- 1411,1434 ----
      {
        printf ("OCCACHE: creating object's index hash key\n");
      }
    buf = g_string_new ("");
!   c = geas_cd_class_find (object->classname);
!   fl = geas_cd_index_fieldlist_new (idx);
!   while ((f = geas_cd_fieldlist_next (fl)))
      {
        char *field;
  
!       if (buf->len)
!         {
!           g_string_append (buf, ":");
!         }
! 
!       field = oc_get_object_field (object, geas_cd_field_get_name (f));
        if (field)
          {
            g_string_append (buf, field);
          }
!       else if (geas_cd_field_prop_get (f, GEAS_CD_FPROP_NOTNULL))
          {
            /* NULL field, allowed */
            g_string_append (buf, "(null)");
***************
*** 1438,1453 ****
              {
                printf
                  ("OCCACHE: NOT NULL field (%s) is NULL - can not index\n",
!                  (char *) (l->data));
              }
            return (NULL);
          }
-       if (l->next)
-         {
-           g_string_append (buf, ":");
-         }
-       l = g_list_next (l);
      }
    retval = buf->str;
    buf->str = NULL;
    g_string_free (buf, FALSE);
--- 1441,1452 ----
              {
                printf
                  ("OCCACHE: NOT NULL field (%s) is NULL - can not index\n",
!                  geas_cd_field_get_name (f));
              }
            return (NULL);
          }
      }
+   geas_cd_fieldlist_free (fl);
    retval = buf->str;
    buf->str = NULL;
    g_string_free (buf, FALSE);
Index: gnue/geas/src/objectcache/objectcache_internal.h
diff -c gnue/geas/src/objectcache/objectcache_internal.h:1.5 
gnue/geas/src/objectcache/objectcache_internal.h:1.6
*** gnue/geas/src/objectcache/objectcache_internal.h:1.5        Tue Jun 12 
23:33:03 2001
--- gnue/geas/src/objectcache/objectcache_internal.h    Mon Jan 28 17:26:40 2002
***************
*** 20,32 ****
     along with this program; if not, write to the Free Software Foundation,
     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
     
!    $Id: objectcache_internal.h,v 1.5 2001/06/13 03:33:03 treshna Exp $
   
  */
  
  #ifndef OBJECTCACHE_INTERNAL_H
  #define OBJECTCACHE_INTERNAL_H
  
  /**
   * This structure stores the information on a single object in the cache
   */
--- 20,34 ----
     along with this program; if not, write to the Free Software Foundation,
     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
     
!    $Id: objectcache_internal.h,v 1.6 2002/01/28 22:26:40 reinhard Exp $
   
  */
  
  #ifndef OBJECTCACHE_INTERNAL_H
  #define OBJECTCACHE_INTERNAL_H
  
+ #include "classdef/classdef.h"
+ 
  /**
   * This structure stores the information on a single object in the cache
   */
***************
*** 88,94 ****
    char *hashkey;
  
    /* what fields are in this index */
!   _odl_index *index;
  
    /* record the objects in this index */
    GHashTable *hashtable;
--- 90,96 ----
    char *hashkey;
  
    /* what fields are in this index */
!   geas_cd_index *index;
  
    /* record the objects in this index */
    GHashTable *hashtable;
***************
*** 99,105 ****
  {
    char *classname;
    char *indexid;
!   _odl_index *index;
  }
  oc_index_identifier;
  
--- 101,107 ----
  {
    char *classname;
    char *indexid;
!   geas_cd_index *index;
  }
  oc_index_identifier;
  
Index: gnue/geas/src/objectlist.c
diff -c gnue/geas/src/objectlist.c:1.31 gnue/geas/src/objectlist.c:1.32
*** gnue/geas/src/objectlist.c:1.31     Wed Nov 14 16:17:14 2001
--- gnue/geas/src/objectlist.c  Mon Jan 28 17:26:40 2002
***************
*** 20,26 ****
     along with this program; if not, write to the Free Software Foundation,
     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
     
!    $Id: objectlist.c,v 1.31 2001/11/14 21:17:14 reinhard Exp $
   
  */
  
--- 20,26 ----
     along with this program; if not, write to the Free Software Foundation,
     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
     
!    $Id: objectlist.c,v 1.32 2002/01/28 22:26:40 reinhard Exp $
   
  */
  
***************
*** 152,158 ****
                                  "listid");
        pos = g_strdup_printf ("%d", index);
        oql_add_query_constraint (q, NULL, pos, "=", "geas::listitem",
!                                 "position");
        g_free (pos);
        /* WHERE geas::listitem.listid   = id->listid AND 
         *       geas::listitem.position = index
--- 152,158 ----
                                  "listid");
        pos = g_strdup_printf ("%d", index);
        oql_add_query_constraint (q, NULL, pos, "=", "geas::listitem",
!                                 "posit");
        g_free (pos);
        /* WHERE geas::listitem.listid   = id->listid AND 
         *       geas::listitem.position = index
***************
*** 254,260 ****
                                  "listid");
        pos = g_strdup_printf ("%d", index);
        oql_add_query_constraint (q, NULL, pos, "=", "geas::listitem",
!                                 "position");
        g_free (pos);
        /* WHERE geas::listitem.listid   = id->listid AND 
         *       geas::listitem.position = index
--- 254,260 ----
                                  "listid");
        pos = g_strdup_printf ("%d", index);
        oql_add_query_constraint (q, NULL, pos, "=", "geas::listitem",
!                                 "posit");
        g_free (pos);
        /* WHERE geas::listitem.listid   = id->listid AND 
         *       geas::listitem.position = index
***************
*** 385,391 ****
      }
    /* store the object's details */
    buf = g_strdup_printf ("%d", len - 1);
!   GEAS_DataObject_setField (newobj, "position", buf, ev);       /* where in 
list */
    g_free (buf);
    GEAS_DataObject_setField (newobj, "listid", id->listid, ev);  /* which list 
*/
    GEAS_DataObject_setField (newobj, "reference", objid, ev);    /* what 
object, id */
--- 385,391 ----
      }
    /* store the object's details */
    buf = g_strdup_printf ("%d", len - 1);
!   GEAS_DataObject_setField (newobj, "posit", buf, ev);       /* where in list 
*/
    g_free (buf);
    GEAS_DataObject_setField (newobj, "listid", id->listid, ev);  /* which list 
*/
    GEAS_DataObject_setField (newobj, "reference", objid, ev);    /* what 
object, id */
***************
*** 436,442 ****
    oql_add_query_constraint (q, NULL, id->listid, "=", "geas::listitem",
                              "listid");
    pos = g_strdup_printf ("%d", index);
!   oql_add_query_constraint (q, NULL, pos, "=", "geas::listitem", "position");
    g_free (pos);
  
    /* perform the query */
--- 436,442 ----
    oql_add_query_constraint (q, NULL, id->listid, "=", "geas::listitem",
                              "listid");
    pos = g_strdup_printf ("%d", index);
!   oql_add_query_constraint (q, NULL, pos, "=", "geas::listitem", "posit");
    g_free (pos);
  
    /* perform the query */
***************
*** 496,502 ****
                                  "listid");
        pos = g_strdup_printf ("%d", i);
        oql_add_query_constraint (q, NULL, pos, "=", "geas::listitem",
!                                 "position");
        g_free (pos);
  
        /* perform the query */
--- 496,502 ----
                                  "listid");
        pos = g_strdup_printf ("%d", i);
        oql_add_query_constraint (q, NULL, pos, "=", "geas::listitem",
!                                 "posit");
        g_free (pos);
  
        /* perform the query */
***************
*** 533,539 ****
  
        /* set new index */
        buf = g_strdup_printf ("%d", i - 1);
!       GEAS_DataObject_setField (obj, "position", buf, ev);
        g_free (buf);
        CORBA_Object_release (obj, ev);
      }
--- 533,539 ----
  
        /* set new index */
        buf = g_strdup_printf ("%d", i - 1);
!       GEAS_DataObject_setField (obj, "posit", buf, ev);
        g_free (buf);
        CORBA_Object_release (obj, ev);
      }
***************
*** 650,656 ****
  
       sprintf( pos , "%d" , i );
       oql_add_query_constraint( 
q,NULL,id->listid,"=","geas::listitem","listid" );
!      oql_add_query_constraint( q,NULL,pos       
,"=","geas::listitem","position" );
       item = oc_search_for_single_object( q );
       if( item != NULL )
         oc_remove_object2( item );
--- 650,656 ----
  
       sprintf( pos , "%d" , i );
       oql_add_query_constraint( 
q,NULL,id->listid,"=","geas::listitem","listid" );
!      oql_add_query_constraint( q,NULL,pos       ,"=","geas::listitem","posit" 
);
       item = oc_search_for_single_object( q );
       if( item != NULL )
         oc_remove_object2( item );
Index: gnue/geas/src/query.c
diff -c gnue/geas/src/query.c:1.13 gnue/geas/src/query.c:1.14
*** gnue/geas/src/query.c:1.13  Sun Sep  2 02:49:16 2001
--- gnue/geas/src/query.c       Mon Jan 28 17:26:40 2002
***************
*** 19,25 ****
     along with this program; if not, write to the Free Software Foundation,
     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
     
!    $Id: query.c,v 1.13 2001/09/02 06:49:16 reinhard Exp $
   
  */
  
--- 19,25 ----
     along with this program; if not, write to the Free Software Foundation,
     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
     
!    $Id: query.c,v 1.14 2002/01/28 22:26:40 reinhard Exp $
   
  */
  
***************
*** 113,119 ****
        return;
      }
    /* fill it in */
!   GEAS_DataObject_setField (f, "constraint", id->uniqueid, ev);
    if (ev->_major != CORBA_NO_EXCEPTION)
      {
        goto error;
--- 113,119 ----
        return;
      }
    /* fill it in */
!   GEAS_DataObject_setField (f, "constr", id->uniqueid, ev);
    if (ev->_major != CORBA_NO_EXCEPTION)
      {
        goto error;
***************
*** 272,278 ****
  
    /* delete the associated geas::searchfield instances */
    result =
!     delete_all_from_objectstore ("geas::searchfield", "constraint",
                                   id->uniqueid, NULL, NULL);
    if (result)
      {
--- 272,278 ----
  
    /* delete the associated geas::searchfield instances */
    result =
!     delete_all_from_objectstore ("geas::searchfield", "constr",
                                   id->uniqueid, NULL, NULL);
    if (result)
      {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]