Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This page describes the variable table in the database.  The purpose of this table is to allow pieces of data to be stored without easily stored in the database without having to manipulate the database schema.  The need for such a table has grown over time as more and more features are added to VCL.  This table will become very useful as VCL becomes more and more increasingly modularized.  Any This table will allow any VCL component will be able to easily set and retrieve the data they require to access the variable data without having to interact directly with the database.

...

Code Block
CREATE TABLE IF NOT EXISTS `variable` (
  `id` smallint(5) unsigned NOT NULL auto_increment,
  `name` varchar(128) NOT NULL default '',
  `value` longtext NOT NULL,
  `setby` varchar(40) default NULL,
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `name` (`name`)) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

Examples

Example 1:

A The following hash is created in Perl containing 2 keys with scalar values:

Code Block
my %kms_configuration = (
 'ECU3' => '192.168.22.33:1688',
 'NCSU1' => 'kms-server.ncsu.edu',
); my  my $serialized_data = YAML::Dump(\%kms_configuration);$self $self->data->set_variable('kms-configuration', $serialized_data);

The keys represent affiliation IDs and the values represent the addresses (phony) of Windows Vista/2008 KMS activation servers.

This hash is serialized using the YAML module's Dump function, and then a row then the following row is saved in the variable table by the DataStructure.pm::set_variable() subroutine:

id

name

value

setby

timestamp

2

kms-configuration

---
ECU 3: 192.168.22.33:1688
NCSU 1: kms-server.ncsu.edu

new.pm:139

2009-05-26 11:35:36

...

Code Block
my @contacts = (
 {
  'firstname' => 'Joe',
  'lastname' => 'Doe',
  'email' => ['joe@somewhere.org', 'jdoe22@unity.ncsu.edu'],
  'employee_id' => 3342
 },
 {
  'firstname' => 'Jane',
  'lastname' => 'Doe',
  'email' => ['jane@somewhere.org'],
  'employee_id' => 7865
 }
); my  my $serialized_data = YAML::Dump(\@contacts);$self $self->data->set_variable('contacts', $serialized_data);

...