1Rose::DB::Informix(3) User Contributed Perl DocumentationRose::DB::Informix(3)
2
3
4
6 Rose::DB::Informix - Informix driver class for Rose::DB.
7
9 use Rose::DB;
10
11 Rose::DB->register_db(
12 domain => 'development',
13 type => 'main',
14 driver => 'Informix',
15 database => 'dev_db',
16 host => 'localhost',
17 username => 'devuser',
18 password => 'mysecret',
19 server_time_zone => 'UTC',
20 );
21
22
23 Rose::DB->default_domain('development');
24 Rose::DB->default_type('main');
25 ...
26
27 # Set max length of varchar columns used to emulate the array data type
28 Rose::DB::Informix->max_array_characters(128);
29
30 $db = Rose::DB->new; # $db is really a Rose::DB::Informix-derived object
31
32 $dt = $db->parse_datetime_year_to_minute(...);
33 $val = $db->format_datetime_year_to_minute($dt);
34
35 $dt = $db->parse_datetime_year_to_second(...);
36 $val = $db->format_datetime_year_to_second($dt);
37 ...
38
40 Rose::DB blesses objects into a class derived from Rose::DB::Informix
41 when the driver is "informix". This mapping of driver names to class
42 names is configurable. See the documentation for Rose::DB's new() and
43 driver_class() methods for more information.
44
45 This class cannot be used directly. You must use Rose::DB and let its
46 new() method return an object blessed into the appropriate class for
47 you, according to its driver_class() mappings.
48
49 Only the methods that are new or have different behaviors than those in
50 Rose::DB are documented here. See the Rose::DB documentation for the
51 full list of methods.
52
54 default_supports_limit_with_offset [BOOL]
55 Get or set a boolean value that indicates whether or not all
56 Informix databases that you plan to connect to support the "SELECT
57 SKIP N FIRST M ..." syntax. If undefined, this feature will be
58 looked up on a per-connection basis as needed. The default is
59 undefined.
60
61 max_array_characters [INT]
62 Get or set the maximum length of varchar columns used to emulate
63 the array data type. The default value is 255.
64
65 Informix does not have a native "ARRAY" data type, but it can be
66 emulated using a "VARCHAR" column and a specially formatted string.
67 The formatting and parsing of this string is handled by the
68 "format_array()" and "parse_array()" object methods. The maximum
69 length limit is honored by the "format_array()" object method.
70
71 Informix does have a native "SET" data type, serviced by the
72 "parse_set()" and "format_set()" object methods. This is a better
73 choice than the emulated array data type if you don't care about
74 the order of the stored values.
75
77 Value Parsing and Formatting
78 format_array ARRAYREF | LIST
79 Given a reference to an array or a list of values, return a
80 specially formatted string. Undef is returned if ARRAYREF points
81 to an empty array or if LIST is not passed. The array or list must
82 not contain undefined values.
83
84 If the resulting string is longer than "max_array_characters()", a
85 fatal error will occur.
86
87 format_date DATETIME
88 Converts the DateTime object DATETIME into the appropriate format
89 for the "DATE" data type.
90
91 format_datetime DATETIME
92 Converts the DateTime object DATETIME into the appropriate format
93 for the "DATETIME YEAR TO SECOND" data type.
94
95 format_datetime_year_to_fraction DATETIME
96 Converts the DateTime object DATETIME into the appropriate format
97 for the "DATETIME YEAR TO FRACTION" data type.
98
99 format_datetime_year_to_fraction_[1-5] DATETIME
100 Converts the DateTime object DATETIME into the appropriate format
101 for the "DATETIME YEAR TO FRACTION(N)" data type, where N is an
102 integer from 1 to 5.
103
104 format_datetime_year_to_minute DATETIME
105 Converts the DateTime object DATETIME into the appropriate format
106 for the "DATETIME YEAR TO MINUTE" data type.
107
108 format_datetime_year_to_month DATETIME
109 Converts the DateTime object DATETIME into the appropriate format
110 for the "DATETIME YEAR TO MONTH" data type.
111
112 format_datetime_year_to_second DATETIME
113 Converts the DateTime object DATETIME into the appropriate format
114 for the "DATETIME YEAR TO SECOND" data type.
115
116 format_set ARRAYREF | LIST
117 Given a reference to an array or a list of values, return a string
118 formatted according to the rules of Informix's "SET" data type.
119 Undef is returned if ARRAYREF points to an empty array or if LIST
120 is not passed. If the array or list contains undefined values, a
121 fatal error will occur.
122
123 format_timestamp DATETIME
124 Converts the DateTime object DATETIME into the appropriate format
125 for the "DATETIME YEAR TO FRACTION(5)" data type.
126
127 parse_array STRING | LIST | ARRAYREF
128 Parse STRING and return a reference to an array. STRING should be
129 formatted according to the Informix array data type emulation
130 format returned by "format_array()". Undef is returned if STRING
131 is undefined.
132
133 If a LIST of more than one item is passed, a reference to an array
134 containing the values in LIST is returned.
135
136 If a an ARRAYREF is passed, it is returned as-is.
137
138 parse_boolean STRING
139 Parse STRING and return a boolean value of 1 or 0. STRING should
140 be formatted according to Informix's native "boolean" data type.
141 Acceptable values are 't', 'T', or '1' for true, and 'f', 'F', or
142 '0' for false.
143
144 If STRING is a valid boolean keyword (according to
145 validate_boolean_keyword) or if it looks like a function call
146 (matches /^\w+\(.*\)$/) and keyword_function_calls is true, then it
147 is returned unmodified. Returns undef if STRING could not be
148 parsed as a valid "boolean" value.
149
150 parse_date STRING
151 Parse STRING and return a DateTime object. STRING should be
152 formatted according to the Informix "DATE" data type.
153
154 If STRING is a valid date keyword (according to
155 validate_date_keyword) it is returned unmodified. Returns undef if
156 STRING could not be parsed as a valid "DATE" value.
157
158 parse_datetime STRING
159 Parse STRING and return a DateTime object. STRING should be
160 formatted according to the Informix "DATETIME YEAR TO SECOND" data
161 type.
162
163 If STRING is a valid "datetime year to second" keyword (according
164 to validate_datetime_year_to_second_keyword) it is returned
165 unmodified. Returns undef if STRING could not be parsed as a valid
166 "DATETIME YEAR TO SECOND" value.
167
168 parse_datetime_year_to_fraction STRING
169 Parse STRING and return a DateTime object. STRING should be
170 formatted according to the Informix "DATETIME YEAR TO FRACTION"
171 data type.
172
173 If STRING is a valid "datetime year to fraction" keyword (according
174 to validate_datetime_year_to_fraction_keyword) it is returned
175 unmodified. Returns undef if STRING could not be parsed as a valid
176 "DATETIME YEAR TO FRACTION" value.
177
178 parse_datetime_year_to_fraction_[1-5] STRING
179 These five methods parse STRING and return a DateTime object.
180 STRING should be formatted according to the Informix "DATETIME YEAR
181 TO FRACTION(N)" data type, where N is an integer from 1 to 5.
182
183 If STRING is a valid "datetime year to fraction" keyword (according
184 to validate_datetime_year_to_fraction_keyword) it is returned
185 unmodified. Returns undef if STRING could not be parsed as a valid
186 "DATETIME YEAR TO FRACTION(N)" value.
187
188 parse_datetime_year_to_minute STRING
189 Parse STRING and return a DateTime object. STRING should be
190 formatted according to the Informix "DATETIME YEAR TO MINUTE" data
191 type.
192
193 If STRING is a valid "datetime year to minute" keyword (according
194 to validate_datetime_year_to_minute_keyword) it is returned
195 unmodified. Returns undef if STRING could not be parsed as a valid
196 "DATETIME YEAR TO MINUTE" value.
197
198 parse_datetime_year_to_month STRING
199 Parse STRING and return a DateTime object. STRING should be
200 formatted according to the Informix "DATETIME YEAR TO MINUTE" data
201 type.
202
203 If STRING is a valid "datetime year to month" keyword (according to
204 validate_datetime_year_to_month_keyword) it is returned unmodified.
205 Returns undef if STRING could not be parsed as a valid "DATETIME
206 YEAR TO MONTH" value.
207
208 parse_datetime_year_to_second STRING
209 Parse STRING and return a DateTime object. STRING should be
210 formatted according to the Informix "DATETIME YEAR TO SECOND" data
211 type.
212
213 If STRING is a valid "datetime year to second" keyword (according
214 to validate_datetime_year_to_second_keyword) it is returned
215 unmodified. Returns undef if STRING could not be parsed as a valid
216 "DATETIME YEAR TO SECOND" value.
217
218 parse_set STRING | LIST | ARRAYREF
219 Parse STRING and return a reference to an array. STRING should be
220 formatted according to Informix's "SET" data type. Undef is
221 returned if STRING is undefined.
222
223 If a LIST of more than one item is passed, a reference to an array
224 containing the values in LIST is returned.
225
226 If a an ARRAYREF is passed, it is returned as-is.
227
228 parse_timestamp STRING
229 Parse STRING and return a DateTime object. STRING should be
230 formatted according to the Informix "DATETIME YEAR TO FRACTION(5)"
231 data type.
232
233 If STRING is a valid timestamp keyword (according to
234 validate_timestamp_keyword) it is returned unmodified. Returns
235 undef if STRING could not be parsed as a valid "DATETIME YEAR TO
236 FRACTION(5)" value.
237
238 validate_boolean_keyword STRING
239 Returns true if STRING is a valid keyword for the "boolean" data
240 type of the current data source, false otherwise. Valid (case-
241 insensitive) boolean keywords are:
242
243 TRUE
244 FALSE
245
246 validate_date_keyword STRING
247 Returns true if STRING is a valid keyword for the Informix "date",
248 false otherwise. Valid (case-insensitive) date keywords are:
249
250 current
251 today
252
253 The keywords are not case sensitive. Any string that looks like a
254 function call (matches /^\w+\(.*\)$/) is also considered a valid
255 date keyword if keyword_function_calls is true.
256
257 validate_datetime_keyword STRING
258 Returns true if STRING is a valid keyword for the Informix
259 "datetime year to second" data type, false otherwise. Valid (case-
260 insensitive) datetime keywords are:
261
262 current
263 current year to second
264 current year to minute
265 current year to hour
266 current year to day
267 current year to month
268 today
269
270 The keywords are not case sensitive. Any string that looks like a
271 function call (matches /^\w+\(.*\)$/) is also considered a valid
272 datetime keyword if keyword_function_calls is true.
273
274 validate_datetime_year_to_fraction_keyword STRING
275 Returns true if STRING is a valid keyword for the Informix
276 "datetime year to fraction(n)" data type (where n is an integer
277 from 1 to 5), false otherwise. Valid (case-insensitive) "datetime
278 year to fraction" keywords are:
279
280 current
281 current year to fraction
282 current year to fraction(1)
283 current year to fraction(2)
284 current year to fraction(3)
285 current year to fraction(4)
286 current year to fraction(5)
287 current year to second
288 current year to minute
289 current year to hour
290 current year to day
291 current year to month
292 today
293
294 The keywords are not case sensitive. Any string that looks like a
295 function call (matches /^\w+\(.*\)$/) is also considered a valid
296 "datetime year to fraction" keyword if keyword_function_calls is
297 true.
298
299 validate_datetime_year_to_minute_keyword STRING
300 Returns true if STRING is a valid keyword for the Informix
301 "datetime year to minute" data type, false otherwise. Valid (case-
302 insensitive) "datetime year to minute" keywords are:
303
304 current
305 current year to second
306 current year to minute
307 current year to hour
308 current year to day
309 current year to month
310 today
311
312 The keywords are not case sensitive. Any string that looks like a
313 function call (matches /^\w+\(.*\)$/) is also considered a valid
314 "datetime year to minute" keyword if keyword_function_calls is
315 true.
316
317 validate_datetime_year_to_month_keyword STRING
318 Returns true if STRING is a valid keyword for the Informix
319 "datetime year to month" data type, false otherwise. Valid (case-
320 insensitive) "datetime year to month" keywords are:
321
322 current
323 current year to second
324 current year to minute
325 current year to hour
326 current year to day
327 current year to month
328 today
329
330 The keywords are not case sensitive. Any string that looks like a
331 function call (matches /^\w+\(.*\)$/) is also considered a valid
332 "datetime year to month" keyword if keyword_function_calls is true.
333
334 validate_datetime_year_to_second_keyword STRING
335 Returns true if STRING is a valid keyword for the Informix
336 "datetime year to second" data type, false otherwise. Valid (case-
337 insensitive) datetime keywords are:
338
339 current
340 current year to second
341 current year to minute
342 current year to hour
343 current year to day
344 current year to month
345 today
346
347 The keywords are not case sensitive. Any string that looks like a
348 function call (matches /^\w+\(.*\)$/) is also considered a valid
349 "datetime year to second" keyword if keyword_function_calls is
350 true.
351
352 validate_timestamp_keyword STRING
353 Returns true if STRING is a valid keyword for the Informix
354 "timestamp" data type, false otherwise. Valid (case-insensitive)
355 timestamp keywords are:
356
357 current
358 current year to fraction
359 current year to fraction(1)
360 current year to fraction(2)
361 current year to fraction(3)
362 current year to fraction(4)
363 current year to fraction(5)
364 current year to second
365 current year to minute
366 current year to hour
367 current year to day
368 current year to month
369 today
370
371 The keywords are not case sensitive. Any string that looks like a
372 function call (matches /^\w+\(.*\)$/) is also considered a valid
373 timestamp keyword if keyword_function_calls is true.
374
376 John C. Siracusa (siracusa@gmail.com)
377
379 Copyright (c) 2010 by John C. Siracusa. All rights reserved. This
380 program is free software; you can redistribute it and/or modify it
381 under the same terms as Perl itself.
382
383
384
385perl v5.36.0 2022-07-22 Rose::DB::Informix(3)