.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" 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 "CPANDB 3pm" .TH CPANDB 3pm "2018-04-15" "perl v5.26.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" CPANDB \- A unified database of CPAN metadata information .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fB\s-1CPANDB\s0\fR is an module for accessing \s-1CPAN\s0 metadata merged from many different \&\s-1CPAN\s0 websites into a single object model, downloaded automatically and without the need for any configuration. .SH "METHODS" .IX Header "METHODS" .SS "dsn" .IX Subsection "dsn" .Vb 1 \& my $string = CPANDB\->dsn; .Ve .PP The \f(CW\*(C`dsn\*(C'\fR accessor returns the \s-1DBI\s0 connection string used to connect to the SQLite database as a string. .SS "dbh" .IX Subsection "dbh" .Vb 1 \& my $handle = CPANDB\->dbh; .Ve .PP To reliably prevent potential SQLite deadlocks resulting from multiple connections in a single process, each ORLite package will only ever maintain a single connection to the database. .PP During a transaction, this will be the same (cached) database handle. .PP Although in most situations you should not need a direct \s-1DBI\s0 connection handle, the \f(CW\*(C`dbh\*(C'\fR method provides a method for getting a direct connection in a way that is compatible with connection management in ORLite. .PP Please note that these connections should be short-lived, you should never hold onto a connection beyond your immediate scope. .PP The transaction system in ORLite is specifically designed so that code using the database should never have to know whether or not it is in a transation. .PP Because of this, you should \fBnever\fR call the \->disconnect method on the database handles yourself, as the handle may be that of a currently running transaction. .PP Further, you should do your own transaction management on a handle provided by the method. .PP In cases where there are extreme needs, and you \fBabsolutely\fR have to violate these connection handling rules, you should create your own completely manual \s-1DBI\-\s0>connect call to the database, using the connect string provided by the \f(CW\*(C`dsn\*(C'\fR method. .PP The \f(CW\*(C`dbh\*(C'\fR method returns a DBI::db object, or throws an exception on error. .SS "begin" .IX Subsection "begin" .Vb 1 \& CPANDB\->begin; .Ve .PP The \f(CW\*(C`begin\*(C'\fR method indicates the start of a transaction. .PP In the same way that ORLite allows only a single connection, likewise it allows only a single application-wide transaction. .PP No indication is given as to whether you are currently in a transaction or not, all code should be written neutrally so that it works either way or doesn't need to care. .PP Returns true or throws an exception on error. .SS "rollback" .IX Subsection "rollback" The \f(CW\*(C`rollback\*(C'\fR method rolls back the current transaction. If called outside of a current transaction, it is accepted and treated as a null operation. .PP Once the rollback has been completed, the database connection falls back into auto-commit state. If you wish to immediately start another transaction, you will need to issue a separate \->begin call. .PP If a transaction exists at END-time as the process exits, it will be automatically rolled back. .PP Returns true or throws an exception on error. .SS "do" .IX Subsection "do" .Vb 5 \& CPANDB\->do( \& \*(Aqinsert into table ( foo, bar ) values ( ?, ? )\*(Aq, {}, \& \e$foo_value, \& \e$bar_value, \& ); .Ve .PP The \f(CW\*(C`do\*(C'\fR method is a direct wrapper around the equivalent \s-1DBI\s0 method, but applied to the appropriate locally-provided connection or transaction. .PP It takes the same parameters and has the same return values and error behaviour. .SS "selectall_arrayref" .IX Subsection "selectall_arrayref" The \f(CW\*(C`selectall_arrayref\*(C'\fR method is a direct wrapper around the equivalent \&\s-1DBI\s0 method, but applied to the appropriate locally-provided connection or transaction. .PP It takes the same parameters and has the same return values and error behaviour. .SS "selectall_hashref" .IX Subsection "selectall_hashref" The \f(CW\*(C`selectall_hashref\*(C'\fR method is a direct wrapper around the equivalent \&\s-1DBI\s0 method, but applied to the appropriate locally-provided connection or transaction. .PP It takes the same parameters and has the same return values and error behaviour. .SS "selectcol_arrayref" .IX Subsection "selectcol_arrayref" The \f(CW\*(C`selectcol_arrayref\*(C'\fR method is a direct wrapper around the equivalent \&\s-1DBI\s0 method, but applied to the appropriate locally-provided connection or transaction. .PP It takes the same parameters and has the same return values and error behaviour. .SS "selectrow_array" .IX Subsection "selectrow_array" The \f(CW\*(C`selectrow_array\*(C'\fR method is a direct wrapper around the equivalent \&\s-1DBI\s0 method, but applied to the appropriate locally-provided connection or transaction. .PP It takes the same parameters and has the same return values and error behaviour. .SS "selectrow_arrayref" .IX Subsection "selectrow_arrayref" The \f(CW\*(C`selectrow_arrayref\*(C'\fR method is a direct wrapper around the equivalent \&\s-1DBI\s0 method, but applied to the appropriate locally-provided connection or transaction. .PP It takes the same parameters and has the same return values and error behaviour. .SS "selectrow_hashref" .IX Subsection "selectrow_hashref" The \f(CW\*(C`selectrow_hashref\*(C'\fR method is a direct wrapper around the equivalent \&\s-1DBI\s0 method, but applied to the appropriate locally-provided connection or transaction. .PP It takes the same parameters and has the same return values and error behaviour. .SS "prepare" .IX Subsection "prepare" The \f(CW\*(C`prepare\*(C'\fR method is a direct wrapper around the equivalent \&\s-1DBI\s0 method, but applied to the appropriate locally-provided connection or transaction .PP It takes the same parameters and has the same return values and error behaviour. .PP In general though, you should try to avoid the use of your own prepared statements if possible, although this is only a recommendation and by no means prohibited. .SS "pragma" .IX Subsection "pragma" .Vb 2 \& # Get the user_version for the schema \& my $version = CPANDB\->pragma(\*(Aquser_version\*(Aq); .Ve .PP The \f(CW\*(C`pragma\*(C'\fR method provides a convenient method for fetching a pragma for a database. See the SQLite documentation for more details. .SH "SUPPORT" .IX Header "SUPPORT" \&\fB\s-1CPANDB\s0\fR is based on ORLite. .PP Documentation created by ORLite::Pod 0.10. .PP Bugs should be reported via the \s-1CPAN\s0 bug tracker at .PP .PP For other issues, contact the author. .SH "AUTHOR" .IX Header "AUTHOR" Adam Kennedy .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright 2009 \- 2012 Adam Kennedy. .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .PP The full text of the license can be found in the \&\s-1LICENSE\s0 file included with this module.