Transfer BLOB between tables

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

Transfer BLOB between tables

Postby Gershy » Mon Nov 26, 2012 1:10 pm

Hey everyone, my database has a table called Member and a table called Member_Pending. Users my try to sign up to achieve Member status by signing up to the Member_Pending table. This works fine. I've implemented an action that works on checked fields in the Member_Pending table to an admin can select whichever records he/she approves, and then click a "Transfer" button which takes those records from the Member_Pending table and puts them in the Member table.

Everything works fine, except there are two BLOB fields in the Member_Pending table that don't get transferred even though all other information is transferred properly.

Can anyone help me out with getting the BLOB fields to transfer?

The transfer looks like this right now:

Code: Select all
$app =& Dataface_Application::getInstance();
$query =& $app->getQuery();
$records =& df_get_selected_records($query);
   
$transferred = 0;
$errs = array();
      
foreach ($records as $rec){
   $transf = new Dataface_Record('Member', array());

   $transf->setValues(array(
   'Member_Name' =>             $rec->val('New_Member_FName'),
   'Last_Name' =>                $rec->val('New_Member_LName'),
   
   //Transfer all information, etc...

   //Now transfer PDFs
   'PDFBlob1' =>                $rec->val('PDFBlob1'),
   'PDFBlob2' =>                $rec->val('PDFBlob2')
   ));
}



Everything works except for the lines which link PDFBlob 1 and 2 in the new record to PDFBlob1 and 2 in the pending record.
Gershy
 
Posts: 25
Joined: Wed Nov 14, 2012 12:28 pm

Re: Transfer BLOB between tables

Postby shannah » Fri Nov 30, 2012 4:40 am

For efficiency, blob fields aren't loaded into Dataface_Record objects by default. It is best to issue direct SQL commands for copying these values. It is also best to not have to load the values into memory as this is limited (larger files would cause memory errors).

-Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Transfer BLOB between tables

Postby Gershy » Mon Dec 03, 2012 1:51 pm

Alright, I'll implement it with direct mysql then. Thanks very much.
Gershy
 
Posts: 25
Joined: Wed Nov 14, 2012 12:28 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 35 guests

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