Rose::DB::MySQL - MySQL driver class for Rose::DB. use Rose::DB; Rose::DB->register_db( domain => 'development', type => 'main', driver => 'mysql', database => 'dev_db', host => 'localhost', username => 'devuser', password => 'mysecret', ); 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::MySQL->max_array_characters(128); $db = Rose::DB->new; # $db is really a Rose::DB::MySQL-derived object ... Rose::DB blesses objects into a class derived from Rose::DB::MySQL when the driver is "mysql". 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. 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. Get or set the maximum length of varchar columns used to emulate the array data type. The default value is 255. MySQL does not have a native "ARRAY" data type, but this data type 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. Get or set the maximum length of varchar columns used to emulate the interval data type. The default value is 255. MySQL does not have a native "interval" data type, but this data type can be emulated using a "VARCHAR" 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.

Value Parsing and Formatting
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. Given a DateTime::Duration object, return a string formatted according to the rules of PostgreSQL's "INTERVAL" column type. If DURATION is undefined, a DateTime::Duration object, a valid interval keyword (according to validate_interval_keyword), or if it looks like a function call (matches "/^\w+\(.*\)$/") then it is returned unmodified. If the resulting string is longer than max_interval_characters, a fatal error will occur. Given a reference to an array or a list of values, return a string formatted according to the rules of MySQL's "SET" data type. Undef is returned if ARRAYREF points to an empty array or if LIST is not passed. If th array or list contains undefined values, a fatal error will occur. Parse STRING and return a reference to an array. STRING should be formatted according to the MySQL 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 STRING and return a DateTime::Duration object. STRING should be formatted according to the PostgreSQL native "interval" (years, months, days, hours, minutes, seconds) data type. If STRING is a DateTime::Duration object, a valid interval keyword (according to validate_interval_keyword), or if it looks like a function call (matches "/^\w+\(.*\)$/") then it is returned unmodified. Otherwise, undef is returned if STRING could not be parsed as a valid "interval" value. Parse STRING and return a reference to an array. STRING should be formatted according to MySQL's "SET" data type. 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. Returns true if STRING is a valid keyword for the MySQL "date" data type. Valid date keywords are: 00000-00-00 Any string that looks like a function call (matches /^\w+\(.*\)$/) is also considered a valid date keyword. Returns true if STRING is a valid keyword for the MySQL "datetime" data type, false otherwise. Valid datetime keywords are: 0000-00-00 00:00:00 Any string that looks like a function call (matches /^\w+\(.*\)$/) is also considered a valid datetime keyword. Returns true if STRING is a valid keyword for the MySQL "timestamp" data type, false otherwise. Valid timestamp keywords are: 0000-00-00 00:00:00 00000000000000 Any string that looks like a function call (matches /^\w+\(.*\)$/) is also considered a valid timestamp keyword. John C. Siracusa (siracusa@mindspring.com) Copyright (c) 2006 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.