Class: DB_Sqlite_Tools
Source Location: /DB_Sqlite_Tools-0.1.7/DB/Sqlite/Tools.php
Class to manage sqlite database. An object-oriented interface to sqlite integrity check, optimizations and backup and export. It curently supports pragma integrity checks, cache values to optimize performance, synchronisation values for an higher integrity protection.
Author(s):
Version:
Copyright:
- Copyright (c) 2004-2006 David Costa
|
|
|
Inherited Variables
|
Inherited Methods
|
Class Details
Class Variables
Method Detail
cacheSize [line 366]
true cacheSize(
[int
$pages = false])
|
|
Check or set the cacheSize of the database. As a default value an sqlite database will hold 2000 disk pages in the memory each page requires approximately 1.5 K of memory. For intensive UPDATE or DELETE queries an higher memory might result in a speed increase. If pages parameter is not defined it will return the current cache size of the database or the multiple databases if $this->database is an array with more then one element If a valid integer is passed as $pages parameter it will set the cache size for the database or for multiple database if $this->database is an array with more then one element If defined it will set the new cache size (in pages) as per the specified integer. Note: When setting a new cache size. It might get a query error if on the database or one of the databases doesn't have the relevant write permissions. Please set the necessary permissions on the database/databases before attemping to change their cache value.
Parameters:
checkIntegrity [line 314]
Checks the database integrity does an integrity check of the entire database including malformed records, corrupted pages out of order records, invalid indeces returns okay on success or the error details, if multiple is true the the value for $database in the constructor is expected to be an array with a list of databases.
copySafe [line 517]
void copySafe(
[string
$path = ''])
|
|
Safely duplicates a database file. copySafe should be performed before a backup as transfering via ftp or rsync. With this function we obtain an exclusive lock on the database before the copy, we then check the integrity of the copied databases. if the integrity check on the copied database returns OK this means that we have a cloned database ready for backup purposes. Individual or multiple databases are duplicated with the same name of the original database and the suffix .bkp
Parameters:
createDBFromXML [line 1084]
void createDBFromXML(
string
$xmlFile, string
$db)
|
|
Converts an XML exported database back to an Sqlite database
Parameters:
createXMLDumps [line 1045]
true createXMLDumps(
[
$path = ''])
|
|
For each of the databases in our contructor array creates an XML dump including all the tables of that database. The XML file is generated via the function performXMLDump The backup file is by default the database name .xml
Parameters:
dbFileInfo [line 455]
Retrieve general information on the database files like filename, owner id, group, name, permissions, library encoding and version, the size of the database, last time it was modified, blocks and generally every possible information on the database files.
__construct (Constructor) [line 273]
return __construct(
string
$database)
|
|
Instantiate a new SQLite_Tools Object Expects a db location or an array of db locations for multiple checks
Parameters:
ftpBackup [line 613]
true ftpBackup(
string
$server, string
$username, string
$password, [string
$path = ''])
|
|
Safely copy the backup db to a remote ftp server. this function can be called only after a copySafe operation is performed. It will backup every database in the backup dir which is set with copySafe. If the intended use is to backup different group of databases the user can simply set a different path for copySafe.
Parameters:
localBackup [line 675]
void localBackup(
string
$destination)
|
|
Creates a local backup of the database file and checks for its integrity.
Parameters:
localRsync [line 725]
void localRsync(
string
$databasesPath, string
$backupsPath, [string
$options = '--verbose --stats --recursive --progress --delete'])
|
|
Initiaties a local rsync of a given database path requires rsync installed locally.
Parameters:
remoteRsync [line 760]
void remoteRsync(
sting
$databasesPath, string
$configfile, string
$configfilepath, string
$uid, string
$gid, string
$allowedhost, string
$logs, string
$secretfile)
|
|
remoteRsync prepared the server where this package is running to receive read connections over rsync for the purpose of remote synchronisation. it created a valid rsync configuration file and starts the deamon allowing connection from the allowed host. This function is experimental.
Parameters:
sqliteLogs [line 838]
void sqliteLogs(
[string
$db = ''], [string
$maketable = true], [string
$table = ''])
|
|
Logs all the perfomed action in a database log this includes backups, integrity checks each of the integrity queries. Verbose XML style output for each of the actions. Sample log output - <logevent> <class>DB_Sqlite_Tools</class> <function>cacheSize</function> <data> 'cache correctly reset to 10000' </data> </logevent> All the logs are saved with the time of execution. The user can easily generate customized logs from the raw data provided in this package.
Parameters:
sync [line 417]
true sync(
[sting
$value = false])
|
|
Check or set the synchronous value for the database. Sqlite provides with different synchronous modes. The synchronous level determines the integrity protection. At NORMAL (default mode) the sqlite engine will stop at most critical moment providing with a limited integrity protection of the database. In FULL mode the engine will stop more often thus ensuring and higher integrity level. When OFF the engine will continue as soon as the new data is provided without stopping. Values are represented by an integer, 1 for NORMAL, 2 for FULL and 0 for off. If the parameter value is not set it will return the current default syncronous for the databases. If value is set with either FULL, NORMAL or OFF it will change the default syncronous value for each of the databases.
Parameters:
XMLDecode [line 947]
string XMLDecode(
string
$str)
|
|
Decodes the XML content.
Parameters:
XMLEncode [line 962]
string XMLEncode(
string
$str)
|
|
Encodes the XML content.
Parameters:
Documentation generated on Mon, 11 Mar 2019 15:39:04 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|
|