Rose::...MariaDB(3pm)

πŸ’– Rose::DB::MariaDB πŸ’–

okay so bestie, this right here is the MariaDB driver class for Rose::DB β€” and yes, it's straight from the User Contributed Perl Documentation (that's the 3pm part, iykyk πŸ“šβœ¨).


✨ SYNOPSIS ✨

  use Rose::DB;

  Rose::DB->register_db(
    domain   => 'development',
    type     => 'main',
    driver   => 'mariadb',
    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::MariaDB->max_array_characters(128);

  $db = Rose::DB->new; # $db is really a Rose::DB::MariaDB-derived object
  ...

πŸ¦‹ DESCRIPTION πŸ¦‹

so like, here's the vibe: when the driver is "mariadb", Rose::DB blesses objects into a class derived from Rose::DB::MariaDB. that whole driver-name-to-class-name mapping? fully configurable πŸ’…. go read Rose::DB's new() and driver_class() methods if you want the deets.

⚠️ bestie listen: this class cannot be used directly. fr fr. you gotta use Rose::DB and let its new() method hand you back an object that's already blessed into the right class, based on its driver_class() mappings. that's the whole thing.

only the methods that are new or that behave differently than the ones in Rose::DB get written up here, okay? for the full list of methods, go check the Rose::DB documentation. periodt. πŸ‘‘


🌸 CLASS METHODS 🌸

πŸ’« coerce_autoincrement_to_serial [BOOL]

get or set a boolean that says whether or not "auto-increment" columns get treated as having the column type "serial". if it's true, then "integer" columns get coerced into the "serial" column type, and "bigint" columns use the "bigserial" column type instead. default value? true βœ….

this setting lowkey comes into play when Rose::DB::Object::Loader is used to auto-create column metadata based on an existing database schema.

πŸ’« max_array_characters [INT]

get or set the maximum length of varchar columns used to emulate the array data type. default value is 255.

here's the tea: MariaDB does not have a native "ARRAY" data type, so this data type gets emulated using a "VARCHAR" column plus a specially formatted string. the formatting and parsing of that string is handled by the format_array and parse_array object methods. and that maximum length limit? honored by the format_array object method. no cap. πŸŽ€

πŸ’« max_array_characters's bestie β€” max_interval_characters [INT]

get or set the maximum length of varchar columns used to emulate the interval data type. default value is 255.

same situation as above: MariaDB doesn't have a native "interval" data type, so it gets emulated using a "VARCHAR" column and a specially formatted string. formatting and parsing of this string is handled by the format_interval and parse_interval object methods, and the maximum length limit is honored by the format_interval object method. πŸ’œ


🫢 OBJECT METHODS 🫢

quick housekeeping bestie: for basically all of these, the pattern is the same β€” they're database handle (dbh) attributes. they get set directly on the dbh if one already exists. if not, they'll be set whenever the dbh gets created. if no value is defined for the attribute (that's the default), then it just won't be set when the dbh is created, deferring instead to whatever default value DBD::MariaDB picks. and the getter returns the value of the attribute in the dbh if one exists, or the value that will be set when the dbh is next created. and yes, all of them say "see the DBD::MariaDB documentation to learn more about this attribute." iykyk πŸ’…

⭐ mariadb_auto_reconnect [BOOL]

get or set the mariadb_auto_reconnect database handle attribute. set directly on the dbh if one exists; otherwise it gets set when the dbh is created. if no value is defined (that's the default), it won't be set when the dbh is created β€” it defers to whatever default DBD::MariaDB chooses instead.

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.

see the DBD::MariaDB documentation to learn more about this attribute.

⭐ mariadb_bind_type_guessing [BOOL]

get or set the mariadb_bind_type_guessing database handle attribute. set directly on the dbh if one exists; otherwise it'll 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::MariaDB chooses.

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.

see the DBD::MariaDB documentation to learn more about this attribute.

⭐ mariadb_client_found_rows [BOOL]

get or set the mariadb_client_found_rows database handle attribute. it goes straight onto the dbh if one exists; otherwise it lands when the dbh is created. no value defined (the default)? then it's not set at creation time, and whatever DBD::MariaDB defaults to wins.

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.

see the DBD::MariaDB documentation to learn more about this attribute.

⭐ mariadb_compression [BOOL]

get or set the mariadb_compression database handle attribute. 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::MariaDB chooses.

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.

see the DBD::MariaDB documentation to learn more about this attribute.

⭐ mariadb_connect_timeout [BOOL]

get or set the mariadb_connect_timeout database handle attribute. set directly on the dbh if one exists; otherwise it'll 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::MariaDB chooses.

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.

see the DBD::MariaDB documentation to learn more about this attribute.

⭐ mariadb_embedded_groups [STRING]

get or set the mariadb_embedded_groups database handle attribute. 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::MariaDB chooses.

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.

see the DBD::MariaDB documentation to learn more about this attribute.

⭐ mariadb_embedded_options [STRING]

get or set the mariadb_embedded_options database handle attribute. 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::MariaDB chooses.

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.

see the DBD::MariaDB documentation to learn more about this attribute.

⭐ mariadb_enable_utf8 [BOOL]

get or set the mariadb_enable_utf8 database handle attribute. ⚠️ heads up, this one's a lil different: if a dbh already exists, it's set directly on the dbh by executing the SQL SET NAMES utf8. 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::MariaDB chooses.

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.

see the DBD::MariaDB documentation to learn more about this attribute.

⭐ mariadb_enable_utf8mb4 [BOOL]

get or set the mariadb_enable_utf8mb4 database handle attribute. ⚠️ another special one: if a dbh exists, it's set directly on the dbh by executing the SQL SET NAMES utf8mb4. 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::MariaDB chooses.

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.

see the DBD::MariaDB documentation to learn more about this attribute.

⭐ mariadb_local_infile [STRING]

get or set the mariadb_local_infile database handle attribute. 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::MariaDB chooses.

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.

see the DBD::MariaDB documentation to learn more about this attribute.

⭐ mariadb_multi_statements [BOOL]

get or set the mariadb_multi_statements database handle attribute. 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::MariaDB chooses.

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.

see the DBD::MariaDB documentation to learn more about this attribute.

⭐ mariadb_read_default_file [STRING]

get or set the mariadb_read_default_file database handle attribute. 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::MariaDB chooses.

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.

see the DBD::MariaDB documentation to learn more about this attribute.

⭐ mariadb_read_default_group [STRING]

get or set the mariadb_read_default_group database handle attribute. 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::MariaDB chooses.

Returns the value of this attribute in the dbh, if one exists β€” or, if there's no dbh yet, the value that's gonna get set when the dbh is next created. πŸ’«

See the DBD::MariaDB documentation to learn more about this attribute. ✨


  • mariadb_socket [STRING] β€” get or set the mariadb_socket database handle attribute. πŸ”Œ
    • Got a dbh already? Then it's set directly on that dbh. No dbh yet? It gets set the moment the dbh is created.
    • If no value is defined for this attribute β€” and that's the default, btw, no cap β€” then it will not be set when the dbh is created, and we just defer to whatever default value DBD::MariaDB chooses. πŸŽ€
    • 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.
    • See the DBD::MariaDB documentation to learn more about this attribute.
  • mariadb_ssl [BOOL] β€” get or set the mariadb_ssl database handle attribute. πŸ”
    • If a dbh exists, it goes straight onto it. Otherwise it will be set when the dbh is created.
    • No value defined for this attribute (the default ✨) means it won't be set when the dbh is created at all β€” we defer instead to whatever default value DBD::MariaDB chooses.
    • 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.
    • See the DBD::MariaDB documentation to learn more about this attribute.
  • mariadb_ssl_ca_file [STRING] β€” get or set the mariadb_ssl_ca_file database handle attribute. πŸ“
    • It's set directly on the dbh if one exists; if not, it gets set when the dbh is created.
    • If no value is defined for this attribute (that's the default, bestie πŸ’…), then it will not be set when the dbh is created β€” we defer to whatever default value DBD::MariaDB chooses.
    • 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.
    • See the DBD::MariaDB documentation to learn more about this attribute.
  • mariadb_ssl_ca_path [STRING] β€” get or set the mariadb_ssl_ca_path database handle attribute. πŸ—‚οΈ
    • When there's a dbh, it gets set right on it. When there isn't, it'll be set once the dbh is created.
    • If no value for this attribute is defined (yes, that's the default πŸ’–), it won't get set when the dbh is created β€” instead we defer to whatever default value DBD::MariaDB chooses.
    • 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.
    • See the DBD::MariaDB documentation to learn more about this attribute.
  • mariadb_ssl_cipher [STRING] β€” get or set the mariadb_ssl_cipher database handle attribute. πŸ”’
    • Existing dbh? Set directly on it. No dbh? It'll be set when the dbh is created.
    • If there's no value defined for this attribute (the default, periodt), it will not be set when the dbh is created, deferring instead to whatever default value DBD::MariaDB chooses.
    • 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.
    • See the DBD::MariaDB documentation to learn more about this attribute.
  • mariadb_ssl_client_cert [STRING] β€” get or set the mariadb_ssl_client_cert database handle attribute. πŸ“œ
    • This one's set directly on the dbh when one exists. Otherwise, it gets set when the dbh is created.
    • If no value for this attribute is defined (which is the default 🫢), then it won't be set when the dbh is created β€” we just defer to whatever default value DBD::MariaDB chooses.
    • 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.
    • See the DBD::MariaDB documentation to learn more about this attribute.
  • mariadb_ssl_client_key [STRING] β€” get or set the mariadb_ssl_client_key database handle attribute. πŸ—οΈ
    • It gets set directly on the dbh if one exists; otherwise it'll be set when the dbh is created.
    • No value defined for this attribute? That's the default πŸ’œ and it means nothing gets set when the dbh is created β€” we defer to whatever default value DBD::MariaDB chooses.
    • 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.
    • See the DBD::MariaDB documentation to learn more about this attribute.
  • mariadb_use_result [BOOL] β€” get or set the mariadb_use_result database handle attribute. πŸ“
    • With a dbh present it's set right on the dbh; without one, it gets set when the dbh is created.
    • If there's no value defined for this attribute (the default, as always), it will not be set when the dbh is created, deferring instead to whatever default value DBD::MariaDB chooses.
    • 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.
    • See the DBD::MariaDB documentation to learn more about this attribute.

πŸ¦‹ Value Parsing and Formatting πŸ¦‹

  • format_array ARRAYREF | LIST β€” hand it a reference to an array or a list of values, and it hands back a specially formatted string. 🌈
    • undef comes back if ARRAYREF points to an empty array, or if LIST wasn't passed at all.
    • The array or list must not contain undefined values. πŸ™ˆ
    • If the resulting string ends up longer than max_array_characters, it's a fatal error, no cap. πŸ’€
  • format_interval DURATION β€” give it a DateTime::Duration object and it returns 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 (per validate_interval_keyword), or if it looks like a function call (matches "/^\w+\(.*\)$/") and keyword_function_calls is true, then it's returned unmodified.
    • If the resulting string is longer than max_interval_characters, that's a fatal error. 😭
  • format_set ARRAYREF | LIST β€” give it a reference to an array or a list of values, and it returns a string formatted according to the rules of MariaDB's "SET" data type. πŸŽ€
    • undef is returned if ARRAYREF points to an empty array, or if LIST isn't passed.
    • If the array or list contains undefined values, that's a fatal error. πŸ’€
  • parse_array STRING | LIST | ARRAYREF β€” parses STRING and returns a reference to an array. 🌸
    • STRING should be formatted according to the MariaDB 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, you get back a reference to an array containing the values in LIST.
    • If an ARRAYREF is passed, it's returned as-is. πŸ’…
  • parse_interval STRING β€” parses STRING and returns 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 (per validate_interval_keyword), or if it looks like a function call (matches "/^\w+\(.*\)$/") and keyword_function_calls is true, then it's returned unmodified.
    • Otherwise, undef is returned if STRING could not be parsed as a valid "interval" value.
  • parse_set STRING | LIST | ARRAYREF β€” parses STRING and returns a reference to an array. ✨
    • STRING should be formatted according to MariaDB'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 an ARRAYREF is passed, it's returned as-is. 🫢
  • validate_date_keyword STRING β€” returns true if STRING is a valid keyword for the MariaDB "date" data type. πŸ“… Valid (case-insensitive) date keywords are:
curdate()
current_date
current_date()
now()
sysdate()
00000-00-00

Any string that looks like a function call (matches /^\w+\(.*\)$/) is also considered a valid date keyword if keyword_function_calls is true.

  • validate_datetime_keyword STRING β€” returns true if STRING is a valid keyword for the MariaDB "datetime" data type, false otherwise. πŸ—“οΈ Valid (case-insensitive) datetime keywords are:
curdate()
current_date
current_date()
current_time
current_time()
current_timestamp
current_timestamp()
curtime()
now()
sysdate()
0000-00-00 00:00:00

Any string that looks like a function call (matches /^\w+\(.*\)$/) is also considered a valid datetime keyword if keyword_function_calls is true. πŸ’«

  • validate_timestamp_keyword STRING β€” returns true if STRING is a valid keyword for the MariaDB "timestamp" data type, false otherwise. ⏱️ Valid (case-insensitive) timestamp keywords are:
curdate()
current_date
current_date()
current_time
current_time()
current_timestamp
current_timestamp()
curtime()
now()
sysdate()
0000-00-00 00:00:00
00000000000000

Any string that looks like a function call (matches /^\w+\(.*\)$/) is also considered a valid timestamp keyword if keyword_function_calls is true. πŸ”₯


πŸ‘‘ AUTHOR πŸ‘‘

John C. Siracusa (siracusa@gmail.com) β€” the icon who wrote all this, we love to see it. πŸ’–


πŸ“œ LICENSE πŸ“œ

Copyright (c) 2020 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. That's the whole vibe, bestie. 🌈


And that's a wrap on this page! πŸŽ‰ It came from perl v5.40.1, dated 2026-07-31, and its home is Rose::...MariaDB(3pm). Go forth and query slayfully. πŸ’…πŸ‘‘

πŸ“¦ where this page comes from