Rev 7 | Blame | Compare with Previous | Last modification | View Log | RSS feed
package WebDB;use strict;use DBI;my $host_name = "192.168.1.5";my $db_name = "rollerco_vorc";my $dsn = "DBI:mysql:host=$host_name;database=$db_name";# Connect to MySQL server, using hardwired name and passwordsub connect {return (DBI->connect ($dsn, "root", "Jopy666!",{PrintError => 0, RaiseError => 1}));}# Connect to MySQL server, using name and password from the current# user's ~/.my.cnf option file. The mysql_read_default_file option,# when added to the DSN, specifies which option file to read.sub connect_with_option_file {$dsn .= ";mysql_read_default_file=$ENV{HOME}/.my.cnf";return (DBI->connect ($dsn, undef, undef,{PrintError => 0, RaiseError => 1}));}sub trim {my $str = shift;return "" if !defined $str;$str =~ s/^\s+//;$str =~ s/\s+$//;return ($str);}1; # return true