Page 1 of 1

Transfer BLOB between tables

PostPosted: Mon Nov 26, 2012 1:10 pm
by Gershy
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.

Re: Transfer BLOB between tables

PostPosted: Fri Nov 30, 2012 4:40 am
by shannah
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

Re: Transfer BLOB between tables

PostPosted: Mon Dec 03, 2012 1:51 pm
by Gershy
Alright, I'll implement it with direct mysql then. Thanks very much.