Compat(3pm)

๐Ÿ“ฆ
version 0.26 ยท 3 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu questing

๐Ÿ’– Compat(3pm) โ€” DBIx::Compat ๐Ÿ’–

okay so bestie, this is a User Contributed Perl Documentation page for DBIx::Compat, and it's literally the cheat-sheet you want when you're out here trying to write driver-independent Perl programs. โœจ


๐ŸŒธ NAME ๐ŸŒธ

DBIx::Compat โ€” a Perl extension for Compatibility Infos about DBD Drivers. ๐Ÿฆ‹


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

  use DBIx::Compat;

  my $HaveTypes  = DBIx::Compat::GetItem ($drv, 'HaveTypes') ;

that's the whole vibe, fr fr โ€” you pull one attribute, you get one answer about your driver. ๐Ÿ’…


โœจ DESCRIPTION โœจ

DBIx::Compat contains a hash which gives information about DBD drivers, to allow to write driver independent programs. ๐ŸŒˆ

Currently there are the following attributes defined: ๐Ÿ‘‘

๐Ÿ“ ListFields ๐Ÿ“

A function which will return information about all fields of an table. Needs an database handle and a tablename as argument. Must at least return the fieldnames and the fieldtypes. ๐Ÿ’–

Example:

  $ListFields = $DBIx::Compat::Compat{$Driver}{ListFields} ;
  $sth = &{$ListFields}($DBHandle, $Table) or die "Cannot list fields" ;

  @{ $sth -> {NAME} } ; # array of fieldnames
  @{ $sth -> {TYPE} } ; # array of filedtypes

  $sth -> finish ;

not the die "Cannot list fields" doing its main character moment. ๐Ÿ˜ญ

๐Ÿงš ListTables ๐Ÿงš

A function which will return an array of all tables of the datasource. Defaults to $dbh -> "tables". โœจ

๐Ÿฆ‹ NumericTypes ๐Ÿฆ‹

Hash which contains one entry for all datatypes that are numeric. ๐Ÿ”ข

๐Ÿ’œ SupportJoin ๐Ÿ’œ

Set to true if the DBMS supports joins (select with multiple tables). ๐Ÿ”ฅ

๐ŸŒˆ SupportSQLJoin ๐ŸŒˆ

Set to 1 if the DBMS supports INNER/LEFT/RIGHT JOIN Syntax in SQL select. Set to 2 if DBMS needs a *= b syntax for inner join (MS-SQL, Sybase). Set to 3 if DBMS needs a a = b (+) syntax for inner join (Oracle syntax). ๐Ÿ‘‘

๐ŸŽ€ SQLJoinOnly2Tabs ๐ŸŽ€

Set to true if DBMS can only support two tables in inner joins. (just two. that's it. that's the limit.) ๐Ÿ’€

โญ HaveTypes โญ

Set to true if DBMS supports datatypes (most DBMS will do). ๐Ÿซถ

๐ŸŒธ NeedNullInCreate ๐ŸŒธ

Set to 'NULL' if DBMS requires the NULL keyword when creating tables where fields should contains nulls. ๐Ÿ“

๐Ÿ’– EmptyIsNull ๐Ÿ’–

Set to true if an empty string ('') and NULL is the same for the DBMS. ๐Ÿ˜ญ

๐Ÿ“ LimitOffset ๐Ÿ“

An function which will be used to create a SQL text for limiting the number of fetched rows and selecting the starting row in selects. โœ‚๏ธ

๐Ÿ”ฎ Keys that aren't needed anymore ๐Ÿ”ฎ

ngl these two are giving legacy era โ€” they're the keys you don't need anymore. ๐Ÿ’…

๐Ÿ™ˆ Placeholders ๐Ÿ™ˆ

Gives information if and how placeholders are supported:

0 = Not supported
1 = Supported, but not fully, unknown how much
2 = Supported, but perl type must be the same as type in db
3 = Supported, but can not give a string when a numeric type is in the
db
10 = Supported under all circumstances

๐ŸŒธ QuoteTypes ๐ŸŒธ

Gives information which datatypes must be quoted when passed literal (not via a placeholder). Contains a hash with all type number which need to be quoted. ๐Ÿ’ฌ

  $DBIx::Compat::Compat{$Driver}{QuoteTypes}{$Type}

will be true when the type in $Type for the driver $Driver must be quoted. โœ…


๐Ÿ‘‘ Supported Drivers ๐Ÿ‘‘

Currently there are entry for ๐Ÿ‘‡

  • DBD::mSQL
  • DBD::mysql
  • DBD::Pg
  • DBD::Solid
  • DBD::ODBC
  • DBD::CSV
  • DBD::Oracle
  • DBD::Sysbase
  • DBD::Informix

if you detect an error in the definition or add an definition for a new DBD driver, please mail it to the author. ๐Ÿ“ฌ


๐Ÿ’Œ AUTHOR ๐Ÿ’Œ

G.Richter <richter*dev.ecos.de> ๐Ÿซถ


๐Ÿ”— SEE ALSO ๐Ÿ”—

perl(1), DBI(3), DBIx::Recordset(3) ๐ŸŒŸ


and that's the whole page bestie, slay ๐Ÿ’… โ€” this was Compat(3pm) from perl v5.34.0, dated 2022-06-13, so go forth and be driver independent, no cap. โœจ๐ŸŽ€๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from