Phpxforms documentation

BackupDb
in package

Simple database export to sql

Tags
author

DaVee

version
0.87dev
license

Lesser General Public License 2.1 or later; see http://www.gnu.org/licenses/lgpl-2.1.html

Table of Contents

Constants

VERSION  = 0.87

Properties

$maxRows  : int
$db  : PDO
$enableBuffer  : bool
$procedures  : bool
$tables  : array<string, bool>

Methods

__construct()  : mixed
create()  : string|void
Export selected tables to sql format
getTables()  : array<string, bool>
Get list of tables to export
setTable()  : void
Add table to export
setTables()  : void
Set list of tables to export
disableBuffer()  : void
Disable buffer for mysql to lower memory consumption
enableBuffer()  : void
Re-enable disabled buffer
exportData()  : void
Start exporting data from database
getEscapeRules()  : array<int, bool>
Get which values should be escaped based on table columns
getProcedures()  : string
Get database functions and procedures
loadTables()  : void
Load list of tables with selected prefix
printData()  : void
Export data from table
useCompression()  : string
Compress content

Constants

Properties

$maxRows

public static int $maxRows = 1000

Number of rows in one insert

$enableBuffer

protected bool $enableBuffer = false

$tables

protected array<string, bool> $tables = []

Methods

__construct()

public __construct(PDO $db[, string|null $loadPrefix = '' ][, bool $procedures = true ]) : mixed
Parameters
$db : PDO
$loadPrefix : string|null = ''

Null for disable table load -> insert tables manually

$procedures : bool = true

create()

Export selected tables to sql format

public create([string|null $fileName = null ][, bool $compress = false ]) : string|void
Parameters
$fileName : string|null = null

export as downloadable file or return as string

$compress : bool = false

should be output compressed (gzip)

Return values
string|void

getTables()

Get list of tables to export

public getTables() : array<string, bool>
Return values
array<string, bool>

setTable()

Add table to export

public setTable(string $table[, bool $data = true ]) : void
Parameters
$table : string

table name

$data : bool = true

should export table data

setTables()

Set list of tables to export

public setTables(array<string, bool> $tables) : void
Parameters
$tables : array<string, bool>
Tags
throws
InvalidArgumentException

disableBuffer()

Disable buffer for mysql to lower memory consumption

protected disableBuffer() : void

enableBuffer()

Re-enable disabled buffer

protected enableBuffer() : void

exportData()

Start exporting data from database

protected exportData() : void

getEscapeRules()

Get which values should be escaped based on table columns

protected getEscapeRules(string $table) : array<int, bool>
Parameters
$table : string
Return values
array<int, bool>

getProcedures()

Get database functions and procedures

protected getProcedures(string $database) : string
Parameters
$database : string
Return values
string

loadTables()

Load list of tables with selected prefix

protected loadTables(string $prefix) : void
Parameters
$prefix : string

printData()

Export data from table

protected printData(string $table) : void
Parameters
$table : string

useCompression()

Compress content

protected useCompression(string $string) : string
Parameters
$string : string
Return values
string

        
On this page

Search results