[Debian-l10n-commits] r2705 - in /ddtp-web: Changelog Packages2db.pl sql_layout.txt
nekral-guest at users.alioth.debian.org
nekral-guest at users.alioth.debian.org
Mon Jul 25 13:03:26 UTC 2011
Author: nekral-guest
Date: Mon Jul 25 13:03:26 2011
New Revision: 2705
URL: http://svn.debian.org/wsvn/?sc=1&rev=2705
Log:
* sql_layout.txt: Add table package_version_tb.
* Packages2db.pl: Populate the package_version_tb table in
addition to version_tb.
* sql_layout.txt: Add table suggestion_tb.
Modified:
ddtp-web/Changelog
ddtp-web/Packages2db.pl
ddtp-web/sql_layout.txt
Modified: ddtp-web/Changelog
URL: http://svn.debian.org/wsvn/ddtp-web/Changelog?rev=2705&op=diff
==============================================================================
--- ddtp-web/Changelog (original)
+++ ddtp-web/Changelog Mon Jul 25 13:03:26 2011
@@ -4,3 +4,7 @@
* db2web.sh: Add link to the Squeeze and Wheezy statistics.
* db2web.sh: Changed y axes (no more logscale and limits changed
from 0:15000 to 1:27000).
+ * sql_layout.txt: Add table package_version_tb.
+ * Packages2db.pl: Populate the package_version_tb table in
+ addition to version_tb.
+ * sql_layout.txt: Add table suggestion_tb.
Modified: ddtp-web/Packages2db.pl
URL: http://svn.debian.org/wsvn/ddtp-web/Packages2db.pl?rev=2705&op=diff
==============================================================================
--- ddtp-web/Packages2db.pl (original)
+++ ddtp-web/Packages2db.pl Mon Jul 25 13:03:26 2011
@@ -112,10 +112,27 @@
sub save_version_to_db {
my $description_id= shift(@_);
my $version= shift(@_);
+ my $package= shift(@_);
+ my $package_version_id;
+
+ my $sth = $dbh->prepare("SELECT package_version_id FROM package_version_tb WHERE description_id=? and package=? and version=?");
+ $sth->execute($description_id, $package, $version);
+ ($package_version_id) = $sth->fetchrow_array;
+
+ if (not $package_version_id) {
+ eval {
+ $dbh->do("INSERT INTO package_version_tb (description_id,package,version) VALUES (?,?,?);", undef, $description_id, $package, $version);
+ $dbh->commit; # commit the changes if we get this far
+ };
+ if ($@) {
+ $dbh->rollback; # undo the incomplete changes
+ }
+ }
+
my $version_id;
- my $sth = $dbh->prepare("SELECT version_id FROM version_tb WHERE description_id=? and version=?");
+ $sth = $dbh->prepare("SELECT version_id FROM version_tb WHERE description_id=? and version=?");
$sth->execute($description_id, $version);
($version_id) = $sth->fetchrow_array;
@@ -179,7 +196,7 @@
$dbh->rollback; # undo the incomplete changes
}
if (($description_id)) {
- save_version_to_db($description_id,$version);
+ save_version_to_db($description_id,$version,$package);
}
if (($description_id) and ($distribution eq 'sid')) {
save_active_to_db($description_id);
Modified: ddtp-web/sql_layout.txt
URL: http://svn.debian.org/wsvn/ddtp-web/sql_layout.txt?rev=2705&op=diff
==============================================================================
--- ddtp-web/sql_layout.txt (original)
+++ ddtp-web/sql_layout.txt Mon Jul 25 13:03:26 2011
@@ -1,6 +1,9 @@
+
+DROP TABLE suggestion_tb;
DROP TABLE packages_tb;
+DROP TABLE package_version_tb;
DROP TABLE version_tb;
DROP TABLE owner_tb;
@@ -107,6 +110,18 @@
CREATE INDEX version_tb_1_IDX ON version_tb (description_id);
CREATE UNIQUE INDEX version_tb_3_IDX ON version_tb (description_id,version);
+CREATE TABLE package_version_tb
+(
+ package_version_id serial PRIMARY KEY ,
+ package text NOT NULL,
+ version text NOT NULL,
+ description_id integer NOT NULL REFERENCES description_tb
+);
+CREATE INDEX package_version_tb_1_IDX ON package_version_tb (description_id);
+CREATE INDEX package_version_tb_2_IDX ON package_version_tb (package);
+CREATE UNIQUE INDEX package_version_tb_3_IDX ON package_version_tb (description_id,package,version);
+CREATE INDEX package_version_tb_4_IDX ON package_version_tb (package,version);
+
CREATE TABLE packages_tb
(
packages_id serial PRIMARY KEY ,
@@ -123,3 +138,17 @@
);
CREATE INDEX package_tb_1_IDX ON packages_tb (package);
CREATE UNIQUE INDEX package_tb_3_IDX ON packages_tb (package,version);
+
+CREATE TABLE suggestion_tb
+(
+ suggestion_id serial PRIMARY KEY ,
+ package text NOT NULL,
+ version text NOT NULL,
+ description_md5 text NOT NULL,
+ translation text NOT NULL,
+ language text NOT NULL,
+ importer text NOT NULL,
+ importtime date NOT NULL
+);
+CREATE INDEX suggestion_tb_1_IDX ON suggestion_tb (package);
+CREATE INDEX suggestion_tb_2_IDX ON suggestion_tb (package,language,description_md5);
More information about the Debian-l10n-commits
mailing list