Name

alloc_nextkey — allocate the next new unique primary key for the database table specified

Synopsis

use Wacs;
use Wacs::WacsStd;
scalar alloc_nextkey(table_name,  
 primary_key_fieldname,  
 dbhandle); 
scalar table_name;
scalar primary_key_fieldname;
scalar dbhandle;
 

Parameters

parameterdescription
table_nameThe name of the table in the Wacs database schema for which the new key should be allocated, eg sets, models or assoc.
primary_key_fieldnameThe name of the primary (unique) key to that database table.
dbhandleThe open database handle for use in querying the database

Summary

The alloc_nextkey function simply returns the next available value for creating a new record in the specified table. It's rather simplistic and can be caught out by race conditions, but it mostly gives you a valid numeric primary key for the table concerned.

Availability

As a collection administration function, alloc_nextkey is currently only available in perl.