Changeset 1870 in ProjectBuilder for devel/pb/bin
- Timestamp:
- Apr 10, 2014, 10:50:27 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/bin/pb
r1861 r1870 4016 4016 4017 4017 # Store it in DB for external usage (Web pages generation) 4018 my $db = "$ENV{'PBCONFDIR'}/announces3.sql"; 4019 4020 my $precmd = ""; 4021 if (! -f $db) { 4022 $precmd = "CREATE TABLE announces (id INTEGER PRIMARY KEY AUTOINCREMENT, date DATE, announce VARCHAR[65535])"; 4023 } 4024 4025 my $dbh = DBI->connect("dbi:SQLite:dbname=$db","","", 4026 { RaiseError => 1, AutoCommit => 1 }) 4027 || die "Unable to connect to $db"; 4028 4029 if ($precmd ne "") { 4030 my $sth = $dbh->prepare(qq{$precmd}) 4031 || die "Unable to create table into $db"; 4032 $sth->execute(); 4033 } 4018 my $dbh = pb_connect_db(); 4034 4019 4035 4020 # To read whole file … … 4041 4026 pb_log(2,"INSERT INTO announces VALUES (NULL, $pbdate, $announce)"); 4042 4027 my $sth = $dbh->prepare(qq{INSERT INTO announces VALUES (NULL,?,?)}) 4043 || die "Unable to insert into $db";4028 || die "Unable to insert into db"; 4044 4029 $sth->execute($pbdate, $announce); 4045 4030 $sth->finish(); … … 4115 4100 my ($pkgv, $pkgt) = pb_conf_get_if("pkgver","pkgtag"); 4116 4101 4117 # DB of announces for external usage (Web pages generation) 4118 my $db = "$ENV{'PBCONFDIR'}/announces3.sql"; 4119 4120 my $dbh = DBI->connect("dbi:SQLite:dbname=$db","","", 4121 { RaiseError => 1, AutoCommit => 1 }) 4122 || die "Unable to connect to $db"; 4102 4103 my $dbh = pb_connect_db(); 4123 4104 # For date handling 4124 4105 $ENV{LANGUAGE}="C"; … … 4153 4134 } 4154 4135 4136 sub pb_connect_db { 4137 4138 # Store in DB for external usage (Web pages generation) 4139 my $db = "$ENV{'PBCONFDIR'}/announces3.sql"; 4140 4141 my $precmd = ""; 4142 if (! -f $db) { 4143 $precmd = "CREATE TABLE announces (id INTEGER PRIMARY KEY AUTOINCREMENT, date DATE, announce VARCHAR[65535])"; 4144 } 4145 4146 my $dbh = DBI->connect("dbi:SQLite:dbname=$db","","", 4147 { RaiseError => 1, AutoCommit => 1 }) 4148 || die "Unable to connect to $db"; 4149 4150 if ($precmd ne "") { 4151 my $sth = $dbh->prepare(qq{$precmd}) 4152 || die "Unable to create table into $db"; 4153 $sth->execute(); 4154 } 4155 4156 return($dbh); 4157 } 4158 4155 4159 4156 4160 # Return the SSH key file to use
Note:
See TracChangeset
for help on using the changeset viewer.