.\" 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 "Rose::DB::SQLite 3pm" .TH Rose::DB::SQLite 3pm "2016-10-13" "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" Rose::DB::SQLite \- SQLite driver class for Rose::DB. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Rose::DB; \& \& Rose::DB\->register_db( \& domain => \*(Aqdevelopment\*(Aq, \& type => \*(Aqmain\*(Aq, \& driver => \*(Aqsqlite\*(Aq, \& database => \*(Aq/path/to/some/file.db\*(Aq, \& ); \& \& \& Rose::DB\->default_domain(\*(Aqdevelopment\*(Aq); \& Rose::DB\->default_type(\*(Aqmain\*(Aq); \& ... \& \& # Set max length of varchar columns used to emulate the array data type \& Rose::DB::SQLite\->max_array_characters(128); \& \& $db = Rose::DB\->new; # $db is really a Rose::DB::SQLite\-derived object \& ... .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Rose::DB blesses objects into a class derived from Rose::DB::SQLite when the driver is \*(L"sqlite\*(R". This mapping of driver names to class names is configurable. See the documentation for Rose::DB's \fInew()\fR and \fIdriver_class()\fR methods for more information. .PP This class cannot be used directly. You must use Rose::DB and let its \fInew()\fR method return an object blessed into the appropriate class for you, according to its \fIdriver_class()\fR mappings. .PP This class supports SQLite version 3 only. See the SQLite web site for more information on the major versions of SQLite: .PP .PP Only the methods that are new or have different behaviors than those in Rose::DB are documented here. See the Rose::DB documentation for the full list of methods. .SH "DATA TYPES" .IX Header "DATA TYPES" SQLite doesn't care what value you pass for a given column, regardless of that column's nominal data type. Rose::DB does care, however. The following data type formats are enforced by Rose::DB::SQLite's parse_* and format_* functions. .PP .Vb 5 \& Type Format \& \-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& DATE YYYY\-MM\-DD \& DATETIME YYYY\-MM\-DD HH:MM::SS \& TIMESTAMP YYYY\-MM\-DD HH:MM::SS.NNNNNNNNN .Ve .SH "CLASS METHODS" .IX Header "CLASS METHODS" .IP "\fBcoerce_autoincrement_to_serial [\s-1BOOL\s0]\fR" 4 .IX Item "coerce_autoincrement_to_serial [BOOL]" Get or set a boolean value that indicates whether or not \*(L"auto-increment\*(R" columns will be considered to have the column type \*(L"serial.\*(R" The default value is true. .Sp This setting comes into play when Rose::DB::Object::Loader is used to auto-create column metadata based on an existing database schema. .IP "\fBmax_array_characters [\s-1INT\s0]\fR" 4 .IX Item "max_array_characters [INT]" Get or set the maximum length of varchar columns used to emulate the array data type. The default value is 255. .Sp SQLite does not have a native \*(L"\s-1ARRAY\*(R"\s0 data type, but it can be emulated using a \*(L"\s-1VARCHAR\*(R"\s0 column and a specially formatted string. The formatting and parsing of this string is handled by the \f(CW\*(C`format_array()\*(C'\fR and \f(CW\*(C`parse_array()\*(C'\fR object methods. The maximum length limit is honored by the \f(CW\*(C`format_array()\*(C'\fR object method. .SH "OBJECT METHODS" .IX Header "OBJECT METHODS" .IP "\fBauto_create [\s-1BOOL\s0]\fR" 4 .IX Item "auto_create [BOOL]" Get or set a boolean value indicating whether or not a new SQLite database should be created if it does not already exist. Defaults to true. .Sp If false, and if the specified database does not exist, then a fatal error will occur when an attempt is made to connect to the database. .IP "\fBsqlite_unicode [\s-1BOOL\s0]\fR" 4 .IX Item "sqlite_unicode [BOOL]" Get or set a boolean value that indicates whether or not Perl's \s-1UTF\-8\s0 flag will be set for all text strings coming out of the database. See the DBD::SQLite documentation for more information. .SS "Value Parsing and Formatting" .IX Subsection "Value Parsing and Formatting" .IP "\fBformat_array \s-1ARRAYREF\s0 | \s-1LIST\s0\fR" 4 .IX Item "format_array ARRAYREF | LIST" Given a reference to an array or a list of values, return a specially formatted string. Undef is returned if \s-1ARRAYREF\s0 points to an empty array or if \s-1LIST\s0 is not passed. The array or list must not contain undefined values. .Sp If the resulting string is longer than \f(CW\*(C`max_array_characters()\*(C'\fR, a fatal error will occur. .IP "\fBparse_array \s-1STRING\s0 | \s-1LIST\s0 | \s-1ARRAYREF\s0\fR" 4 .IX Item "parse_array STRING | LIST | ARRAYREF" Parse \s-1STRING\s0 and return a reference to an array. \s-1STRING\s0 should be formatted according to the SQLite array data type emulation format returned by \f(CW\*(C`format_array()\*(C'\fR. Undef is returned if \s-1STRING\s0 is undefined. .Sp If a \s-1LIST\s0 of more than one item is passed, a reference to an array containing the values in \s-1LIST\s0 is returned. .Sp If a an \s-1ARRAYREF\s0 is passed, it is returned as-is. .IP "\fBparse_date \s-1STRING\s0\fR" 4 .IX Item "parse_date STRING" Parse \s-1STRING\s0 and return a DateTime object. \s-1STRING\s0 should be formatted according to the Informix \*(L"\s-1DATE\*(R"\s0 data type. .Sp If \s-1STRING\s0 is a valid date keyword (according to validate_date_keyword) it is returned unmodified. Returns undef if \s-1STRING\s0 could not be parsed as a valid \*(L"\s-1DATE\*(R"\s0 value. .IP "\fBparse_datetime \s-1STRING\s0\fR" 4 .IX Item "parse_datetime STRING" Parse \s-1STRING\s0 and return a DateTime object. \s-1STRING\s0 should be formatted according to the Informix \*(L"\s-1DATETIME\*(R"\s0 data type. .Sp If \s-1STRING\s0 is a valid datetime keyword (according to validate_datetime_keyword) it is returned unmodified. Returns undef if \s-1STRING\s0 could not be parsed as a valid \*(L"\s-1DATETIME\*(R"\s0 value. .IP "\fBparse_timestamp \s-1STRING\s0\fR" 4 .IX Item "parse_timestamp STRING" Parse \s-1STRING\s0 and return a DateTime object. \s-1STRING\s0 should be formatted according to the Informix \*(L"\s-1DATETIME\*(R"\s0 data type. .Sp If \s-1STRING\s0 is a valid timestamp keyword (according to validate_timestamp_keyword) it is returned unmodified. Returns undef if \s-1STRING\s0 could not be parsed as a valid \*(L"\s-1DATETIME\*(R"\s0 value. .IP "\fBvalidate_date_keyword \s-1STRING\s0\fR" 4 .IX Item "validate_date_keyword STRING" Returns true if \s-1STRING\s0 is a valid keyword for the \*(L"date\*(R" data type. Valid date keywords are: .Sp .Vb 1 \& current_timestamp .Ve .Sp The keywords are not case sensitive. Any string that looks like a function call (matches /^\ew+\e(.*\e)$/) is also considered a valid date keyword if keyword_function_calls is true. .IP "\fBvalidate_datetime_keyword \s-1STRING\s0\fR" 4 .IX Item "validate_datetime_keyword STRING" Returns true if \s-1STRING\s0 is a valid keyword for the \*(L"datetime\*(R" data type, false otherwise. Valid datetime keywords are: .Sp .Vb 1 \& current_timestamp .Ve .Sp The keywords are not case sensitive. Any string that looks like a function call (matches /^\ew+\e(.*\e)$/) is also considered a valid datetime keyword if keyword_function_calls is true. .IP "\fBvalidate_timestamp_keyword \s-1STRING\s0\fR" 4 .IX Item "validate_timestamp_keyword STRING" Returns true if \s-1STRING\s0 is a valid keyword for the \*(L"timestamp\*(R" data type, false otherwise. Valid timestamp keywords are: .Sp .Vb 1 \& current_timestamp .Ve .Sp The keywords are not case sensitive. Any string that looks like a function call (matches /^\ew+\e(.*\e)$/) is also considered a valid timestamp keyword if keyword_function_calls is true. .SH "AUTHOR" .IX Header "AUTHOR" John C. Siracusa (siracusa@gmail.com) .SH "LICENSE" .IX Header "LICENSE" Copyright (c) 2010 by John C. Siracusa. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.