error on update of multiple records

A place for users and developers of the Xataface to discuss and receive support.

error on update of multiple records

Postby ststoddard » Tue Nov 03, 2009 11:39 am

I am trying to do updates of multiple records, first and edit and then a remove operation (yes I have permissions set correctly). Normally this works (most tables). This time, however, I got the following error:

Fatal error: Uncaught exception 'Exception' with message 'Table 'dataface__mtimes' already exists' in /var/www/private/xataface-1.2.2/Dataface/IO.php:2365 Stack trace: #0 /var/www/private/xataface-1.2.2/Dataface/IO.php(2372): Dataface_IO::createModificationTimesTable() #1 /var/www/private/xataface-1.2.2/Dataface/IO.php(686): Dataface_IO::touchTable('Participants') #2 /var/www/private/xataface-1.2.2/dataface-public-api.php(404): Dataface_IO->write(Object(Dataface_Record), Array, NULL, false) #3 /var/www/private/xataface-1.2.2/Dataface/Record.php(2645): df_save_record(Object(Dataface_Record), Array, 'es', false) #4 /var/www/private/xataface-1.2.2/actions/copy_replace.php(295): Dataface_Record->save() #5 [internal function]: dataface_actions_copy_replace->process(Array) #6 /var/www/private/xataface-1.2.2/lib/HTML/QuickForm.php(1626): call_user_func(Array, Array) #7 /var/www/private/xataface-1.2.2/actions/copy_replace.php(114): HTML_QuickForm->process(Array, true) #8 /var/www/private/xataface-1.2.2/Dataface/Application.php(11 in /var/www/private/xataface-1.2.2/Dataface/IO.php on line 2365


This probably has something to do with my configuration, but I can't tell from the error where I would look for a solution. Any ideas?

Thanks.
S. T. Stoddard
ststoddard
 
Posts: 56
Joined: Mon Nov 05, 2007 4:10 pm
Location: Davis, CA

Postby ststoddard » Tue Nov 03, 2009 11:45 am

Just a quick update. The update operation (on 4 records) worked on the first record (deleted it) but not the subsequent 3.
S. T. Stoddard
ststoddard
 
Posts: 56
Joined: Mon Nov 05, 2007 4:10 pm
Location: Davis, CA

Postby shannah » Tue Nov 03, 2009 5:59 pm

On line 2372 of Dataface/IO.php, please make the following modification:
Change the touchTable() function to look like:
Code: Select all
static function touchTable($table){
      $sql = "replace into dataface__mtimes (`name`,`mtime`) values ('".addslashes($table)."','".addslashes(time())."')";
      $res = mysql_query($sql, df_db());
      if ( !$res ){
         try {
            self::createModificationTimesTable();
         } catch ( $e ){
         
         }
         $res = mysql_query($sql, df_db());
         if ( !$res ) throw new Exception(mysql_error(df_db()));
      }
   }
   


This should report the real error.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby ststoddard » Thu Nov 05, 2009 12:54 pm

This is what worked:
Code: Select all
static function touchTable($table){
      $sql = "replace into dataface__mtimes (`name`,`mtime`) values('".addslashes($table)."','".addslashes(time())."')";
      $res = mysql_query($sql, df_db());
      if ( !$res ){
         try {
            self::createModificationTimesTable();
         } catch (Exception $e) {
         echo 'Caught exception: ', $e->getMessage(), "\n";
         
         }
      $res = mysql_query($sql, df_db());
      if ( !$res ) throw new Exception(mysql_error(df_db()));
      }
   }


And it confirmed the issue was with my configuration.

This use of the database by xataface, i.e. creating tables and views, is new... Is this going to cause issues where I have 3 peer to peer replication servers?
S. T. Stoddard
ststoddard
 
Posts: 56
Joined: Mon Nov 05, 2007 4:10 pm
Location: Davis, CA

Postby shannah » Thu Nov 05, 2009 1:16 pm

What about your configuration gave it problems?
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby ststoddard » Thu Nov 12, 2009 3:23 pm

I was in the process of setting up a new mirror of my db and needed a temporary way to prevent data entry on one, so I removed insert privileges for the dataface user. Previously dataface didn't write to the database so much, now it does (I think?). That killed the update.
S. T. Stoddard
ststoddard
 
Posts: 56
Joined: Mon Nov 05, 2007 4:10 pm
Location: Davis, CA


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 10 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved