NAME

Persist::Driver::Memory - Persist driver for an in Memory source

SYNOPSIS

use Persist::Source;

$source = new Persist::Source('Persist::Driver::Memory');

# Use other Persist::Source methods ...

DESCRIPTION

This driver provides access to a memory database. This class shouldn't be used directly, but through Persist::Source. It should be noted that this driver is mostly intended for testing and doesn't really provide any kind of persistent data store. The database is always blank upon creation or connection.

It should also be noted that no form of constraint checking is performed. Any field may contain any type of data. Again, this driver is, at this time, only provided for testing purposes.

$driver = new Persist::Driver::Memory

Creates a new empty database. Requires no arguments. All connections are DBA connections--this only makes sense since it's just an in memory database.

$test = $driver->is_dba

Always returns true.

@conn = $driver->new_source

The return value doesn't matter since each instance of the memory driver creates a new blank data source. There are no arguments required to connect to or create a database.

$driver->delete_source

Doesn't do anything but return true. Memory databases are deleted by the garbage collector when the last reference to it is removed.

$driver->create_table($name, $columns, $indexes)

Records the schema and returns success. None of the given constraints will be enforced, but are remembered for later reference by the tables, columns, and indexes methods. Also, empty hash indexes are created for each index given in indexes.

$driver->delete_table($name)

Forgets the schema and data and returns success.

$driver->tables

Returns the names of all the tables that have been created since connection.

$handle = $driver->open_table($table [, $filter ])

Returns a handle for accessing the data in the table.

$handle = $driver->open_join(%args)

Returns a handle for accessing a joined set of tables.

$rows = $driver->insert(%args)

Inserts a row into the table and returns 1.

$rows = $driver->update(%args) )

Updates the table rows specified by filter to the values in set.

$rows = $driver->delete(%args)

Deletes the table rows specified by filter.

%columns = $driver->columns(%args)

Returns the column definition used to define the given table.

@indexes = $driver->indexes(%args)

Returns the index definition used to define the given table.

$row = $driver->first($handle)

Retrieves the first column matched by the handle. This method doesn't require very much more overhead than a call to next.

$row = $driver->next(%args)

Retrieves the next column matched by the handle.

$num = $driver->sequence($name, $column)

Retrieves the last numeric value for the autonumber column specified.

SEE ALSO

Persist, Persist::Driver, Persist::Source

AUTHOR

Andrew Sterling Hanenkamp, <hanenkamp@users.sourceforge.net>

COPYRIGHT AND LICENSE

Copyright (c) 2003, Andrew Sterling Hanenkamp
All rights reserved.

Redistribution and use in source and binary forms, with or without 
modification, are permitted provided that the following conditions 
are met:

  * Redistributions of source code must retain the above copyright 
    notice, this list of conditions and the following disclaimer.
  * Redistributions in binary form must reproduce the above copyright 
    notice, this list of conditions and the following disclaimer in 
    the documentation and/or other materials provided with the 
    distribution.
  * Neither the name of the Contentment nor the names of its 
    contributors may be used to endorse or promote products derived 
    from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
POSSIBILITY OF SUCH DAMAGE.