commit-gnue
[Top][All Lists]
Advanced

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

gnue/geas/src collectiondata.c geas-skeleton.c ...


From: Treshna Enterprises
Subject: gnue/geas/src collectiondata.c geas-skeleton.c ...
Date: Tue, 12 Jun 2001 20:33:03 -0700

CVSROOT:        /cvs
Module name:    gnue
Changes by:     Treshna Enterprises <address@hidden>    01/06/12 20:33:03

Modified files:
        geas/src       : collectiondata.c geas-skeleton.c objectlist.c 
        geas/src/objectcache: objectcache.c objectcache.h 
                              objectcache_internal.h 
        geas/src/objectstore: postgresql.c 
        geas/src/oql   : oql.c 

Log message:
        fixed nasty bug in last speed increase.   lost some speed again  :P

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/collectiondata.c.diff?cvsroot=OldCVS&tr1=1.25&tr2=1.26&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/geas-skeleton.c.diff?cvsroot=OldCVS&tr1=1.64&tr2=1.65&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/objectlist.c.diff?cvsroot=OldCVS&tr1=1.25&tr2=1.26&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/objectcache/objectcache.c.diff?cvsroot=OldCVS&tr1=1.53&tr2=1.54&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/objectcache/objectcache.h.diff?cvsroot=OldCVS&tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/objectcache/objectcache_internal.h.diff?cvsroot=OldCVS&tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/objectstore/postgresql.c.diff?cvsroot=OldCVS&tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/oql/oql.c.diff?cvsroot=OldCVS&tr1=1.61&tr2=1.62&r1=text&r2=text

Patches:
Index: gnue/geas/src/collectiondata.c
diff -u gnue/geas/src/collectiondata.c:1.25 gnue/geas/src/collectiondata.c:1.26
--- gnue/geas/src/collectiondata.c:1.25 Tue Jun 12 17:47:46 2001
+++ gnue/geas/src/collectiondata.c      Tue Jun 12 20:33:03 2001
@@ -19,7 +19,7 @@
    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.25 2001/06/13 00:47:46 treshna Exp $
+   $Id: collectiondata.c,v 1.26 2001/06/13 03:33:03 treshna Exp $
 
 */
 
@@ -73,7 +73,9 @@
   ObjectData *ob;               /* object cache entry */
   unsigned long int len;
   char *key;
-  int   fieldid;
+  int   fieldid,oididx;
+  GList *hacklist = NULL;
+  ObjectData *hackobj = NULL;
 
   timer_start_operation( TIMER_LISTS , "Start query: find list of objects" );
 //  timer_start_profile( TIMER_FUNC_MAKELIST );
@@ -141,6 +143,7 @@
       return (NULL);
     }
 
+
   GEAS_DataObject_setField (lst, "length", "0", ev);
   GEAS_DataObject_setField (lst, "classname", classname, ev);   /* what 
object, class */
 
@@ -154,6 +157,7 @@
       timer_fail_operation( TIMER_LISTS );
       return (NULL);
     }
+  hackobj = oc_find_cached_object_by_key( "geas::listholder" , listid );
 
   /* create list entry objects */
   len = count_rows_in_result (result);
@@ -162,34 +166,47 @@
   if( len > 0 ) {
       ObjectKey keydata;
       int fieldid = oql_query_get_field_position(query,"objectid");
-      GList *row = get_result_row(result,0);
+      GList *row = result->data;
       i = 0;
       while( row ) {
-          debug_output (DEBUGLEVEL_3, "Item: %d of %d", i, len); i++;
+        char xyz[32];
+/*          printf ("Item: %d of %d\n", i, len); */
           id = (char *) get_result_field (result, i /*row */ , idx /*field */ 
);
 
           /* record list position object */
           keydata = create_new_object_key ();
+          /* printf( "geas::listitem/%s\n" , object_key_as_string(keydata) ); 
*/
           ob = oc_add_empty_object ("geas::listitem", object_key_as_string 
(keydata));
+          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);
-          oc_set_object_field       (ob, "listid"   , listid, FALSE);
+/*       printf( "reference: '%s' '%s'\n" , id , 
oc_get_object_field(ob,"reference") ); */
+
+          oc_set_object_field (ob, "listid"   , listid, FALSE);
 
           /* make sure the object is in the cache */
-          key = get_field_in_row(row,fieldid);
-          if( oc_find_cached_object_by_key(classname,key) ) {
-            ob = oc_add_empty_object( classname , key );
-
-            for( fieldid=0 ; fieldid<result->field_count ; fieldid++ ) {
-              oc_set_object_field_quick( ob , 
get_result_field_name(result,fieldid) ,
-                                        get_field_in_row(row,fieldid) , FALSE 
);
+          oididx = fieldid = oql_query_get_field_position( query , "objectid" 
);
+          g_assert( fieldid != -1 );
+          key = get_field_in_row(row->data,fieldid);
+          g_assert( key != NULL );
+/*          printf( "key = '%s'\n" , key ); */
+
+          ob = oc_add_empty_object( classname , key );
+          for( fieldid=0 ; fieldid<result->field_count ; fieldid++ ) {
+           if( fieldid != oididx ) {
+           /* printf( "'%s' = '%s'\n" , get_result_field_name(result,fieldid) 
, get_field_in_row(row->data,fieldid) );  */
+            oc_set_object_field_quick( ob , 
get_result_field_name(result,fieldid) ,
+                                      get_field_in_row(row->data,fieldid) , 
FALSE );
            }
          }
+
           row = g_list_next( row );
+          i++;
       }
   }
+  oc_set_object_userdata( hackobj , hacklist );
 
   lenstr = g_strdup_printf ("%lu", len);
   GEAS_DataObject_setField (lst, "length", lenstr, ev);
Index: gnue/geas/src/geas-skeleton.c
diff -u gnue/geas/src/geas-skeleton.c:1.64 gnue/geas/src/geas-skeleton.c:1.65
--- gnue/geas/src/geas-skeleton.c:1.64  Tue Jun 12 17:47:46 2001
+++ gnue/geas/src/geas-skeleton.c       Tue Jun 12 20:33:03 2001
@@ -19,7 +19,7 @@
    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-skeleton.c,v 1.64 2001/06/13 00:47:46 treshna Exp $
+   $Id: geas-skeleton.c,v 1.65 2001/06/13 03:33:03 treshna Exp $
  
 */
 
@@ -3050,7 +3050,7 @@
     {
       oid_count++;
       count++;
-      uuid_generate_time (&oid_buffer[oid_count][0]);
+      uuid_generate (&oid_buffer[oid_count][0]);
     }
   debug_output (DEBUGLEVEL_2, "Created %d oids", count);
 }
Index: gnue/geas/src/objectcache/objectcache.c
diff -u gnue/geas/src/objectcache/objectcache.c:1.53 
gnue/geas/src/objectcache/objectcache.c:1.54
--- gnue/geas/src/objectcache/objectcache.c:1.53        Tue Jun 12 17:47:46 2001
+++ gnue/geas/src/objectcache/objectcache.c     Tue Jun 12 20:33:03 2001
@@ -19,7 +19,7 @@
    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.53 2001/06/13 00:47:46 treshna Exp $
+   $Id: objectcache.c,v 1.54 2001/06/13 03:33:03 treshna Exp $
 */
 
 #include "config.h"
@@ -77,6 +77,19 @@
 
 void _fill_values (gchar * key, _FieldData * field, GHashTable * values);
 
+void
+oc_set_object_userdata( ObjectData *object , void *data )
+{
+  ((_ObjectData *)object)->userdata = data;
+}
+
+void *
+oc_get_object_userdata( ObjectData *object )
+{
+
+return ((_ObjectData *)object)->userdata;
+}
+
 /* ------------------------------------------------------------------------- *\
  * used to clear all data from the cache
 \* ------------------------------------------------------------------------- */
@@ -346,7 +359,7 @@
       g_free (oid);
       return (obj);
     }
-
+/*  printf( "adding object: %d entries  %s/%s\n" , objectcache_count 
,classname,key); */
 
   /* make sure the cache doesn't have too many entries */
   oc_squeeze_cache (5);
@@ -400,12 +413,6 @@
       timer_fail_operation( TIMER_CACHE);
       return (FALSE);
     }
-#if 0
-  if (g_list_find (flushable, object))
-    {
-      printf ("in flushable list: %px (good)\n", object);
-    }
-#endif
   flushable = g_list_remove (flushable, object);
   if (g_list_find (flushable, object))
     {
@@ -422,6 +429,17 @@
   return (TRUE);
 }
 
+/* hack for lists */
+gboolean
+oc_remove_object2(ObjectData * object)
+{
+  g_hash_table_remove (cachedata, object->hashkey);
+//printf( "hey?\n" );
+//  oc_free_object_data (object);
+//printf( "hehehe?\n" );
+  return TRUE;
+}
+
 /* ------------------------------------------------------------------------- *\
  * Delete an object from the cache and from the database
 \* ------------------------------------------------------------------------- */
@@ -881,7 +899,8 @@
           GList *l = ids;
           while (l)
             {
-              /* verify that all NOT NULL fields in the index have data */
+              /* TODO: verify that all NOT NULL fields in the index have data 
*/
+             char buf[256];
               oc_add_object_to_index (object, l->data);
               l = g_list_next (l);
             }
Index: gnue/geas/src/objectcache/objectcache.h
diff -u gnue/geas/src/objectcache/objectcache.h:1.18 
gnue/geas/src/objectcache/objectcache.h:1.19
--- gnue/geas/src/objectcache/objectcache.h:1.18        Tue Jun 12 17:47:46 2001
+++ gnue/geas/src/objectcache/objectcache.h     Tue Jun 12 20:33:03 2001
@@ -20,7 +20,7 @@
    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.h,v 1.18 2001/06/13 00:47:46 treshna Exp $
+   $Id: objectcache.h,v 1.19 2001/06/13 03:33:03 treshna Exp $
  
 */
 
@@ -60,6 +60,7 @@
 void oc_empty_cache (void);
 ObjectData *oc_add_empty_object (const char *classname, const char *key);
 gboolean oc_remove_object (ObjectData * object);
+gboolean oc_remove_object2(ObjectData * object); /* hack for lists */
 gboolean oc_delete_object (const char *classname, const char *keystr);
 
 const char *oc_get_object_class (ObjectData * object);
@@ -86,5 +87,8 @@
 
 ObjectData *oc_search_for_single_object (_QueryData * q);
 GList *oc_search_for_objects (_QueryData * q);
+
+void  oc_set_object_userdata( ObjectData *obj , void *data );
+void *oc_get_object_userdata( ObjectData *obj );
 
 #endif
Index: gnue/geas/src/objectcache/objectcache_internal.h
diff -u gnue/geas/src/objectcache/objectcache_internal.h:1.4 
gnue/geas/src/objectcache/objectcache_internal.h:1.5
--- gnue/geas/src/objectcache/objectcache_internal.h:1.4        Sun Jun 10 
06:12:35 2001
+++ gnue/geas/src/objectcache/objectcache_internal.h    Tue Jun 12 20:33:03 2001
@@ -20,7 +20,7 @@
    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.4 2001/06/10 13:12:35 ntiffin Exp $
+   $Id: objectcache_internal.h,v 1.5 2001/06/13 03:33:03 treshna Exp $
  
 */
 
@@ -42,6 +42,9 @@
   /* object flags */
   int deleted:1;
   int indatabase:1;
+
+  /* nasty hack. what, another one? */
+  void *userdata;
 
   /* what indexes know about this object */
   GList *indexes;
Index: gnue/geas/src/objectlist.c
diff -u gnue/geas/src/objectlist.c:1.25 gnue/geas/src/objectlist.c:1.26
--- gnue/geas/src/objectlist.c:1.25     Tue Jun 12 17:47:46 2001
+++ gnue/geas/src/objectlist.c  Tue Jun 12 20:33:03 2001
@@ -20,7 +20,7 @@
    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.25 2001/06/13 00:47:46 treshna Exp $
+   $Id: objectlist.c,v 1.26 2001/06/13 03:33:03 treshna Exp $
  
 */
 
@@ -525,6 +525,7 @@
   CORBA_unsigned_long retval = 0;
   ObjectData *ob;
   int length,i;
+  GList *hacklist,*hacklist2;
 
   /* QueryData *q; */
   struct query_result *result;
@@ -541,10 +542,39 @@
   len = oc_get_object_field (ob, "length");
   length = atoi (len);
   g_free (len);
+
+  hacklist = (GList *)oc_get_object_userdata( ob );
+  hacklist2 = hacklist;
+  while(hacklist2)
+   {
+       oc_remove_object( hacklist2->data );
+       hacklist2 = g_list_next( hacklist2 );
+   }
+  g_list_free( hacklist );
+
   oc_delete_object( "geas::listholder" , id->listid );
+
 
-//  for( i=0 ; i<length ; i++ )
-//    oc_delete_objectfrom_cache( "geas::listitem" , id->listid );
+#if 0
+  for( i=0 ; i<length ; i++ )
+   {
+     // oc_delete_objectfrom_cache( "geas::listitem" , id->listid );
+     // find geas::listitem where listid == id->listid and position == i
+     QueryData *q = oql_load_object( "geas::listitem" );
+     char pos[32];
+     ObjectData *item;
+
+     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 );
+
+     oql_free_query(q);
+   }
+  printf( "\n" );
+#endif
 
   /* delete the geas::listholder object */
   result =
Index: gnue/geas/src/objectstore/postgresql.c
diff -u gnue/geas/src/objectstore/postgresql.c:1.5 
gnue/geas/src/objectstore/postgresql.c:1.6
--- gnue/geas/src/objectstore/postgresql.c:1.5  Tue Jun 12 17:47:47 2001
+++ gnue/geas/src/objectstore/postgresql.c      Tue Jun 12 20:33:03 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: postgresql.c,v 1.5 2001/06/13 00:47:47 treshna Exp $
+   $Id: postgresql.c,v 1.6 2001/06/13 03:33:03 treshna Exp $
 */
 
 #include "config.h"
@@ -309,6 +309,7 @@
   c = odl_find_class (all_classes, oql_query_get_classname (query), NULL);
 retry:
   tries++;
+/* printf( "[%s]\n" , oql_query_as_sql(query,dbtype) ); */
   res = PQexec (conn->handle, oql_query_as_sql (query, dbtype));
   PQerrorcode = PQresultStatus (res);
 #if 0
Index: gnue/geas/src/oql/oql.c
diff -u gnue/geas/src/oql/oql.c:1.61 gnue/geas/src/oql/oql.c:1.62
--- gnue/geas/src/oql/oql.c:1.61        Sat Jun  9 06:17:37 2001
+++ gnue/geas/src/oql/oql.c     Tue Jun 12 20:33:03 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: oql.c,v 1.61 2001/06/09 13:17:37 reinhard Exp $
+  $Id: oql.c,v 1.62 2001/06/13 03:33:03 treshna Exp $
 */
 
 #include "config.h"
@@ -924,6 +924,7 @@
 
   while (l)
     {
+    /* printf( "'%s' = '%s' ?\n" , fieldname , (char *)l->data  ); */
       if (g_strcasecmp (fieldname, (char *) l->data) == 0)
         {
           return (n);



reply via email to

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