The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Conf::SQL - An SQL backend for Conf

ABSTRACT

Conf::SQL is an SQL backend for Conf. It handles a table $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.

Description

Each call set() will immediately result in a commit to the database.

new(DSN => ...,DBUSER => ..., DBPASS =>, [TABLE => ...]) --> Conf::SQL

Invoked with a valid DSN, DBUSER and DBPASS combination, will return a Conf::SQL object that is connected to the database.

TABLE defaults to conf_table.

This function will try to create a TABLE table in the given DSN, if it does not exist.

Creating the table $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 $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 $table, like this one:

   "CREATE INDEX $table"."_idx ON $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.