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

NAME

6       Rose::DB::MySQL - MySQL 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   => 'mysql',
15           database => 'dev_db',
16           host     => 'localhost',
17           username => 'devuser',
18           password => 'mysecret',
19         );
20
21
22         Rose::DB->default_domain('development');
23         Rose::DB->default_type('main');
24         ...
25
26         # Set max length of varchar columns used to emulate the array data type
27         Rose::DB::MySQL->max_array_characters(128);
28
29         $db = Rose::DB->new; # $db is really a Rose::DB::MySQL-derived object
30         ...
31

DESCRIPTION

33       Rose::DB blesses objects into a class derived from Rose::DB::MySQL when
34       the driver is "mysql".  This mapping of driver names to class names is
35       configurable.  See the documentation for Rose::DB's new() and
36       driver_class() methods for more information.
37
38       This class cannot be used directly.  You must use Rose::DB and let its
39       new() method return an object blessed into the appropriate class for
40       you, according to its driver_class() mappings.
41
42       Only the methods that are new or have different behaviors than those in
43       Rose::DB are documented here.  See the Rose::DB documentation for the
44       full list of methods.
45

CLASS METHODS

47       coerce_autoincrement_to_serial [BOOL]
48           Get or set a boolean value that indicates whether or not "auto-
49           increment" columns will be considered to have the column type
50           "serial."  If true, "integer" columns are coerced to the "serial"
51           column type, and "bigint" columns use the "bigserial" column type.
52           The default value is true.
53
54           This setting comes into play when Rose::DB::Object::Loader is used
55           to auto-create column metadata based on an existing database
56           schema.
57
58       max_array_characters [INT]
59           Get or set the maximum length of varchar columns used to emulate
60           the array data type.  The default value is 255.
61
62           MySQL does not have a native "ARRAY" data type, but this data type
63           can be emulated using a "VARCHAR" column and a specially formatted
64           string.  The formatting and parsing of this string is handled by
65           the format_array and parse_array object methods.  The maximum
66           length limit is honored by the format_array object method.
67
68       max_interval_characters [INT]
69           Get or set the maximum length of varchar columns used to emulate
70           the interval data type.  The default value is 255.
71
72           MySQL does not have a native "interval" data type, but this data
73           type can be emulated using a "VARCHAR" column and a specially
74           formatted string.  The formatting and parsing of this string is
75           handled by the format_interval and parse_interval object methods.
76           The maximum length limit is honored by the format_interval object
77           method.
78

OBJECT METHODS

80       mysql_auto_reconnect [BOOL]
81           Get or set the mysql_auto_reconnect database handle attribute.
82           This is set directly on the dbh, if one exists.  Otherwise, it will
83           be set when the dbh is created.  If no value for this attribute is
84           defined (the default) then it will not be set when the dbh is
85           created, deferring instead to whatever default value DBD::mysql
86           chooses.
87
88           Returns the value of this attribute in the dbh, if one exists, or
89           the value that will be set when the dbh is next created.
90
91           See the DBD::mysql documentation to learn more about this
92           attribute.
93
94       mysql_bind_type_guessing [BOOL]
95           Get or set the mysql_bind_type_guessing database handle attribute.
96           This is set directly on the dbh, if one exists.  Otherwise, it will
97           be set when the dbh is created.  If no value for this attribute is
98           defined (the default) then it will not be set when the dbh is
99           created, deferring instead to whatever default value DBD::mysql
100           chooses.
101
102           Returns the value of this attribute in the dbh, if one exists, or
103           the value that will be set when the dbh is next created.
104
105           See the DBD::mysql documentation to learn more about this
106           attribute.
107
108       mysql_client_found_rows [BOOL]
109           Get or set the mysql_client_found_rows database handle attribute.
110           This is set directly on the dbh, if one exists.  Otherwise, it will
111           be set when the dbh is created.  If no value for this attribute is
112           defined (the default) then it will not be set when the dbh is
113           created, deferring instead to whatever default value DBD::mysql
114           chooses.
115
116           Returns the value of this attribute in the dbh, if one exists, or
117           the value that will be set when the dbh is next created.
118
119           See the DBD::mysql documentation to learn more about this
120           attribute.
121
122       mysql_compression [BOOL]
123           Get or set the mysql_compression database handle attribute.  This
124           is set directly on the dbh, if one exists.  Otherwise, it will be
125           set when the dbh is created.  If no value for this attribute is
126           defined (the default) then it will not be set when the dbh is
127           created, deferring instead to whatever default value DBD::mysql
128           chooses.
129
130           Returns the value of this attribute in the dbh, if one exists, or
131           the value that will be set when the dbh is next created.
132
133           See the DBD::mysql documentation to learn more about this
134           attribute.
135
136       mysql_connect_timeout [BOOL]
137           Get or set the mysql_connect_timeout database handle attribute.
138           This is set directly on the dbh, if one exists.  Otherwise, it will
139           be set when the dbh is created.  If no value for this attribute is
140           defined (the default) then it will not be set when the dbh is
141           created, deferring instead to whatever default value DBD::mysql
142           chooses.
143
144           Returns the value of this attribute in the dbh, if one exists, or
145           the value that will be set when the dbh is next created.
146
147           See the DBD::mysql documentation to learn more about this
148           attribute.
149
150       mysql_embedded_groups [STRING]
151           Get or set the mysql_embedded_groups database handle attribute.
152           This is set directly on the dbh, if one exists.  Otherwise, it will
153           be set when the dbh is created.  If no value for this attribute is
154           defined (the default) then it will not be set when the dbh is
155           created, deferring instead to whatever default value DBD::mysql
156           chooses.
157
158           Returns the value of this attribute in the dbh, if one exists, or
159           the value that will be set when the dbh is next created.
160
161           See the DBD::mysql documentation to learn more about this
162           attribute.
163
164       mysql_embedded_options [STRING]
165           Get or set the mysql_embedded_options database handle attribute.
166           This is set directly on the dbh, if one exists.  Otherwise, it will
167           be set when the dbh is created.  If no value for this attribute is
168           defined (the default) then it will not be set when the dbh is
169           created, deferring instead to whatever default value DBD::mysql
170           chooses.
171
172           Returns the value of this attribute in the dbh, if one exists, or
173           the value that will be set when the dbh is next created.
174
175           See the DBD::mysql documentation to learn more about this
176           attribute.
177
178       mysql_enable_utf8 [BOOL]
179           Get or set the mysql_enable_utf8 database handle attribute.  This
180           is set directly on the dbh, if one exists, by executing the SQL
181           "SET NAMES utf8".  Otherwise, it will be set when the dbh is
182           created.  If no value for this attribute is defined (the default)
183           then it will not be set when the dbh is created, deferring instead
184           to whatever default value DBD::mysql chooses.
185
186           Returns the value of this attribute in the dbh, if one exists, or
187           the value that will be set when the dbh is next created.
188
189           See the DBD::mysql documentation to learn more about this
190           attribute.
191
192       mysql_enable_utf8mb4 [BOOL]
193           Get or set the mysql_enable_utf8mb4 database handle attribute.
194           This is set directly on the dbh, if one exists, by executing the
195           SQL "SET NAMES utf8mb4".  Otherwise, it will be set when the dbh is
196           created.  If no value for this attribute is defined (the default)
197           then it will not be set when the dbh is created, deferring instead
198           to whatever default value DBD::mysql chooses.
199
200           Returns the value of this attribute in the dbh, if one exists, or
201           the value that will be set when the dbh is next created.
202
203           See the DBD::mysql documentation to learn more about this
204           attribute.
205
206       mysql_local_infile [STRING]
207           Get or set the mysql_local_infile database handle attribute.  This
208           is set directly on the dbh, if one exists.  Otherwise, it will be
209           set when the dbh is created.  If no value for this attribute is
210           defined (the default) then it will not be set when the dbh is
211           created, deferring instead to whatever default value DBD::mysql
212           chooses.
213
214           Returns the value of this attribute in the dbh, if one exists, or
215           the value that will be set when the dbh is next created.
216
217           See the DBD::mysql documentation to learn more about this
218           attribute.
219
220       mysql_multi_statements [BOOL]
221           Get or set the mysql_multi_statements database handle attribute.
222           This is set directly on the dbh, if one exists.  Otherwise, it will
223           be set when the dbh is created.  If no value for this attribute is
224           defined (the default) then it will not be set when the dbh is
225           created, deferring instead to whatever default value DBD::mysql
226           chooses.
227
228           Returns the value of this attribute in the dbh, if one exists, or
229           the value that will be set when the dbh is next created.
230
231           See the DBD::mysql documentation to learn more about this
232           attribute.
233
234       mysql_read_default_file [STRING]
235           Get or set the mysql_read_default_file database handle attribute.
236           This is set directly on the dbh, if one exists.  Otherwise, it will
237           be set when the dbh is created.  If no value for this attribute is
238           defined (the default) then it will not be set when the dbh is
239           created, deferring instead to whatever default value DBD::mysql
240           chooses.
241
242           Returns the value of this attribute in the dbh, if one exists, or
243           the value that will be set when the dbh is next created.
244
245           See the DBD::mysql documentation to learn more about this
246           attribute.
247
248       mysql_read_default_group [STRING]
249           Get or set the mysql_read_default_group database handle attribute.
250           This is set directly on the dbh, if one exists.  Otherwise, it will
251           be set when the dbh is created.  If no value for this attribute is
252           defined (the default) then it will not be set when the dbh is
253           created, deferring instead to whatever default value DBD::mysql
254           chooses.
255
256           Returns the value of this attribute in the dbh, if one exists, or
257           the value that will be set when the dbh is next created.
258
259           See the DBD::mysql documentation to learn more about this
260           attribute.
261
262       mysql_socket [STRING]
263           Get or set the mysql_socket database handle attribute.  This is set
264           directly on the dbh, if one exists.  Otherwise, it will be set when
265           the dbh is created.  If no value for this attribute is defined (the
266           default) then it will not be set when the dbh is created, deferring
267           instead to whatever default value DBD::mysql chooses.
268
269           Returns the value of this attribute in the dbh, if one exists, or
270           the value that will be set when the dbh is next created.
271
272           See the DBD::mysql documentation to learn more about this
273           attribute.
274
275       mysql_ssl [BOOL]
276           Get or set the mysql_ssl database handle attribute.  This is set
277           directly on the dbh, if one exists.  Otherwise, it will be set when
278           the dbh is created.  If no value for this attribute is defined (the
279           default) then it will not be set when the dbh is created, deferring
280           instead to whatever default value DBD::mysql chooses.
281
282           Returns the value of this attribute in the dbh, if one exists, or
283           the value that will be set when the dbh is next created.
284
285           See the DBD::mysql documentation to learn more about this
286           attribute.
287
288       mysql_ssl_ca_file [STRING]
289           Get or set the mysql_ssl_ca_file database handle attribute.  This
290           is set directly on the dbh, if one exists.  Otherwise, it will be
291           set when the dbh is created.  If no value for this attribute is
292           defined (the default) then it will not be set when the dbh is
293           created, deferring instead to whatever default value DBD::mysql
294           chooses.
295
296           Returns the value of this attribute in the dbh, if one exists, or
297           the value that will be set when the dbh is next created.
298
299           See the DBD::mysql documentation to learn more about this
300           attribute.
301
302       mysql_ssl_ca_path [STRING]
303           Get or set the mysql_ssl_ca_path database handle attribute.  This
304           is set directly on the dbh, if one exists.  Otherwise, it will be
305           set when the dbh is created.  If no value for this attribute is
306           defined (the default) then it will not be set when the dbh is
307           created, deferring instead to whatever default value DBD::mysql
308           chooses.
309
310           Returns the value of this attribute in the dbh, if one exists, or
311           the value that will be set when the dbh is next created.
312
313           See the DBD::mysql documentation to learn more about this
314           attribute.
315
316       mysql_ssl_cipher [STRING]
317           Get or set the mysql_ssl_cipher database handle attribute.  This is
318           set directly on the dbh, if one exists.  Otherwise, it will be set
319           when the dbh is created.  If no value for this attribute is defined
320           (the default) then it will not be set when the dbh is created,
321           deferring instead to whatever default value DBD::mysql chooses.
322
323           Returns the value of this attribute in the dbh, if one exists, or
324           the value that will be set when the dbh is next created.
325
326           See the DBD::mysql documentation to learn more about this
327           attribute.
328
329       mysql_ssl_client_cert [STRING]
330           Get or set the mysql_ssl_client_cert database handle attribute.
331           This is set directly on the dbh, if one exists.  Otherwise, it will
332           be set when the dbh is created.  If no value for this attribute is
333           defined (the default) then it will not be set when the dbh is
334           created, deferring instead to whatever default value DBD::mysql
335           chooses.
336
337           Returns the value of this attribute in the dbh, if one exists, or
338           the value that will be set when the dbh is next created.
339
340           See the DBD::mysql documentation to learn more about this
341           attribute.
342
343       mysql_ssl_client_key [STRING]
344           Get or set the mysql_ssl_client_key database handle attribute.
345           This is set directly on the dbh, if one exists.  Otherwise, it will
346           be set when the dbh is created.  If no value for this attribute is
347           defined (the default) then it will not be set when the dbh is
348           created, deferring instead to whatever default value DBD::mysql
349           chooses.
350
351           Returns the value of this attribute in the dbh, if one exists, or
352           the value that will be set when the dbh is next created.
353
354           See the DBD::mysql documentation to learn more about this
355           attribute.
356
357       mysql_use_result [BOOL]
358           Get or set the mysql_use_result database handle attribute.  This is
359           set directly on the dbh, if one exists.  Otherwise, it will be set
360           when the dbh is created.  If no value for this attribute is defined
361           (the default) then it will not be set when the dbh is created,
362           deferring instead to whatever default value DBD::mysql chooses.
363
364           Returns the value of this attribute in the dbh, if one exists, or
365           the value that will be set when the dbh is next created.
366
367           See the DBD::mysql documentation to learn more about this
368           attribute.
369
370   Value Parsing and Formatting
371       format_array ARRAYREF | LIST
372           Given a reference to an array or a list of values, return a
373           specially formatted string.  Undef is returned if ARRAYREF points
374           to an empty array or if LIST is not passed.  The array or list must
375           not contain undefined values.
376
377           If the resulting string is longer than max_array_characters, a
378           fatal error will occur.
379
380       format_interval DURATION
381           Given a DateTime::Duration object, return a string formatted
382           according to the rules of PostgreSQL's "INTERVAL" column type.  If
383           DURATION is undefined, a DateTime::Duration object, a valid
384           interval keyword (according to validate_interval_keyword), or if it
385           looks like a function call (matches "/^\w+\(.*\)$/") and
386           keyword_function_calls is true, then it is returned unmodified.
387
388           If the resulting string is longer than max_interval_characters, a
389           fatal error will occur.
390
391       format_set ARRAYREF | LIST
392           Given a reference to an array or a list of values, return a string
393           formatted according to the rules of MySQL's "SET" data type.  Undef
394           is returned if ARRAYREF points to an empty array or if LIST is not
395           passed.  If the array or list contains undefined values, a fatal
396           error will occur.
397
398       parse_array STRING | LIST | ARRAYREF
399           Parse STRING and return a reference to an array.  STRING should be
400           formatted according to the MySQL array data type emulation format
401           returned by format_array().  Undef is returned if STRING is
402           undefined.
403
404           If a LIST of more than one item is passed, a reference to an array
405           containing the values in LIST is returned.
406
407           If a an ARRAYREF is passed, it is returned as-is.
408
409       parse_interval STRING
410           Parse STRING and return a DateTime::Duration object.  STRING should
411           be formatted according to the PostgreSQL native "interval" (years,
412           months, days, hours, minutes, seconds) data type.
413
414           If STRING is a DateTime::Duration object, a valid interval keyword
415           (according to validate_interval_keyword), or if it looks like a
416           function call (matches "/^\w+\(.*\)$/") and keyword_function_calls
417           is true, then it is returned unmodified.  Otherwise, undef is
418           returned if STRING could not be parsed as a valid "interval" value.
419
420       parse_set STRING | LIST | ARRAYREF
421           Parse STRING and return a reference to an array.  STRING should be
422           formatted according to MySQL's "SET" data type.  Undef is returned
423           if STRING is undefined.
424
425           If a LIST of more than one item is passed, a reference to an array
426           containing the values in LIST is returned.
427
428           If a an ARRAYREF is passed, it is returned as-is.
429
430       validate_date_keyword STRING
431           Returns true if STRING is a valid keyword for the MySQL "date" data
432           type.  Valid (case-insensitive) date keywords are:
433
434               curdate()
435               current_date
436               current_date()
437               now()
438               sysdate()
439               00000-00-00
440
441           Any string that looks like a function call (matches /^\w+\(.*\)$/)
442           is also considered a valid date keyword if keyword_function_calls
443           is true.
444
445       validate_datetime_keyword STRING
446           Returns true if STRING is a valid keyword for the MySQL "datetime"
447           data type, false otherwise.  Valid (case-insensitive) datetime
448           keywords are:
449
450               curdate()
451               current_date
452               current_date()
453               current_time
454               current_time()
455               current_timestamp
456               current_timestamp()
457               curtime()
458               now()
459               sysdate()
460               0000-00-00 00:00:00
461
462           Any string that looks like a function call (matches /^\w+\(.*\)$/)
463           is also considered a valid datetime keyword if
464           keyword_function_calls is true.
465
466       validate_timestamp_keyword STRING
467           Returns true if STRING is a valid keyword for the MySQL "timestamp"
468           data type, false otherwise.  Valid (case-insensitive) timestamp
469           keywords are:
470
471               curdate()
472               current_date
473               current_date()
474               current_time
475               current_time()
476               current_timestamp
477               current_timestamp()
478               curtime()
479               now()
480               sysdate()
481               0000-00-00 00:00:00
482               00000000000000
483
484           Any string that looks like a function call (matches /^\w+\(.*\)$/)
485           is also considered a valid timestamp keyword if
486           keyword_function_calls is true.
487

AUTHOR

489       John C. Siracusa (siracusa@gmail.com)
490

LICENSE

492       Copyright (c) 2010 by John C. Siracusa.  All rights reserved.  This
493       program is free software; you can redistribute it and/or modify it
494       under the same terms as Perl itself.
495
496
497
498perl v5.38.0                      2023-07-21                Rose::DB::MySQL(3)
Impressum