GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  ORYX::DBI::UTIL (3)

.ds Aq ’

NAME

Oryx::DBI::Util - abstract base class for Oryx DBI utilities

CONTENTS

DESCRIPTION

Oryx::DBI::Util represents an interface to be implemented in order to add support for additional RDBMS’. The following methods must be implemented:

METHODS

<B>column_exists( B>$dbh<B>, B>$table<B>, B>$column<B> )B> Returns a true value if the column named $column exists in table named $table in database $dbh.
<B>column_create( B>$dbh<B>, B>$table<B>, B>$colname<B>, B>$coltype<B> )B> Adds a column to the table named $table named $colname with type $coltype in database $dbh.
<B>column_drop( B>$dbh<B>, B>$table<B>, B>$colname<B> )B> Removes the column named $$colname from the table named $table in database $dbh.
<B>table_exists( B>$dbh<B>, B>$table<B> )B> Returns a true value if the table $table exists in $dbh.
<B>table_create( B>$dbh<B>, B>$table<B>, \@columns, \@types )B> Creates a table named $table with columns @columns having types @types in database $dbh.
<B>table_drop( B>$dbh<B>, B>$table<B> )B> Drops the table named $table in database $dbh.
<B>type2sql( B>$type<B>, B>$size<B> )B> Given an Oryx primitive type $type and an optional size, $size, this method returns the SQL type for the current connection.
<B>lastval( B>$dbh<B>, B>$table<B> )B> Returns what should be the last insert ID used for table $table in database $dbh. However, due to some DBD driver limitations, this method should not be used except to check the last insert ID of an insertion that happened in a statement executed immediately previous to calling this method.

    IMPLEMENTORS

In order to allow Oryx to store data in a database other than those already supported, one need only provide an implementation for a utility class for use with the appropriate driver.

The utility class should inherit from Oryx::DBI::Util and should provide implementations appropriate for all of the methods documented here. Since DBI and standard SQL make the implementation very similar across databases, many of the methods are defined here already. You should examine this class for the default implementations to see if they need to be overridden. You will, at the very least, need to provide either an array named %SQL_TYPES in your class or and implementation of type2sql():



  # Taken from Oryx::DBI::Util::Pg at the time of writing
  our %SQL_TYPES = (
      Oid       => serial PRIMARY KEY,
      Integer   => integer,
      String    => varchar,
      Text      => text,
      Binary    => bytea,
      Float     => numeric,
      Boolean   => integer,
      DateTime  => timestamp,
  );



You may also want to examine the code found in the utilities already provided. As of this writing, this includes Oryx::DBI::Util::Pg for PostgreSQL accessed via DBD::Pg, Oryx::DBI::Util::mysql for MySQL accessed via DBD::mysql, and Oryx::DBI::Util::SQLite for SQLite accessed via DBD::SQLite.

SEE ALSO

Oryx::DBI, Oryx::DBI::Class, Oryx::DBI::Util::Pg, Oryx::DBI::Util::mysql, Oryx::DBI::Util::SQLite, DBI

AUTHORS

Richard Hundt <richard NO SPAM AT protea-systems.com>

Andrew Sterling Hanenkamp <hanenkamp@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2005 Richard Hundt.

This library is free software and may be used under the same terms as Perl itself.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 ORYX::DBI::UTIL (3) 2006-02-17

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.