Changes

Jump to navigation Jump to search
317 bytes added ,  09:12, 12 August 2015
Line 1: Line 1:  
=== NAME ===
 
=== NAME ===
esmith::DB::db - interface to esmith::db databases<br />
+
esmith::DB::db - interface to esmith::db databases<br />
    
In a root terminal you can do the command below if you want to display the up-to-date content  
 
In a root terminal you can do the command below if you want to display the up-to-date content  
Line 67: 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 89: 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 102: 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 ====

Navigation menu