oracular (3) Rose::DB::SQLite.3pm.gz

Provided by: librose-db-perl_0.785-1_all bug

NAME

       Rose::DB::SQLite - SQLite driver class for Rose::DB.

SYNOPSIS

         use Rose::DB;

         Rose::DB->register_db(
           domain   => 'development',
           type     => 'main',
           driver   => 'sqlite',
           database => '/path/to/some/file.db',
         );

         Rose::DB->default_domain('development');
         Rose::DB->default_type('main');
         ...

         # 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
         ...

DESCRIPTION

       Rose::DB blesses objects into a class derived from Rose::DB::SQLite when the driver is "sqlite".  This
       mapping of driver names to class names is configurable.  See the documentation for Rose::DB's new() and
       driver_class() methods for more information.

       This class cannot be used directly.  You must use Rose::DB and let its new() method return an object
       blessed into the appropriate class for you, according to its driver_class() mappings.

       This class supports SQLite version 3 only.  See the SQLite web site for more information on the major
       versions of SQLite:

       <http://www.sqlite.org/>

       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.

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.

           Type        Format
           ---------   ------------------------------
           DATE        YYYY-MM-DD
           DATETIME    YYYY-MM-DD HH:MM::SS
           TIMESTAMP   YYYY-MM-DD HH:MM::SS.NNNNNNNNN

CLASS METHODS

       coerce_autoincrement_to_serial [BOOL]
           Get or set a boolean value that indicates whether or not "auto-increment" columns will be considered
           to have the column type  "serial."  The default value is true.

           This setting comes into play when Rose::DB::Object::Loader is used to auto-create column metadata
           based on an existing database schema.

       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.

           SQLite does not have a native "ARRAY" data type, but it can be emulated using a "VARCHAR" column and
           a specially formatted string.  The formatting and parsing of this string is handled by the
           "format_array()" and "parse_array()" object methods.  The maximum length limit is honored by the
           "format_array()" object method.

OBJECT METHODS

       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.

           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.

       sqlite_unicode [BOOL]
           Get or set a boolean value that indicates whether or not Perl's UTF-8 flag will be set for all text
           strings coming out of the database.  See the DBD::SQLite documentation for more information.

   Value Parsing and Formatting
       format_array ARRAYREF | LIST
           Given a reference to an array or a list of values, return a specially formatted string.  Undef is
           returned if ARRAYREF points to an empty array or if LIST is not passed.  The array or list must not
           contain undefined values.

           If the resulting string is longer than "max_array_characters()", a fatal error will occur.

       parse_array STRING | LIST | ARRAYREF
           Parse STRING and return a reference to an array.  STRING should be formatted according to the SQLite
           array data type emulation format returned by "format_array()".  Undef is returned if STRING is
           undefined.

           If a LIST of more than one item is passed, a reference to an array containing the values in LIST is
           returned.

           If a an ARRAYREF is passed, it is returned as-is.

       parse_date STRING
           Parse STRING and return a DateTime object.  STRING should be formatted according to the Informix
           "DATE" data type.

           If STRING is a valid date keyword (according to validate_date_keyword) it is returned unmodified.
           Returns undef if STRING could not be parsed as a valid "DATE" value.

       parse_datetime STRING
           Parse STRING and return a DateTime object.  STRING should be formatted according to the Informix
           "DATETIME" data type.

           If STRING is a valid datetime keyword (according to validate_datetime_keyword) it is returned
           unmodified.  Returns undef if STRING could not be parsed as a valid "DATETIME" value.

       parse_timestamp STRING
           Parse STRING and return a DateTime object.  STRING should be formatted according to the Informix
           "DATETIME" data type.

           If STRING is a valid timestamp keyword (according to validate_timestamp_keyword) it is returned
           unmodified.  Returns undef if STRING could not be parsed as a valid "DATETIME" value.

       validate_date_keyword STRING
           Returns true if STRING is a valid keyword for the "date" data type.  Valid date keywords are:

               current_timestamp

           The keywords are not case sensitive.  Any string that looks like a function call (matches
           /^\w+\(.*\)$/) is also considered a valid date keyword if keyword_function_calls is true.

       validate_datetime_keyword STRING
           Returns true if STRING is a valid keyword for the "datetime" data type, false otherwise.  Valid
           datetime keywords are:

               current_timestamp

           The keywords are not case sensitive.  Any string that looks like a function call (matches
           /^\w+\(.*\)$/) is also considered a valid datetime keyword if keyword_function_calls is true.

       validate_timestamp_keyword STRING
           Returns true if STRING is a valid keyword for the "timestamp" data type, false otherwise.  Valid
           timestamp keywords are:

               current_timestamp

           The keywords are not case sensitive.  Any string that looks like a function call (matches
           /^\w+\(.*\)$/) is also considered a valid timestamp keyword if keyword_function_calls is true.

AUTHOR

       John C. Siracusa (siracusa@gmail.com)

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.