Welcome Guest, Not a member yet? Register   Sign In
partial database downloads
#1

[eluser]matt2012[/eluser]
I would like to use the database utility functions to download a partial
backup of a database.

Basically downloading everything from a table where column x = 'foo'

is this possible or does it do whole tables only?

If this isnt possible can anyone direct me to a script that makes this possible?


Code:
//$this->dbutil->backup()
#2

[eluser]Phil Sturgeon[/eluser]
That function in itself will only match whole tables. You could easily make a script to do backups in CSV or XML by doing something like:

Code:
$this->db->where('foo', $bar);
$query = $this->db->get('Donkeys');

$file_content = $this->dbutil->csv_from_result($query, ",", "\n");

$this->load->helper('file');
write_file(BASEPATH.'/backups/backup'.date('m').'-'.date('y'), $file_contents);

That all make sense? phpMyAdmin can easily read the backups from CSV... if I remember correctly :p




Theme © iAndrew 2016 - Forum software by © MyBB