15 function CreateInstanceUUIDTable($dbManager)
17 if($dbManager == NULL){
18 echo
"Missing dbManager object. Can't create instance_uuid table.\n";
22 $dbManager->queryOnce(
"
24 CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";
25 CREATE TABLE IF NOT EXISTS instance (
26 id bool PRIMARY KEY DEFAULT TRUE,
27 instance_uuid UUID NOT NULL DEFAULT uuid_generate_v4(),
28 CONSTRAINT tbl_id_uni CHECK (id));
31 $row = $dbManager->getSingleRow(
"SELECT count(instance_uuid) FROM instance;", array(),
'instance_uuid.count' );
32 if ($row[
'count'] == 0){
33 echo
"INSTANCE UUID Empty - creating...\n";
34 $dbManager->queryOnce(
"INSERT INTO instance DEFAULT VALUES;");
37 $row_uuid = $dbManager->getSingleRow(
"SELECT instance_uuid FROM instance;", array(),
'instance_uuid' );
38 echo
"INSTANCE UUID: ", $row_uuid[
'instance_uuid'],
"\n";
42 echo
"*** Instance UUID ***\n";
43 CreateInstanceUUIDTable($dbManager);