LedgerSMB::Database
Provides the APIs for database creation and management.
- Provided by: ledgersmb (Version: 1.3.46-1)
- Report a bug
Provides the APIs for database creation and management.
This module provides the APIs for database creation and management
This module is copyright (C) 2007, the LedgerSMB Core Team and subject to the GNU General Public License (GPL) version 2, or at your option, any later version. See the COPYRIGHT and LICENSE files for more information.
As some countries may have multiple available charts, you can also specify a chart name as well.
Note that the arguments can be any hashref. If it is a LedgerSMB object, however, it will attempt to copy all attributes beginning with _ into the current object (_user, _locale, etc).
The file is named roles_[date].sql by default where the date is in yyyy-mm-dd format.
It returns the full path of the resulting backup file on success, or undef on failure.
The resulting file is named backup_[dbname]_[date].bak with the date in yyyy-mm-dd format.
It returns the full path of the resulting backup file on success, or undef on failure.
It is worth noting that this is designed to be informative and helpful in determining whether automatic upgrades can in fact occur or other administrative tasks can be run. Sample output might be:
{ appname => undef,
version => undef, full_version => undef,
status => 'does not exist'}
or
{ appname => 'sql-ledger',
version => '2.8', full_version => '2.8.33',
status => 'exists'}
or
{ appname => 'ledgersmb',
version => '1.2' fullversion => '1.2.0',
status => 'exists' }
It goes without saying that status will always equal 'exists' if appname is set. However the converse is not true. If the status is 'exists' and appname is not set, this merely means that the database exists but is not used by a recognized application. So administrative functions are advised to check both the appname and status values.
Finally, it is important to note that LedgerSMB 1.1 and prior, and SQL-Ledger 2.6.x and prior are lumped under appname => 'ledgersmb' and version => 'legacy', though the fullversion may give you an idea of what the actual version is run.
Returns a list of strings of db names.
Returns true if successful, false of not. Creates a log called dblog in the temporary directory with all the output from the psql files.
In DEBUG mode, will show all lines to STDERR. In ERROR logging mode, will display only those lines containing the word ERROR.
TODO