Line 1: |
Line 1: |
| === NAME === | | === NAME === |
− | esmith::DB::db - interface to esmith::db databases | + | esmith::DB::db - interface to esmith::db databases<br /> |
− | in a root terminal you can do
| + | |
| + | In a root terminal you can do the command below if you want to display the up-to-date content |
| perldoc -U esmith::DB::db | | perldoc -U esmith::DB::db |
| + | |
| === SYNOPSIS === | | === SYNOPSIS === |
| Works just like an esmith::DB class except where noted | | Works just like an esmith::DB class except where noted |
Line 65: |
Line 67: |
| | | |
| my $config = esmith::ConfigDB->create($new_config_file); | | my $config = esmith::ConfigDB->create($new_config_file); |
| + | |
| + | example for creating and using a custom database in one line: |
| + | |
| + | my $customDB = esmith::ConfigDB->open('YOUR_DATABASE_NAME') || esmith::ConfigDB->create('YOUR_DATABASE_NAME'); |
| | | |
| ==== checking if a record exists ==== | | ==== checking if a record exists ==== |
Line 87: |
Line 93: |
| my $foo = $config->new_record(’foo’); | | my $foo = $config->new_record(’foo’); |
| $foo->set_value(’foo’); | | $foo->set_value(’foo’); |
− | | + | |
| # with properties | | # with properties |
| my %defaults = ( ’type’ => ’sometype’, | | my %defaults = ( ’type’ => ’sometype’, |
Line 100: |
Line 106: |
| my $rec = $config->get($key) ││ | | my $rec = $config->get($key) ││ |
| $config->new_record($key); | | $config->new_record($key); |
| + | |
| + | for example (if it doesn't exist we create it) |
| + | my $rec = $DB->get('roundcube') || $DB->new_record('roundcube', {type => 'service'}); |
| | | |
| ==== getting a value ==== | | ==== getting a value ==== |