commit-gnue
[Top][All Lists]
Advanced

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

gnue/geas/src/objectcache objectcache.c


From: Reinhard Mueller
Subject: gnue/geas/src/objectcache objectcache.c
Date: Sat, 26 Jan 2002 15:50:34 -0500

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Changes by:     Reinhard Mueller <address@hidden>       02/01/26 15:50:34

Modified files:
        geas/src/objectcache: objectcache.c 

Log message:
        Removed code to read lookup fields, because lookup fields don't exist 
anymore.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/geas/src/objectcache/objectcache.c.diff?tr1=1.61&tr2=1.62&r1=text&r2=text

Patches:
Index: gnue/geas/src/objectcache/objectcache.c
diff -c gnue/geas/src/objectcache/objectcache.c:1.61 
gnue/geas/src/objectcache/objectcache.c:1.62
*** gnue/geas/src/objectcache/objectcache.c:1.61        Tue Nov 20 14:58:41 2001
--- gnue/geas/src/objectcache/objectcache.c     Sat Jan 26 15:50:34 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.61 2001/11/20 19:58:41 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.62 2002/01/26 20:50:34 reinhard Exp $
  */
  
  #include "config.h"
***************
*** 434,441 ****
  oc_remove_object (ObjectData * object)
  {
    _ObjectData *obj;
-   /* GList *idxs, *ids; */
-   /*  odl_class *c; */
  
    trace_functioncall ();
  
--- 434,439 ----
***************
*** 630,637 ****
  oc_get_object_field (ObjectData * object, const char *fieldname)
  {
    _FieldData *f = NULL;
-   odl_class *cl = NULL;
-   odl_field *ft = NULL;
    QueryData *q = NULL;
    /* ObjectData *o = NULL; */
  
--- 628,633 ----
***************
*** 651,771 ****
        /* found in cache, returnm it */
        return (g_strdup (f->value));
      }
!   /* get class and field info */
!   cl = odl_find_class (all_classes, object->classname, NULL);
!   if (!cl) {
!     return (NULL);
!   }
!   ft = odl_class_get_field (cl, fieldname);
!   if (!ft) {
!     return (NULL);
!   }
!   switch (odl_field_get_type (ft))
      {
!     case FT_basic:
!       /* basic field in this class - attempt to reload it */
!       q = oql_load_object_field_by_key (object->classname, fieldname,
!                                         object->key);
!       if (q)
          {
!           object = oc_objectstore_query_to_objectcache (q);
!           oql_free_query (q);
!           if (object)
              {
!               f = g_hash_table_lookup (object->fields, fieldname);
!               if (f)
!                 {
!                   /* found in cache, returnm it */
!                   return (g_strdup (f->value));
!                 }
!               /* still not found? damn.. */
!               return (NULL);
              }
          }
-       break;
-     case FT_lookup:
-       /* lookup field not found - load it */
-       {
-         GList *s, *t;
-         /* char *keystr; */
-         char *value;
-         /* char *targetfield; */
-         /* char *errmsg; */
-         odl_class *c;
-         char *loadclass = (char *) odl_field_get_sourceclass (ft);
-         ObjectData *o;
-         /* int idfield; */
-         /* struct query_result *result; */
- 
-         q = create_base_query (loadclass);
-         if (!q)
-           {
-             return (NULL);
-           }
-         /* add constraints to find just members of this lookup */
-         /* ... WHERE loadclass.t1 = this.s1 AND loadclass.t2 = this.s2
-            ... */
-         s = odl_field_get_source_fields (ft);
-         t = odl_field_get_this_fields (ft);
-         while (s && t)
-           {
-             c = odl_field_defined_in (cl, (const char *) t->data);
-             if (!c)
-               {
-                 oql_free_query (q);
-                 return (NULL);
-               }
-             o =
-               oc_find_object_by_key (odl_class_get_full_name (c),
-                                      object->key);
-             if (!o)
-               {
-                 oql_free_query (q);
-                 return (NULL);
-               }
-             value = (char *) oc_get_object_field (o, t->data);
-             if (!oql_add_query_constraint
-                 (q, NULL, (const char *) value, "=", loadclass,
-                  (const char *) s->data))
-               {
-                 oql_free_query (q);
-                 return (NULL);
-               }
-             s = g_list_next (s);
-             t = g_list_next (t);
-           }
-         if (s != NULL || t != NULL)
-           {
-             /* serious error in class def */
-             criticalerror ("%s.%s has unbalanced field lists",
-                            odl_class_get_full_name (cl), fieldname);
-             oql_free_query (q);
-             return (NULL);
-           }
-         if (q)
-           {
-             o = oc_objectstore_query_to_objectcache (q);
-             oql_free_query (q);
-             if (o)
-               {
-                 char *retval;
-                 retval =
-                   oc_get_object_field (o, odl_field_get_sourcefield (ft));
-                 f =
-                   g_hash_table_lookup (o->fields,
-                                        odl_field_get_sourcefield (ft));
-                 if (f)
-                   {
-                     f->readonly = TRUE;
-                   }
-                 return (retval);
-               }
-           }
-       }
-       break;
-     default:
-       /* no other types handled yet */
-       break;
      }
  
    /* didn't find it */
--- 647,668 ----
        /* found in cache, returnm it */
        return (g_strdup (f->value));
      }
! 
!   q = oql_load_object_field_by_key (object->classname, fieldname,
!                                     object->key);
!   if (q)
      {
!       object = oc_objectstore_query_to_objectcache (q);
!       oql_free_query (q);
!       if (object)
          {
!           f = g_hash_table_lookup (object->fields, fieldname);
!           if (f)
              {
!               /* found in cache, returnm it */
!               return (g_strdup (f->value));
              }
          }
      }
  
    /* didn't find it */



reply via email to

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