ObjectDBI

Perl Object Persistence in an RDBMS using DBI
Download

ObjectDBI Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Kees Jan Hermans
  • Publisher web site:
  • http://search.cpan.org/~kjh/

ObjectDBI Tags


ObjectDBI Description

Perl Object Persistence in an RDBMS using DBI ObjectDBI is a Perl Object Persistence in an RDBMS using DBI.SYNOPSISSerializes, queries, unserializes and deletes perl objects in an SQL driven, DBI accessible RDBMS.MODULECreated to use RDBMS-es as perl object storage, even when very primitive RDBMS-es are involved. The advantage is portability of your project (you don't have to transport a dbm or flat files with your project that is also RDBMS-based), a certain degree of discoverability (you can use plain SQL yourself to see what's inside the database), and searchability (metadata and data don't get equated). You must create a table for this storage, and (an idea for) the SQL for that is given below:SQLPostgreSQL or Oracle: create sequence perlobjectseq; create table "perlobjects" ( obj_id integer unique not null, obj_pid integer references perlobjects (obj_id), obj_gpid integer references perlobjects (obj_id), obj_name varchar(255), obj_type varchar(64), obj_value varchar(255) );MySQL: create table perlobjects ( obj_id integer unique not null auto_increment, obj_pid integer references perlobjects (obj_id), obj_gpid integer references perlobjects (obj_id), obj_name varchar(255), obj_type varchar(64), obj_value varchar(255) );Indexes: create index ob_name_i on perlobjects (obj_name); create index ob_type_i on perlobjects (obj_type); create index ob_value_i on perlobjects (obj_value);Now before y'all start shouting; obviously, given your particular type of RDBMS, your mileage may vary with respect to this SQL code, and you may not have primary or foreign keys. You may not have indexes or sequences, and you may even have an easier way to store infinite strings. This is all up to you, your cleverness and your needs.If you plan to store perlhashes with keys of more than 255 character length (which is an unwise thing in itself), for example, then you might consider making 'obj_name' a bit longer. If you plan to store values with characters outside of the 32-126 range and you're using Postgres, then you might want to change the data type of 'obj_value' from 'varchar' to 'bytea'. This module isn't here to lecture you - just to make things easy.If you're using MySQL, you'll have problems without a sequence, so you'll have to make the 'obj_id' field auto-incrementing. For those users, a special piece of code is added to withdraw the id of an object after the fact of its insertion.If you're using a RDBMS that doesn't do sequences OR auto-incrementing, then IDs are generated out of thin air. Be prepared to work with large numbers though. If your RDBMS can't handle those - well, then I'm at my wit's end: please provide a 'sequencefnc' to the constructor. Requirements: · Perl What's New in This Release: · Changed the test scripts at the behest of Slaven Rezic. I'm really sorry for wasting everyone's time with this, but the whole 'testing' thing is still a bit foreign to me.


ObjectDBI Related Software