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
Oryx::DBI::Util(3) User Contributed Perl Documentation Oryx::DBI::Util(3)

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

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

column_exists( $dbh, $table, $column )
Returns a true value if the column named $column exists in table named $table in database $dbh.
column_create( $dbh, $table, $colname, $coltype )
Adds a column to the table named $table named $colname with type $coltype in database $dbh.
column_drop( $dbh, $table, $colname )
Removes the column named $$colname from the table named $table in database $dbh.
table_exists( $dbh, $table )
Returns a true value if the table $table exists in $dbh.
table_create( $dbh, $table, \@columns, \@types )
Creates a table named $table with columns @columns having types @types in database $dbh.
table_drop( $dbh, $table )
Drops the table named $table in database $dbh.
type2sql( $type, $size )
Given an Oryx primitive type $type and an optional size, $size, this method returns the SQL type for the current connection.
lastval( $dbh, $table )
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.

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.

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

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

Andrew Sterling Hanenkamp <hanenkamp@cpan.org>

Copyright (C) 2005 Richard Hundt.

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

2006-02-17 perl v5.32.1

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

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