NTuples version 0.11
========================

NAME

    NTuples - intra-memory RDBMS / db-operations on NxN arrays

SYNOPSIS

      use NTuples;

      $myassoc = new NTuples( );
	
      $myassoc->new_format( ['username', 'id', 'uid'] );

      $myassoc->new_data(
                          (
                            ["cmorris", "T0001", "100"],
                            ["ibl", "T2841", "101"],
                            ["olson", "T4812", "102"],
                            ["bader", "T3124", "103"]
                          )
                        );

      $myassoc->insert_data( ["robin_c", "T1492", "104"] );

	#returns [ 'ibl', 'T2841', '101' ]
      @row = $myassoc->select_row( 'username', 'ibl' );

	#returns 'robin_c'
      $val = $myassoc->select_value( 'uid', '104', 'username' );


DESCRIPTION

    NTuples - intra-memory RDBMS / database operations on NxN arrays

	NTuples should be used to run fast db-operations
	in NxN tables. NTuples is designed to be run inside of
	programs with daemon-like behavior, you regain the time
	lost during load-time from the high associativity
        with the excellent query performance.


USAGE

    new()
      Constructor.
      Returns new instance of NTuples.
    
    
    new_format()
      parameters:
        @format, array of column names
      
      Alters key format for any current or added data lines.
      
      There should be one argument for each element in the list
      with the name of the type of data in that field.
      
      For a non-unique data field in the format, or one that
      is not to be mapped, simply use null.
    
    
    new_data()
      parameters:
        @data, lines of data
      
      Registers and runs map on an array of data (overwriting old data)
    
    
    select_row()
      parameters:
        $keyname, name of column (specified in format)
        $key, value in column 
      
      Returns record specified by $key in $keyname column (array)
      SQL equivalent: "SELECT * FROM MyTuples WHERE $keyname=$key"
    
    
    select_value()
      parameters:
        $keyname, name of column (specified in format)
        $key, value in column 
        $valname, name of associated column to retreive
      
      Returns single value specified by $key in $keyname column (scalar)
      SQL equivalent: "SELECT $valname FROM MyTuples WHERE $keyname=$key"
    
    
    update_row()
      parameters:
        $keyname, name of column (specified in format)
        $key, value in column 
        @row, values to update (must be full record, otherwise use update_value)
      
      Updates row specified by $key in $keyname column.
      SQL equivalent: "UPDATE MyTuples SET c1=$row[0], ..., cn=$row[n] WHERE $keyname=$key"
    
    
    update_value()
      parameters:
        $keyname, name of column (specified in format)
        $key, value in column 
        $valname, value to update
        $val, new value
      
      Updates $valname to $val in row specified by $key in $keyname column.
      SQL equivalent: "UPDATE MyTuples SET $valname=$val WHERE $keyname=$key"


    delete_row()
      parameters:
        $keyname, name of column (specified in format)
        $key, value in column 
      
      Deletes row specified by $key in $keyname column.
      SQL equivalent: "DELETE FROM MyTuples WHERE $keyname=$key"
    
    
INSTALLATION

To install this module type the following:

   perl Makefile.PL
   make
   make install

DEPENDENCIES

  none

BUGS

  Not sure at this time. Everything -seems- stable,
  but if any are sighted please email me.

COPYRIGHT AND LICENCE

Copyright (C) 2006, 2007 Charles A Morris.  All rights reserved.

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