.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "PGObject::Util::DBAdmin 3pm" .TH PGObject::Util::DBAdmin 3pm "2016-12-18" "perl v5.24.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" PGObject::Util::DBAdmin \- PostgreSQL Database Management Facilities for PGObject .SH "VERSION" .IX Header "VERSION" Version 0.100.0 .SH "SYNOPSIS" .IX Header "SYNOPSIS" This module provides an interface to the basic Postgres db manipulation utilities. .PP .Vb 7 \& my $db = PGObject::Util::DBAdmin\->new( \& username => \*(Aqpostgres\*(Aq, \& password => \*(Aqmypassword\*(Aq, \& host => \*(Aqlocalhost\*(Aq, \& port => \*(Aq5432\*(Aq, \& dbname => \*(Aqmydb\*(Aq \& ); \& \& my @dbnames = $db\->list_dbs(); # like psql \-l \& \& $db\->create(); # createdb \& $db\->run_file(file => \*(Aqsql/initial_schema.sql\*(Aq); # psql \-f \& \& my $filename = $db\->backup(format => \*(Aqc\*(Aq); # pg_dump \-Fc \& \& my $db2 = PGObject::Util::DBAdmin\->new($db\->export, (dbname => \*(Aqotherdb\*(Aq)); .Ve .SH "PROPERTIES" .IX Header "PROPERTIES" .SS "username" .IX Subsection "username" .SS "password" .IX Subsection "password" .SS "host" .IX Subsection "host" In PostgreSQL, this can refer to the hostname or the absolute path to the directory where the \s-1UNIX\s0 sockets are set up. .SS "port" .IX Subsection "port" Default '5432' .SS "dbname" .IX Subsection "dbname" .SH "SUBROUTINES/METHODS" .IX Header "SUBROUTINES/METHODS" .SS "new" .IX Subsection "new" Creates a new db admin object for manipulating databases. .SS "export" .IX Subsection "export" Exports the database parameters in a hash so it can be used to create another pbject. .SS "connect($options)" .IX Subsection "connect($options)" Connects to the db using \s-1DBI\s0 and returns a db connection; allows specification of options in the \f(CW$options\fR hashref. .SS "server_version" .IX Subsection "server_version" returns a version string (like 9.1.4) for PostgreSQL .SS "list_dbs" .IX Subsection "list_dbs" Returns a list of db names. .SS "create" .IX Subsection "create" Creates a new db. Dies if there is an error. .PP Supported arguments: .IP "copy_of" 4 .IX Item "copy_of" Creates the db as a copy of the one of that name. Default is unspecified. .SS "run_file" .IX Subsection "run_file" Run the specified file on the db. Accepted parameters are: .IP "file" 4 .IX Item "file" Path to file to be run .IP "log" 4 .IX Item "log" Path to combined stderr/stdout log. If specified, do not specify other logs as this is unsupported. .IP "errlog" 4 .IX Item "errlog" Path to error log to store stderr output .IP "stdout_log" 4 .IX Item "stdout_log" Path to where to log standard output .IP "continue_on_error" 4 .IX Item "continue_on_error" If set, does not die on error. .SS "backup" .IX Subsection "backup" Takes a backup and delivers the temporary file name to the handler. .PP Accepted parameters include: .IP "format" 4 .IX Item "format" The specified format, for example c for custom. Defaults to plain text .IP "tempdir" 4 .IX Item "tempdir" The directory to store temp files in. Defaults to \f(CW$ENV\fR{\s-1TEMP\s0} if set and \&'/tmp/' if not. .PP Returns the file name of the tempfile. .SS "backup_globals" .IX Subsection "backup_globals" This creates a plain text dump of global (inter-db) objects, such as users and tablespaces. It uses pg_dumpall to do this. .PP Options include: .IP "file" 4 .IX Item "file" File name in the path. .IP "tempdir" 4 .IX Item "tempdir" The directory to store temp files in. Defaults to \f(CW$ENV\fR{\s-1TEMP\s0} if set and \&'/tmp/' if not. .PP Being a plain text file, it can be run using the run_file api. .SS "restore" .IX Subsection "restore" Restores from a saved file. Must pass in the file name as a named argument. .PP Recognized arguments are: .IP "file" 4 .IX Item "file" Path to file .IP "format" 4 .IX Item "format" The specified format, for example c for custom. Defaults to plain text .IP "log" 4 .IX Item "log" Path to combined stderr/stdout log. If specified, do not specify other logs as this is unsupported. .IP "errlog" 4 .IX Item "errlog" Path to error log to store stderr output .IP "stdout_log" 4 .IX Item "stdout_log" Path to where to log standard output .SS "drop" .IX Subsection "drop" Drops the database. This is not recoverable. .SH "AUTHOR" .IX Header "AUTHOR" Chris Travers, \f(CW\*(C`\*(C'\fR .SH "BUGS" .IX Header "BUGS" Please report any bugs or feature requests to \f(CW\*(C`bug\-pgobject\-util\-dbadmin at rt.cpan.org\*(C'\fR, or through the web interface at . I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. .SH "SUPPORT" .IX Header "SUPPORT" You can find documentation for this module with the perldoc command. .PP .Vb 1 \& perldoc PGObject::Util::DBAdmin .Ve .PP You can also look for information at: .IP "\(bu" 4 \&\s-1RT: CPAN\s0's request tracker (report bugs here) .Sp .IP "\(bu" 4 AnnoCPAN: Annotated \s-1CPAN\s0 documentation .Sp .IP "\(bu" 4 \&\s-1CPAN\s0 Ratings .Sp .IP "\(bu" 4 Search \s-1CPAN\s0 .Sp .SH "ACKNOWLEDGEMENTS" .IX Header "ACKNOWLEDGEMENTS" .SH "LICENSE AND COPYRIGHT" .IX Header "LICENSE AND COPYRIGHT" Copyright 2014\-2016 Chris Travers. .PP This program is distributed under the (Revised) \s-1BSD\s0 License: .PP Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: .PP * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. .PP * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. .PP * Neither the name of Chris Travers's Organization nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. .PP \&\s-1THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \&\*(L"AS IS\*(R" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES \s0(\s-1INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES\s0; \s-1LOSS OF USE, DATA, OR PROFITS\s0; \s-1OR BUSINESS INTERRUPTION\s0) \s-1HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \&\s0(\s-1INCLUDING NEGLIGENCE OR OTHERWISE\s0) \s-1ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\s0