File: examples/testKeyEncryption.php

Recommend this page to a friend!
  Classes of Jorge Castro  >  PHP Document Store One  >  examples/testKeyEncryption.php  >  Download  
File: examples/testKeyEncryption.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Document Store One
Store and retrieve key-value pairs in flat files
Author: By
Last change:
Date: 11 months ago
Size: 1,374 bytes
 

Contents

Class file image Download
<?php

use eftec\DocumentStoreOne\DocumentStoreOne;

include
"../lib/DocumentStoreOne.php";
echo
"test<br>";




try {
   
$flatcon = new DocumentStoreOne(dirname(__FILE__) . "/base", '');
   
$flatcon->keyEncryption='sha256';

} catch (
Exception $e) {
    die(
"Unable to create document store ".$e->getMessage());
}



echo
"<br>setCollection:"; $flatcon->collection('tmpkeyenc',true);
echo
"<hr>";
echo
"<br>insertOrUpdate:"; var_dump($flatcon->insertOrUpdate("example_1",json_encode(array("a1"=>'hello',"a2"=>'world'))));
echo
"<br>insert:"; var_dump($flatcon->insert("example_2",json_encode(array("a1"=>'hello',"a2"=>'world'))));
echo
"<br>update:"; var_dump($flatcon->update("example_2",json_encode(array("a1"=>'hola',"a2"=>'mundo'))));
echo
"<hr>";
echo
"<br>get:"; var_dump($flatcon->get("example_1"));
echo
"<hr>";
echo
"<br>select:";var_dump($flatcon->select("example_*"));
echo
"<hr>";
//$flatcon->delete("1");
echo "<br>delete:"; var_dump($flatcon->delete("example_2"));
echo
"<br>sequence "; var_dump($flatcon->collection('tmp2')->getNextSequence());
echo
"<br>sequence reserve "; var_dump($flatcon->collection('tmp2')->getNextSequence("seq",-1,1,1,100));
echo
"<br>sequence after reserve "; var_dump($flatcon->collection('tmp2')->getNextSequence());
echo
"<br>add log "; var_dump($flatcon->collection('tmp')->appendValue('log',"Adding a log\t".date('c')."\n"));


For more information send a message to info at phpclasses dot org.