Utils
extends BaseUtils
in package
Utils for Postgre
Table of Contents
Properties
- $db : object
- Database object
- $listDatabases : string
- List databases statement
- $optimizeTable : string
- OPTIMIZE TABLE statement
- $repairTable : bool|string
- REPAIR TABLE statement
Methods
- __construct() : mixed
- Class constructor
- _backup() : never
- Platform dependent version of the backup function.
- backup() : false|never|string
- Database Backup
- databaseExists() : bool
- Determine if a particular database exists
- getCSVFromResult() : string
- Generate CSV from a query result object
- getXMLFromResult() : string
- Generate XML data from a query result object
- listDatabases() : array<string|int, mixed>|bool
- List databases
- optimizeDatabase() : mixed
- Optimize Database
- optimizeTable() : bool
- Optimize Table
- repairTable() : mixed
- Repair Table
Properties
$db
Database object
protected
object
$db
$listDatabases
List databases statement
protected
string
$listDatabases
= 'SELECT datname FROM pg_database'
$optimizeTable
OPTIMIZE TABLE statement
protected
string
$optimizeTable
= 'REINDEX TABLE %s'
$repairTable
REPAIR TABLE statement
protected
bool|string
$repairTable
= false
Methods
__construct()
Class constructor
public
__construct(ConnectionInterface $db) : mixed
Parameters
- $db : ConnectionInterface
_backup()
Platform dependent version of the backup function.
public
_backup([array<string|int, mixed>|null $prefs = null ]) : never
Parameters
- $prefs : array<string|int, mixed>|null = null
Return values
neverbackup()
Database Backup
public
backup([array<string|int, mixed>|string $params = [] ]) : false|never|string
Parameters
- $params : array<string|int, mixed>|string = []
Tags
Return values
false|never|stringdatabaseExists()
Determine if a particular database exists
public
databaseExists(string $databaseName) : bool
Parameters
- $databaseName : string
Return values
boolgetCSVFromResult()
Generate CSV from a query result object
public
getCSVFromResult(ResultInterface $query[, string $delim = ',' ][, string $newline = "
" ][, string $enclosure = '"' ]) : string
Parameters
- $query : ResultInterface
- $delim : string = ','
- $newline : string = " "
- $enclosure : string = '"'
Return values
stringgetXMLFromResult()
Generate XML data from a query result object
public
getXMLFromResult(ResultInterface $query[, array<string|int, mixed> $params = [] ]) : string
Parameters
- $query : ResultInterface
- $params : array<string|int, mixed> = []
Return values
stringlistDatabases()
List databases
public
listDatabases() : array<string|int, mixed>|bool
Tags
Return values
array<string|int, mixed>|booloptimizeDatabase()
Optimize Database
public
optimizeDatabase() : mixed
Tags
optimizeTable()
Optimize Table
public
optimizeTable(string $tableName) : bool
Parameters
- $tableName : string
Tags
Return values
boolrepairTable()
Repair Table
public
repairTable(string $tableName) : mixed
Parameters
- $tableName : string