[Dbconfig-common-devel] dbconfig-common/examples/db-example-2.0/install-files mysql-install.pl, NONE, 1.1 mysql.sql, NONE, 1.1 pgsql.sql, NONE, 1.1

seanius at haydn.debian.org seanius at haydn.debian.org
Sat Jul 30 08:08:19 UTC 2005


Update of /cvsroot/dbconfig-common/dbconfig-common/examples/db-example-2.0/install-files
In directory haydn:/org/alioth.debian.org/chroot/home/users/seanius/tmp/cvs-serv5607/db-example-2.0/install-files

Added Files:
	mysql-install.pl mysql.sql pgsql.sql 
Log Message:
here's the sample reference packages, now included as part of
the main package.


--- NEW FILE: mysql-install.pl ---
#!/usr/bin/perl

use DBI;
use strict;


# this is the value of the config file passed to us by dbconfig-common
my $conffile = $ENV{'dbc_config_include'};
# these are the default names of the variables in the config file
our ($dbname, $dbuser, $dbpass, $dbserver, $dbtype);

# load 'er up.
require $conffile;

my $dsn = "DBI:$dbtype:database=$dbname;host=$dbserver";

# error checking here would be a plus.
my $dbh = DBI->connect($dsn, $dbuser, $dbpass);

# error checking here would be a plus too.
$dbh->do("CREATE TABLE IF NOT EXISTS versiontable ( version varchar(32) PRIMARY KEY NOT NULL )");

$dbh->do("DELETE FROM versiontable");
$dbh->do("INSERT INTO versiontable VALUES ( '2.1' )");

$dbh->disconnect();

exit 0;

--- NEW FILE: mysql.sql ---
create table foo (
	id	int not null primary key,
	name	varchar(32)
);

create table mytable (
	version	varchar(32) not null primary key
);

insert into foo values (1, 'foo');
insert into foo values (2, 'bar');
delete from mytable;
insert into mytable values ('2.0');

--- NEW FILE: pgsql.sql ---
create table foo (
	id	int not null primary key,
	name	varchar(32)
);

create table mytable (
	version	varchar(32) not null primary key
);

insert into foo values (1, 'foo');
insert into foo values (2, 'bar');
delete from mytable;
insert into mytable values ('2.0');




More information about the Dbconfig-common-devel mailing list