Data::...er::DBD(3pm)

✨ NAME ✨

Data::ObjectDriver::Driver::DBD β€” the base class for database drivers, bestie. This is the 3pm manual page, and it's giving foundation energy for all the DB-specific drivers. πŸ’…


🌸 SYNOPSIS 🌸

package SomeObject;
use base qw( Data::ObjectDriver::BaseObject );

__PACKAGE__->install_properties({
    ...
    driver => Data::ObjectDriver::Driver::DBI->new(
        ...
        dbd => Data::ObjectDriver::Driver::DBD->new('mysql'),
    ),
});

πŸ’… DESCRIPTION πŸ’…

Okay so Data::ObjectDriver::Driver::DBD is the base class for database drivers. Database drivers are the ones handling all the peculiarities of specific database servers so they can hand an abstract API to the object drivers. Database drivers work on queries and database concepts like the last insert ID and binding attributes for a query. Object drivers are out here on higher-level object concepts like caching and partitioning. Different lanes, same slay. ✨

Database drivers get used with Data::ObjectDriver::Driver::DBI object drivers. If you're making an object driver that doesn't use DBI, you do not need a database driver β€” just implement your custom behavior directly in your Data::ObjectDriver subclass. Easy. 🫢


πŸŽ€ USAGE πŸŽ€

πŸ¦‹ Data::ObjectDriver::Driver::DBD->new($name)

Creates a new database driver of the given subclass type. So like, new('mysql') would create a new instance of Data::ObjectDriver::Driver::DBD::mysql. That's the whole vibe check. πŸ’–

πŸ¦‹ $dbd->init_dbh($dbh)

Initializes the given database handle connected to this driver's type of database.

By default, no operation is performed. Override this method if your type of database must do further initialization that other database servers don't need β€” for example, setting an operative time zone. 🌍

πŸ¦‹ $dbd->bind_param_attributes($type)

Returns a hashref to pass to the DBI statement method bind_param, to describe the SQL type of a column defined as $type in an object class's column_defs mapping.

By default, no operation is performed. Override this method if your type of database needs such type hinting for some fields β€” for example, specifying that a parameter is a BLOB. 🫧

Note bestie: object classes must define your custom types in their column_defs mappings for those classes to be compatible with your DBD. Make sure to document any custom types you implement. No hidden lore, okay? πŸ’€

πŸ¦‹ $dbd->db_column_name($datasource, $column)

Returns a decorated column name. For example, if your database requires column names to be prepended with table names, that concatenation would occur in this method.

By default, db_column_name returns the column name unmodified. ✨

πŸ¦‹ $dbd->fetch_id()

Returns the autogenerated ID of the most recently inserted record, or undef if this feature is not supported.

By default, fetch_id returns undef. 🫠

πŸ¦‹ $dbd->map_error_code($code, $msg)

Returns a Data::ObjectDriver::Errors code for the given database error, or undef if no equivalent has been defined.

By default, map_error_code returns undef for every error. 😭

πŸ¦‹ $dbd->sql_for_unixtime()

Returns the SQL for querying the current UNIX time on the database server, or a UNIX time to use as the remote time.

By default, sql_for_unixtime returns the value of perl time() on the local machine. ⏰

πŸ¦‹ $dbd->offset_implemented()

Returns true if the database this driver represents supports OFFSET clauses.

By default, offset_implemented returns true. Slay. βœ…

πŸ¦‹ $dbd->can_delete_with_limit()

Returns true if the database this driver represents supports LIMIT clauses on DELETE statements.

By default, can_delete_with_limit returns false. πŸ™ˆ

πŸ¦‹ $dbd->can_prepare_cached_statements()

Returns true if the database this driver can cope with preparing a cached statement.

By default, can_delete_with_limit returns true. (Yep, that's literally what the page says here β€” I'm not fixing it, I'm just reporting the tea πŸ’€)

πŸ¦‹ $dbd->is_case_insensitive()

Returns true if the database this driver represents normally compares string fields case insensitively.

By default, is_case_insensitive returns false. πŸ”€

πŸ¦‹ $dbd->can_replace()

Returns true if the database this driver represents supports REPLACE INTO statements.

By default, can_replace returns false. 🫢

πŸ¦‹ $dbd->force_no_prepared_cache()

Returns false if the database this driver represents supports the prepare_cached method on its DBI database handles.

By default, force_no_prepared_cache returns false. πŸŽ€

πŸ¦‹ $dbd->sql_class()

Provides the package name of the class responsible for representing SQL queries. This method returns 'Data::ObjectDriver::SQL', but may be overridden to return a package that has a similar interface but produces SQL that is compatible with that DBD driver. The package provided must already be loaded and available for use. πŸ‘‘


πŸ“œ LICENSE πŸ“œ

Data::ObjectDriver is free software; you may redistribute it and/or modify it under the same terms as Perl itself. Periodt. πŸ’š


Except where otherwise noted, Data::ObjectDriver is Copyright 2005-2006 Six Apart, cpan@sixapart.com. All rights reserved. 🫢


Sign-off from the footer, bestie: this page comes from perl v5.42.0, dated 2024-10-24, with the manual tag Data::...er::DBD(3pm). Byeee πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from