From 4b3dff6ed580a7c5aec8fb50467043962861e0e7 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 7 Sep 2005 13:42:49 +0100 Subject: [PATCH] updated mysql schema --- backend.php | 20 ++++++++++---------- functions.php | 4 ++-- ttrss_schema.sql | 2 +- ttrss_schema_mysql.sql | 24 +++++++++--------------- 4 files changed, 22 insertions(+), 28 deletions(-) diff --git a/backend.php b/backend.php index affdd4713..82e07e6d7 100644 --- a/backend.php +++ b/backend.php @@ -686,7 +686,7 @@ $filter_id = db_escape_string($_GET["id"]); $result = db_query($link, "UPDATE ttrss_filters SET - regexp = '$regexp', + reg_exp = '$regexp', description = '$descr', filter_type = (SELECT id FROM ttrss_filter_types WHERE description = '$match') @@ -710,11 +710,11 @@ if (!WEB_DEMO_MODE) { - $regexp = db_escape_string($_GET["regexp"]); + $regexp = db_escape_string($_GET["reg_exp"]); $match = db_escape_string($_GET["match"]); $result = db_query($link, - "INSERT INTO ttrss_filters (regexp,filter_type) VALUES + "INSERT INTO ttrss_filters (reg_exp,filter_type) VALUES ('$regexp', (SELECT id FROM ttrss_filter_types WHERE description = '$match'))"); } @@ -739,13 +739,13 @@ "; $result = db_query($link, "SELECT - id,regexp,description, + id,reg_exp,description, (SELECT name FROM ttrss_filter_types WHERE id = filter_type) as filter_type_name, (SELECT description FROM ttrss_filter_types WHERE id = filter_type) as filter_type_descr FROM - ttrss_filters ORDER by regexp"); + ttrss_filters ORDER by reg_exp"); print "

"; @@ -768,7 +768,7 @@ print ""; - $line["regexp"] = htmlspecialchars($line["regexp"]); + $line["regexp"] = htmlspecialchars($line["reg_exp"]); $line["description"] = htmlspecialchars($line["description"]); if (!$edit_filter_id || $subop != "edit") { @@ -779,7 +779,7 @@ type=\"checkbox\" id=\"FICHK-".$line["id"]."\">"; print ""; + $line["reg_exp"] . ""; print ""; @@ -793,7 +793,7 @@ print ""; - print ""; + print ""; print ""; print ""; @@ -801,7 +801,7 @@ print ""; - print ""; print "
" . - $line["regexp"] . "" . $line["description"] . "".$line["regexp"]."".$line["reg_exp"]."".$line["description"]."".$line["filter_type_descr"].""; } - pg_close($link); + db_close($link); ?> diff --git a/functions.php b/functions.php index 297736036..bea443c27 100644 --- a/functions.php +++ b/functions.php @@ -115,14 +115,14 @@ $filters = array(); - $result = db_query($link, "SELECT regexp, + $result = db_query($link, "SELECT reg_exp, (SELECT name FROM ttrss_filter_types WHERE id = filter_type) as name FROM ttrss_filters"); while ($line = db_fetch_assoc($result)) { if (!$filters[$line["name"]]) $filters[$line["name"]] = array(); - array_push($filters[$line["name"]], $line["regexp"]); + array_push($filters[$line["name"]], $line["reg_exp"]); } foreach ($rss->items as $item) { diff --git a/ttrss_schema.sql b/ttrss_schema.sql index 2c00b3687..95887acb3 100644 --- a/ttrss_schema.sql +++ b/ttrss_schema.sql @@ -56,6 +56,6 @@ insert into ttrss_filter_types (id,name,description) values (3, 'both', create table ttrss_filters (id serial primary key, filter_type integer not null references ttrss_filter_types(id), - regexp varchar(250) not null, + reg_exp varchar(250) not null, description varchar(250) not null default ''); diff --git a/ttrss_schema_mysql.sql b/ttrss_schema_mysql.sql index 25e0fd63e..91fde947f 100644 --- a/ttrss_schema_mysql.sql +++ b/ttrss_schema_mysql.sql @@ -5,9 +5,7 @@ create table ttrss_feeds (id integer not null auto_increment primary key, title varchar(200) not null unique, feed_url varchar(250) unique not null, icon_url varchar(250) not null default '', - last_updated timestamp default null); - -alter table ttrss_feeds ENGINE=InnoDB; + last_updated timestamp default null) TYPE=InnoDB; insert into ttrss_feeds (title,feed_url) values ('Footnotes', 'http://gnomedesktop.org/node/feed'); insert into ttrss_feeds (title,feed_url) values ('Freedesktop.org', 'http://planet.freedesktop.org/rss20.xml'); @@ -30,7 +28,7 @@ insert into ttrss_feeds (title,feed_url) values ('Technocrat.net', 'http://syndication.technocrat.net/rss'); create table ttrss_entries (id integer not null primary key auto_increment, - feed_id int id not null, + feed_id integer not null, updated timestamp not null, title varchar(250) not null, guid varchar(250) not null unique, @@ -38,32 +36,28 @@ create table ttrss_entries (id integer not null primary key auto_increment, content text not null, content_hash varchar(250) not null, last_read timestamp, - marked boolean not null default 'false', + marked bool not null default 'false', date_entered timestamp not null, - no_orig_date boolean not null default 'false', + no_orig_date bool not null default 'false', comments varchar(250) not null default '', - unread boolean not null default true); - -alter table ttrss_entries ENGINE=InnoDB; + unread bool not null default 'true') TYPE=InnoDB; drop table if exists ttrss_filters; drop table if exists ttrss_filter_types; create table ttrss_filter_types (id integer primary key, name varchar(120) unique not null, - description varchar(250) not null unique); + description varchar(250) not null unique) TYPE=InnoDB; -alter table ttrss_filter_types ENGINE=InnoDB; insert into ttrss_filter_types (id,name,description) values (1, 'title', 'Title'); insert into ttrss_filter_types (id,name,description) values (2, 'content', 'Content'); insert into ttrss_filter_types (id,name,description) values (3, 'both', 'Title or Content'); -create table ttrss_filters (id serial primary key, +create table ttrss_filters (id integer primary key auto_increment, filter_type integer not null, - regexp varchar(250) not null, - description varchar(250) not null default ''); + reg_exp varchar(250) not null, + description varchar(250) not null default '') TYPE=InnoDB; -alter table ttrss_filters ENGINE=InnoDB;