1Rose::DB::SQLite(3)   User Contributed Perl Documentation  Rose::DB::SQLite(3)
2
3
4

NAME

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

SYNOPSIS

9         use Rose::DB;
10
11         Rose::DB->register_db(
12           domain   => 'development',
13           type     => 'main',
14           driver   => 'sqlite',
15           database => '/path/to/some/file.db',
16         );
17
18
19         Rose::DB->default_domain('development');
20         Rose::DB->default_type('main');
21         ...
22
23         # Set max length of varchar columns used to emulate the array data type
24         Rose::DB::SQLite->max_array_characters(128);
25
26         $db = Rose::DB->new; # $db is really a Rose::DB::SQLite-derived object
27         ...
28

DESCRIPTION

30       Rose::DB blesses objects into a class derived from Rose::DB::SQLite
31       when the driver is "sqlite".  This mapping of driver names to class
32       names is configurable.  See the documentation for Rose::DB's new() and
33       driver_class() methods for more information.
34
35       This class cannot be used directly.  You must use Rose::DB and let its
36       new() method return an object blessed into the appropriate class for
37       you, according to its driver_class() mappings.
38
39       This class supports SQLite version 3 only.  See the SQLite web site for
40       more information on the major versions of SQLite:
41
42       <http://www.sqlite.org/>
43
44       Only the methods that are new or have different behaviors than those in
45       Rose::DB are documented here.  See the Rose::DB documentation for the
46       full list of methods.
47

DATA TYPES

49       SQLite doesn't care what value you pass for a given column, regardless
50       of that column's nominal data type.  Rose::DB does care, however.  The
51       following data type formats are enforced by Rose::DB::SQLite's parse_*
52       and format_* functions.
53
54           Type        Format
55           ---------   ------------------------------
56           DATE        YYYY-MM-DD
57           DATETIME    YYYY-MM-DD HH:MM::SS
58           TIMESTAMP   YYYY-MM-DD HH:MM::SS.NNNNNNNNN
59

CLASS METHODS

61       coerce_autoincrement_to_serial [BOOL]
62           Get or set a boolean value that indicates whether or not "auto-
63           increment" columns will be considered to have the column type
64           "serial."  The default value is true.
65
66           This setting comes into play when Rose::DB::Object::Loader is used
67           to auto-create column metadata based on an existing database
68           schema.
69
70       max_array_characters [INT]
71           Get or set the maximum length of varchar columns used to emulate
72           the array data type.  The default value is 255.
73
74           SQLite does not have a native "ARRAY" data type, but it can be
75           emulated using a "VARCHAR" column and a specially formatted string.
76           The formatting and parsing of this string is handled by the
77           "format_array()" and "parse_array()" object methods.  The maximum
78           length limit is honored by the "format_array()" object method.
79

OBJECT METHODS

81       auto_create [BOOL]
82           Get or set a boolean value indicating whether or not a new SQLite
83           database should be created if it does not already exist.  Defaults
84           to true.
85
86           If false, and if the specified database does not exist, then a
87           fatal error will occur when an attempt is made to connect to the
88           database.
89
90       sqlite_unicode [BOOL]
91           Get or set a boolean value that indicates whether or not Perl's
92           UTF-8 flag will be set for all text strings coming out of the
93           database.  See the DBD::SQLite documentation for more information.
94
95   Value Parsing and Formatting
96       format_array ARRAYREF | LIST
97           Given a reference to an array or a list of values, return a
98           specially formatted string.  Undef is returned if ARRAYREF points
99           to an empty array or if LIST is not passed.  The array or list must
100           not contain undefined values.
101
102           If the resulting string is longer than "max_array_characters()", a
103           fatal error will occur.
104
105       parse_array STRING | LIST | ARRAYREF
106           Parse STRING and return a reference to an array.  STRING should be
107           formatted according to the SQLite array data type emulation format
108           returned by "format_array()".  Undef is returned if STRING is
109           undefined.
110
111           If a LIST of more than one item is passed, a reference to an array
112           containing the values in LIST is returned.
113
114           If a an ARRAYREF is passed, it is returned as-is.
115
116       parse_date STRING
117           Parse STRING and return a DateTime object.  STRING should be
118           formatted according to the Informix "DATE" data type.
119
120           If STRING is a valid date keyword (according to
121           validate_date_keyword) it is returned unmodified.  Returns undef if
122           STRING could not be parsed as a valid "DATE" value.
123
124       parse_datetime STRING
125           Parse STRING and return a DateTime object.  STRING should be
126           formatted according to the Informix "DATETIME" data type.
127
128           If STRING is a valid datetime keyword (according to
129           validate_datetime_keyword) it is returned unmodified.  Returns
130           undef if STRING could not be parsed as a valid "DATETIME" value.
131
132       parse_timestamp STRING
133           Parse STRING and return a DateTime object.  STRING should be
134           formatted according to the Informix "DATETIME" data type.
135
136           If STRING is a valid timestamp keyword (according to
137           validate_timestamp_keyword) it is returned unmodified.  Returns
138           undef if STRING could not be parsed as a valid "DATETIME" value.
139
140       validate_date_keyword STRING
141           Returns true if STRING is a valid keyword for the "date" data type.
142           Valid date keywords are:
143
144               current_timestamp
145
146           The keywords are not case sensitive.  Any string that looks like a
147           function call (matches /^\w+\(.*\)$/) is also considered a valid
148           date keyword if keyword_function_calls is true.
149
150       validate_datetime_keyword STRING
151           Returns true if STRING is a valid keyword for the "datetime" data
152           type, false otherwise.  Valid datetime keywords are:
153
154               current_timestamp
155
156           The keywords are not case sensitive.  Any string that looks like a
157           function call (matches /^\w+\(.*\)$/) is also considered a valid
158           datetime keyword if keyword_function_calls is true.
159
160       validate_timestamp_keyword STRING
161           Returns true if STRING is a valid keyword for the "timestamp" data
162           type, false otherwise.  Valid timestamp keywords are:
163
164               current_timestamp
165
166           The keywords are not case sensitive.  Any string that looks like a
167           function call (matches /^\w+\(.*\)$/) is also considered a valid
168           timestamp keyword if keyword_function_calls is true.
169

AUTHOR

171       John C. Siracusa (siracusa@gmail.com)
172

LICENSE

174       Copyright (c) 2010 by John C. Siracusa.  All rights reserved.  This
175       program is free software; you can redistribute it and/or modify it
176       under the same terms as Perl itself.
177
178
179
180perl v5.32.0                      2020-07-28               Rose::DB::SQLite(3)
Impressum