// Get db path
$db = $this->db->getDatabase();
$this->tmpfiles[] = $db;
- OC_Log::write('user-migrate',$db, OC_Log::INFO);
}
}
foreach( $options['matchval'] as $matchval ){
// Run the query for this match value (where x = y value)
- $query = OC_DB::prepare( "SELECT * FROM *PREFIX*" . $options['table'] . " WHERE " . $options['matchcol'] . " LIKE ?" );
+ $sql = "SELECT * FROM *PREFIX*" . $options['table'] . " WHERE " . $options['matchcol'] . " LIKE ?";
+ $query = OC_DB::prepare( $sql );
$results = $query->execute( array( $matchval ) );
$newreturns = $this->insertData( $results, $options );
$return = array_merge( $return, $newreturns );
} else {
// Just get everything
- $query = OC_DB::prepare( "SELECT * FROM *PREFIX*" . $options['table'] );
+ $sql = "SELECT * FROM *PREFIX*" . $options['table'];
+ $query = OC_DB::prepare( $sql );
$results = $query->execute();
$return = $this->insertData( $results, $options );
*/
private function insertData( $data, $options ){
$return = array();
+ // Foreach row of data to insert
while( $row = $data->fetchRow() ){
// Now save all this to the migration.db
foreach($row as $field=>$value){
$return[] = reset($row);
}
}
+ $fields = '';
+ $values = '';
}
return $return;
}