--- Rast.xs.orig	Thu May 12 16:35:53 2005
+++ Rast.xs	Thu May 12 15:50:36 2005
@@ -505,9 +505,12 @@
     SV *self;
     PREINIT:
         RAST_DB_STATE *db_state = (RAST_DB_STATE *) get_rast_state_hv(self);
+        int num_properties;
+        const rast_property_t *rast_properties;
     CODE:
         if (db_state->pool != NULL) {
-            RETVAL = db_state->db->num_properties;
+            rast_properties = rast_db_properties(db_state->db, &num_properties);
+            RETVAL = num_properties;
         } else {
             RETVAL = 0;
         }
@@ -521,11 +524,15 @@
     PREINIT:
         RAST_DB_STATE *db_state = (RAST_DB_STATE *) get_rast_state_hv(self);
         I32 req = SvIV(num);
+        int num_properties;
+        const rast_property_t *rast_properties;
     CODE:
         RETVAL = 0;
         if (db_state->pool != NULL) {
-            if (db_state->db->num_properties > req) {
-                RETVAL = db_state->db->properties[req].type;
+            rast_properties = rast_db_properties(db_state->db, &num_properties);
+            if (num_properties > req) {
+                const rast_property_t *property = rast_properties + req;
+                RETVAL = property->type;
             }
         }
     OUTPUT:
@@ -570,20 +577,27 @@
         AV *properties_av;
         apr_pool_t *pool;
         I32 i;
+        int num_properties;
+        const rast_property_t *rast_properties;
     CODE:
         properties_av = (AV *) SvRV(properties);
 
         apr_pool_create(&pool, db_state->pool);
 
         properties_value = (rast_value_t *) apr_palloc(pool, sizeof(rast_value_t) * (av_len(properties_av) + 1));
+        rast_properties = rast_db_properties(db_state->db, &num_properties);
+        
         for (i = 0;i <=  av_len(properties_av);i++) {
+            
+            const rast_property_t *property = rast_properties + i;
             SV **entp;
             entp = av_fetch(properties_av, i, 0);
-            if (db_state->db->properties[i].type == RAST_TYPE_STRING) {
+            
+            if (property->type == RAST_TYPE_STRING) {
                 rast_value_set_string(&properties_value[i], SvPV(*entp, len));
-            } else if (db_state->db->properties[i].type == RAST_TYPE_DATE) {
+            } else if (property->type == RAST_TYPE_DATE) {
                 rast_value_set_date(&properties_value[i], SvPV(*entp, len));
-            } else if (db_state->db->properties[i].type == RAST_TYPE_UINT) {
+            } else if (property->type == RAST_TYPE_UINT) {
                 rast_value_set_uint(&properties_value[i], SvIV(*entp));
             }
         }

