.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" 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 .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Rose::DB::MySQL 3pm" .TH Rose::DB::MySQL 3pm "2023-03-04" "perl v5.36.0" "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::MySQL \- MySQL 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 => \*(Aqmysql\*(Aq, \& database => \*(Aqdev_db\*(Aq, \& host => \*(Aqlocalhost\*(Aq, \& username => \*(Aqdevuser\*(Aq, \& password => \*(Aqmysecret\*(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::MySQL\->max_array_characters(128); \& \& $db = Rose::DB\->new; # $db is really a Rose::DB::MySQL\-derived object \& ... .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Rose::DB blesses objects into a class derived from Rose::DB::MySQL when the driver is \*(L"mysql\*(R". This mapping of driver names to class names is configurable. See the documentation for Rose::DB's \fBnew()\fR and \fBdriver_class()\fR methods for more information. .PP This class cannot be used directly. You must use Rose::DB and let its \fBnew()\fR method return an object blessed into the appropriate class for you, according to its \fBdriver_class()\fR mappings. .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 "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" If true, \*(L"integer\*(R" columns are coerced to the \*(L"serial\*(R" column type, and \*(L"bigint\*(R" columns use the \*(L"bigserial\*(R" column type. 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 MySQL does not have a native \*(L"\s-1ARRAY\*(R"\s0 data type, but this data type 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 format_array and parse_array object methods. The maximum length limit is honored by the format_array object method. .IP "\fBmax_interval_characters [\s-1INT\s0]\fR" 4 .IX Item "max_interval_characters [INT]" Get or set the maximum length of varchar columns used to emulate the interval data type. The default value is 255. .Sp MySQL does not have a native \*(L"interval\*(R" data type, but this data type 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 format_interval and parse_interval object methods. The maximum length limit is honored by the format_interval object method. .SH "OBJECT METHODS" .IX Header "OBJECT METHODS" .IP "\fBmysql_auto_reconnect [\s-1BOOL\s0]\fR" 4 .IX Item "mysql_auto_reconnect [BOOL]" Get or set the mysql_auto_reconnect database handle attribute. This is set directly on the dbh, if one exists. Otherwise, it will be set when the dbh is created. If no value for this attribute is defined (the default) then it will not be set when the dbh is created, deferring instead to whatever default value DBD::mysql chooses. .Sp Returns the value of this attribute in the dbh, if one exists, or the value that will be set when the dbh is next created. .Sp See the DBD::mysql documentation to learn more about this attribute. .IP "\fBmysql_bind_type_guessing [\s-1BOOL\s0]\fR" 4 .IX Item "mysql_bind_type_guessing [BOOL]" Get or set the mysql_bind_type_guessing database handle attribute. This is set directly on the dbh, if one exists. Otherwise, it will be set when the dbh is created. If no value for this attribute is defined (the default) then it will not be set when the dbh is created, deferring instead to whatever default value DBD::mysql chooses. .Sp Returns the value of this attribute in the dbh, if one exists, or the value that will be set when the dbh is next created. .Sp See the DBD::mysql documentation to learn more about this attribute. .IP "\fBmysql_client_found_rows [\s-1BOOL\s0]\fR" 4 .IX Item "mysql_client_found_rows [BOOL]" Get or set the mysql_client_found_rows database handle attribute. This is set directly on the dbh, if one exists. Otherwise, it will be set when the dbh is created. If no value for this attribute is defined (the default) then it will not be set when the dbh is created, deferring instead to whatever default value DBD::mysql chooses. .Sp Returns the value of this attribute in the dbh, if one exists, or the value that will be set when the dbh is next created. .Sp See the DBD::mysql documentation to learn more about this attribute. .IP "\fBmysql_compression [\s-1BOOL\s0]\fR" 4 .IX Item "mysql_compression [BOOL]" Get or set the mysql_compression database handle attribute. This is set directly on the dbh, if one exists. Otherwise, it will be set when the dbh is created. If no value for this attribute is defined (the default) then it will not be set when the dbh is created, deferring instead to whatever default value DBD::mysql chooses. .Sp Returns the value of this attribute in the dbh, if one exists, or the value that will be set when the dbh is next created. .Sp See the DBD::mysql documentation to learn more about this attribute. .IP "\fBmysql_connect_timeout [\s-1BOOL\s0]\fR" 4 .IX Item "mysql_connect_timeout [BOOL]" Get or set the mysql_connect_timeout database handle attribute. This is set directly on the dbh, if one exists. Otherwise, it will be set when the dbh is created. If no value for this attribute is defined (the default) then it will not be set when the dbh is created, deferring instead to whatever default value DBD::mysql chooses. .Sp Returns the value of this attribute in the dbh, if one exists, or the value that will be set when the dbh is next created. .Sp See the DBD::mysql documentation to learn more about this attribute. .IP "\fBmysql_embedded_groups [\s-1STRING\s0]\fR" 4 .IX Item "mysql_embedded_groups [STRING]" Get or set the mysql_embedded_groups database handle attribute. This is set directly on the dbh, if one exists. Otherwise, it will be set when the dbh is created. If no value for this attribute is defined (the default) then it will not be set when the dbh is created, deferring instead to whatever default value DBD::mysql chooses. .Sp Returns the value of this attribute in the dbh, if one exists, or the value that will be set when the dbh is next created. .Sp See the DBD::mysql documentation to learn more about this attribute. .IP "\fBmysql_embedded_options [\s-1STRING\s0]\fR" 4 .IX Item "mysql_embedded_options [STRING]" Get or set the mysql_embedded_options database handle attribute. This is set directly on the dbh, if one exists. Otherwise, it will be set when the dbh is created. If no value for this attribute is defined (the default) then it will not be set when the dbh is created, deferring instead to whatever default value DBD::mysql chooses. .Sp Returns the value of this attribute in the dbh, if one exists, or the value that will be set when the dbh is next created. .Sp See the DBD::mysql documentation to learn more about this attribute. .IP "\fBmysql_enable_utf8 [\s-1BOOL\s0]\fR" 4 .IX Item "mysql_enable_utf8 [BOOL]" Get or set the mysql_enable_utf8 database handle attribute. This is set directly on the dbh, if one exists, by executing the \s-1SQL\s0 \f(CW\*(C`SET NAMES utf8\*(C'\fR. Otherwise, it will be set when the dbh is created. If no value for this attribute is defined (the default) then it will not be set when the dbh is created, deferring instead to whatever default value DBD::mysql chooses. .Sp Returns the value of this attribute in the dbh, if one exists, or the value that will be set when the dbh is next created. .Sp See the DBD::mysql documentation to learn more about this attribute. .IP "\fBmysql_enable_utf8mb4 [\s-1BOOL\s0]\fR" 4 .IX Item "mysql_enable_utf8mb4 [BOOL]" Get or set the mysql_enable_utf8mb4 database handle attribute. This is set directly on the dbh, if one exists, by executing the \s-1SQL\s0 \f(CW\*(C`SET NAMES utf8mb4\*(C'\fR. Otherwise, it will be set when the dbh is created. If no value for this attribute is defined (the default) then it will not be set when the dbh is created, deferring instead to whatever default value DBD::mysql chooses. .Sp Returns the value of this attribute in the dbh, if one exists, or the value that will be set when the dbh is next created. .Sp See the DBD::mysql documentation to learn more about this attribute. .IP "\fBmysql_local_infile [\s-1STRING\s0]\fR" 4 .IX Item "mysql_local_infile [STRING]" Get or set the mysql_local_infile database handle attribute. This is set directly on the dbh, if one exists. Otherwise, it will be set when the dbh is created. If no value for this attribute is defined (the default) then it will not be set when the dbh is created, deferring instead to whatever default value DBD::mysql chooses. .Sp Returns the value of this attribute in the dbh, if one exists, or the value that will be set when the dbh is next created. .Sp See the DBD::mysql documentation to learn more about this attribute. .IP "\fBmysql_multi_statements [\s-1BOOL\s0]\fR" 4 .IX Item "mysql_multi_statements [BOOL]" Get or set the mysql_multi_statements database handle attribute. This is set directly on the dbh, if one exists. Otherwise, it will be set when the dbh is created. If no value for this attribute is defined (the default) then it will not be set when the dbh is created, deferring instead to whatever default value DBD::mysql chooses. .Sp Returns the value of this attribute in the dbh, if one exists, or the value that will be set when the dbh is next created. .Sp See the DBD::mysql documentation to learn more about this attribute. .IP "\fBmysql_read_default_file [\s-1STRING\s0]\fR" 4 .IX Item "mysql_read_default_file [STRING]" Get or set the mysql_read_default_file database handle attribute. This is set directly on the dbh, if one exists. Otherwise, it will be set when the dbh is created. If no value for this attribute is defined (the default) then it will not be set when the dbh is created, deferring instead to whatever default value DBD::mysql chooses. .Sp Returns the value of this attribute in the dbh, if one exists, or the value that will be set when the dbh is next created. .Sp See the DBD::mysql documentation to learn more about this attribute. .IP "\fBmysql_read_default_group [\s-1STRING\s0]\fR" 4 .IX Item "mysql_read_default_group [STRING]" Get or set the mysql_read_default_group database handle attribute. This is set directly on the dbh, if one exists. Otherwise, it will be set when the dbh is created. If no value for this attribute is defined (the default) then it will not be set when the dbh is created, deferring instead to whatever default value DBD::mysql chooses. .Sp Returns the value of this attribute in the dbh, if one exists, or the value that will be set when the dbh is next created. .Sp See the DBD::mysql documentation to learn more about this attribute. .IP "\fBmysql_socket [\s-1STRING\s0]\fR" 4 .IX Item "mysql_socket [STRING]" Get or set the mysql_socket database handle attribute. This is set directly on the dbh, if one exists. Otherwise, it will be set when the dbh is created. If no value for this attribute is defined (the default) then it will not be set when the dbh is created, deferring instead to whatever default value DBD::mysql chooses. .Sp Returns the value of this attribute in the dbh, if one exists, or the value that will be set when the dbh is next created. .Sp See the DBD::mysql documentation to learn more about this attribute. .IP "\fBmysql_ssl [\s-1BOOL\s0]\fR" 4 .IX Item "mysql_ssl [BOOL]" Get or set the mysql_ssl database handle attribute. This is set directly on the dbh, if one exists. Otherwise, it will be set when the dbh is created. If no value for this attribute is defined (the default) then it will not be set when the dbh is created, deferring instead to whatever default value DBD::mysql chooses. .Sp Returns the value of this attribute in the dbh, if one exists, or the value that will be set when the dbh is next created. .Sp See the DBD::mysql documentation to learn more about this attribute. .IP "\fBmysql_ssl_ca_file [\s-1STRING\s0]\fR" 4 .IX Item "mysql_ssl_ca_file [STRING]" Get or set the mysql_ssl_ca_file database handle attribute. This is set directly on the dbh, if one exists. Otherwise, it will be set when the dbh is created. If no value for this attribute is defined (the default) then it will not be set when the dbh is created, deferring instead to whatever default value DBD::mysql chooses. .Sp Returns the value of this attribute in the dbh, if one exists, or the value that will be set when the dbh is next created. .Sp See the DBD::mysql documentation to learn more about this attribute. .IP "\fBmysql_ssl_ca_path [\s-1STRING\s0]\fR" 4 .IX Item "mysql_ssl_ca_path [STRING]" Get or set the mysql_ssl_ca_path database handle attribute. This is set directly on the dbh, if one exists. Otherwise, it will be set when the dbh is created. If no value for this attribute is defined (the default) then it will not be set when the dbh is created, deferring instead to whatever default value DBD::mysql chooses. .Sp Returns the value of this attribute in the dbh, if one exists, or the value that will be set when the dbh is next created. .Sp See the DBD::mysql documentation to learn more about this attribute. .IP "\fBmysql_ssl_cipher [\s-1STRING\s0]\fR" 4 .IX Item "mysql_ssl_cipher [STRING]" Get or set the mysql_ssl_cipher database handle attribute. This is set directly on the dbh, if one exists. Otherwise, it will be set when the dbh is created. If no value for this attribute is defined (the default) then it will not be set when the dbh is created, deferring instead to whatever default value DBD::mysql chooses. .Sp Returns the value of this attribute in the dbh, if one exists, or the value that will be set when the dbh is next created. .Sp See the DBD::mysql documentation to learn more about this attribute. .IP "\fBmysql_ssl_client_cert [\s-1STRING\s0]\fR" 4 .IX Item "mysql_ssl_client_cert [STRING]" Get or set the mysql_ssl_client_cert database handle attribute. This is set directly on the dbh, if one exists. Otherwise, it will be set when the dbh is created. If no value for this attribute is defined (the default) then it will not be set when the dbh is created, deferring instead to whatever default value DBD::mysql chooses. .Sp Returns the value of this attribute in the dbh, if one exists, or the value that will be set when the dbh is next created. .Sp See the DBD::mysql documentation to learn more about this attribute. .IP "\fBmysql_ssl_client_key [\s-1STRING\s0]\fR" 4 .IX Item "mysql_ssl_client_key [STRING]" Get or set the mysql_ssl_client_key database handle attribute. This is set directly on the dbh, if one exists. Otherwise, it will be set when the dbh is created. If no value for this attribute is defined (the default) then it will not be set when the dbh is created, deferring instead to whatever default value DBD::mysql chooses. .Sp Returns the value of this attribute in the dbh, if one exists, or the value that will be set when the dbh is next created. .Sp See the DBD::mysql documentation to learn more about this attribute. .IP "\fBmysql_use_result [\s-1BOOL\s0]\fR" 4 .IX Item "mysql_use_result [BOOL]" Get or set the mysql_use_result database handle attribute. This is set directly on the dbh, if one exists. Otherwise, it will be set when the dbh is created. If no value for this attribute is defined (the default) then it will not be set when the dbh is created, deferring instead to whatever default value DBD::mysql chooses. .Sp Returns the value of this attribute in the dbh, if one exists, or the value that will be set when the dbh is next created. .Sp See the DBD::mysql documentation to learn more about this attribute. .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 max_array_characters, a fatal error will occur. .IP "\fBformat_interval \s-1DURATION\s0\fR" 4 .IX Item "format_interval DURATION" Given a DateTime::Duration object, return a string formatted according to the rules of PostgreSQL's \*(L"\s-1INTERVAL\*(R"\s0 column type. If \s-1DURATION\s0 is undefined, a DateTime::Duration object, a valid interval keyword (according to validate_interval_keyword), or if it looks like a function call (matches \f(CW\*(C`/^\ew+\e(.*\e)$/\*(C'\fR) and keyword_function_calls is true, then it is returned unmodified. .Sp If the resulting string is longer than max_interval_characters, a fatal error will occur. .IP "\fBformat_set \s-1ARRAYREF\s0 | \s-1LIST\s0\fR" 4 .IX Item "format_set ARRAYREF | LIST" Given a reference to an array or a list of values, return a string formatted according to the rules of MySQL's \*(L"\s-1SET\*(R"\s0 data type. Undef is returned if \s-1ARRAYREF\s0 points to an empty array or if \s-1LIST\s0 is not passed. If the array or list contains undefined values, 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 MySQL array data type emulation format returned by \fBformat_array()\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_interval \s-1STRING\s0\fR" 4 .IX Item "parse_interval STRING" Parse \s-1STRING\s0 and return a DateTime::Duration object. \s-1STRING\s0 should be formatted according to the PostgreSQL native \*(L"interval\*(R" (years, months, days, hours, minutes, seconds) data type. .Sp If \s-1STRING\s0 is a DateTime::Duration object, a valid interval keyword (according to validate_interval_keyword), or if it looks like a function call (matches \f(CW\*(C`/^\ew+\e(.*\e)$/\*(C'\fR) and keyword_function_calls is true, then it is returned unmodified. Otherwise, undef is returned if \s-1STRING\s0 could not be parsed as a valid \*(L"interval\*(R" value. .IP "\fBparse_set \s-1STRING\s0 | \s-1LIST\s0 | \s-1ARRAYREF\s0\fR" 4 .IX Item "parse_set STRING | LIST | ARRAYREF" Parse \s-1STRING\s0 and return a reference to an array. \s-1STRING\s0 should be formatted according to MySQL's \*(L"\s-1SET\*(R"\s0 data type. 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 "\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 MySQL \*(L"date\*(R" data type. Valid (case-insensitive) date keywords are: .Sp .Vb 6 \& curdate() \& current_date \& current_date() \& now() \& sysdate() \& 00000\-00\-00 .Ve .Sp 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 MySQL \*(L"datetime\*(R" data type, false otherwise. Valid (case-insensitive) datetime keywords are: .Sp .Vb 11 \& curdate() \& current_date \& current_date() \& current_time \& current_time() \& current_timestamp \& current_timestamp() \& curtime() \& now() \& sysdate() \& 0000\-00\-00 00:00:00 .Ve .Sp 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 MySQL \*(L"timestamp\*(R" data type, false otherwise. Valid (case-insensitive) timestamp keywords are: .Sp .Vb 12 \& curdate() \& current_date \& current_date() \& current_time \& current_time() \& current_timestamp \& current_timestamp() \& curtime() \& now() \& sysdate() \& 0000\-00\-00 00:00:00 \& 00000000000000 .Ve .Sp 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.