SPOPS logo


SPOPS::DBI::InterBase -- InterBase-specific routines for the SPOPS::DBI


 # In your configuration:
 'myspops' => {
     'isa' => [ qw/ SPOPS::DBI::InterBase SPOPS::DBI / ],
     # If you use a generator to create unique keys, set
     # increment_field to a true value...
     'increment_field' => 1,
     # and set 'sequence_name' to the name of the generator
     'sequence_name'   => 'mygen',
     # ...optionally, you can also specify the increment for the
     # generated values (defaults to 1 if not specified)
     'sequence_increment' => 4,


This just implements some InterBase-specific routines so we can abstract them out.

The main one is to be able to utilize an existing generator object for creating unique key values. We cannot use the same pattern as with Oracle/PostgreSQL sequences because there does not seem to be a way to retrieve the current (rather than next) value from a generator object.

Therefore, we need to retrieve the next value from the database and use that in the INSERT. (This happens in the background, no worry to you.)

How to implement this:

 CREATE TABLE my_table (
   id int not null primary key,
 CREATE GENERATOR my_generator;

You must to let this module know if you are using this option by setting in your class configuration the key 'increment_field' to a true value and also setting key 'sequence_name' to the name of your generator.

 $spops = {
    myobj => {
       class => 'My::Object',
       isa   => [ qw/ SPOPS::DBI::InterBase  SPOPS::DBI / ],
       increment_field => 1,
       sequence_name => 'my_generator',

The key 'sequence_name' rather than 'generator_name' is used to be compatible with other databases.



Returns 'CURRENT_TIMESTAMP', used in InterBase to return the value for right now.

TODO: See how this is used and whether we need to add another methods for executing this as a standalone statement ('SELECT CURRENT_TIMESTAMP' on its own does not work.)


Returns 'LIKE' right now, even though this does not seem to be correct.

TODO: See if there is a separate operator for case-insensitive matching.

sql_quote( $value, $data_type, [ $db_handle ] )

DBD::InterBase uses the type of a field if you are quoting values to put into a statement, so we override the default 'sql_quote' from SPOPS::SQLInterface to ensure the type of the field is used in the DBI->quote call.

The $data_type should correspond to one of the DBI datatypes (see the file 'dbi_sql.h' in your Perl library tree for more info). If the DBI database handle $db_handle is not passed in, we try to find it with the class method global_datasource_handle().

pre_fetch_id( \%params )

If 'increment_field' is not set we do not fetch an ID. If 'sequence_name' is not also set we do not fetch an ID. Otherwise we execute a statement like:

 SELECT GEN_ID( $name, $increment ) FROM RDB$DATABASE


  $name      - Value of 'sequence_name'
  $increment - Either 'sequence_increment' or 1

post_fetch_id( \%params )

Not used.


Minimally tested, potentially with buggy InterBase knowledge.


Nothing known.





Copyright (c) 2002-2004 intes.net, inc.. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


Chris Winters <chris@cwinters.com>

Generated from the SPOPS 0.87 source.

SourceForge Logo