To Clone a DB

mysqldump yourFirstDatabase u user ppassword > yourDatabase.sql $ mysql yourSecondDatabase u user ppassword < yourDatabase.sql

 

And then there were 5

One more to go – not bad for a small garden!

These make great hot spicy medicinal soup – can’t wait – makes the cold weather bearable.

pump_5

 

Pro Tools

Loving it – Purple is my favorite color.  Order is my favorite state of entropy. If only I had the most powerful computer around….working on it.

protools2 protools

Perl MySQL Transaction example

transactions

 

use strict;
use warnings;
use v5.10; # for say() function

use DBI;

say “Perl MySQL Transaction Demo”;

# MySQL database configurations
my $dsn = “DBI:mysql:perlmysqldb”;
my $username = “root”;
my $password = ”;

# connect to MySQL database
my %attr = (RaiseError=&gt;1,  # error handling enabled
AutoCommit=&gt;0); # transaction enabled

my $dbh = DBI-&gt;connect($dsn,$username,$password, \%attr);

eval{
# insert a new link
my $sql = “INSERT INTO links(title,url,target)
VALUES(?,?,?)”;
my $sth = $dbh-&gt;prepare($sql);
$sth-&gt;execute(“Comprehensive Perl Archive Network”,”http://www.cpan.org/”,”_blank”);
# get last insert id of the link
my $link_id = $dbh-&gt;{q{mysql_insertid}};

# insert a new tag
$sql = “INSERT INTO tags(tag) VALUES(?)”;
$sth = $dbh-&gt;prepare($sql);
$sth-&gt;execute(‘Perl’);

# get last insert id of the tag
my $tag_id = $dbh-&gt;{q{mysql_insertid}};

# insert a new link and tag relationship
$sql = “INSERT INTO link_tags(link_id,tag_id)
VALUES(?,?)”;
$sth = $dbh-&gt;prepare($sql);
$sth-&gt;execute($link_id,$tag_id);

# if everything is OK, commit to the database
$dbh-&gt;commit();
say “Link and tag has been inserted and associated successfully!”;
};

if($@){
say “Error inserting the link and tag: $@”;
$dbh-&gt;rollback();
}

# disconnect from the MySQL database
$dbh-&gt;disconnect();