Name
Conf::SQL - The file backend for Conf.
Abstract
Conf::SQL
is an SQL backend for Conf. It handles a table conf_table
with identifiers that are assigned values. The identifiers are specified on a per user basis. Conf::SQL
tries to get the user account of the user self.
Note
This module can be ommitted from the Conf
bundle. One can optionally neclegt it's existence by using perl Makefile.PL --no-sql
.
Description
Each call set()
will immediately result in a commit to the database.
new(DSN,USER,PASS)
--> Conf::SQL
Invoked with a valid DSN
, USER
and PASS
combination, will return a Conf::SQL object that is connected to the database.
This function will try to create a conf_table
table in the given DSN
, if it does not exist.
Creating the table conf_table in your database
If it cannot create a table for you, because it doesn't know the database you are using, you can create your own. The table used has following form:
CREATE TABLE conf_table(uid varchar,var varchar,value varchar)
The form presented here is a PostgreSQL
form. You will want at least following specifications for uid, var and value:
uid varchar(250)
var varchar(250)
value text, bigtext, mediumtext, varchar(1000000000), etc.
You may also want an index on conf_table, like this one:
CREATE INDEX conf_table_idx ON conf_table(uid, var)
DESTROY()
This function will disconnect from the database.
set(var,value) --> void
Sets config key var to value.
get(var) --> string
Reads var from config. Returns undef
, if var does not exist. Returns the value of configuration item var
, otherwise.
variables() --> list of strings
Returns all variables in the configuraton backend.
SEE ALSO
Conf::String , Conf::SQL , Conf::File .
AUTHOR
Hans Oesterholt-Dijkema, <oesterhol@cpan.org>
COPYRIGHT AND LICENSE
Copyright 2004 by Hans Oesterholt-Dijkema
This library is free software; you can redistribute it and/or modify it under LGPL.