dbTalk Databases Forums  

RSS SQL tables

comp.databases comp.databases


Discuss RSS SQL tables in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
croora
 
Posts: n/a

Default RSS SQL tables - 04-13-2009 , 11:25 PM






I like to store all RSS 2.0 elements in db with php. I try to design optimal
database structure.

Is there some recommended structure or something?

tnx

Reply With Quote
  #2  
Old   
Erwin Moller
 
Posts: n/a

Default Re: RSS SQL tables - 04-14-2009 , 05:09 AM






croora schreef:
Quote:
I like to store all RSS 2.0 elements in db with php. I try to design optimal
database structure.

Is there some recommended structure or something?
Well, common sense?
Define all the elements (attributes) you want to store.
Create a table that holds that information.
Use a serial (autonumber) primary key in that same table to identify
each record.

Regards,
Erwin Moller

Quote:
tnx

--
"There are two ways of constructing a software design: One way is to
make it so simple that there are obviously no deficiencies, and the
other way is to make it so complicated that there are no obvious
deficiencies. The first method is far more difficult."
-- C.A.R. Hoare


Reply With Quote
  #3  
Old   
croora
 
Posts: n/a

Default Re: RSS SQL tables - 04-14-2009 , 05:37 AM



Erwin Moller wrote:
Quote:
croora schreef:
I like to store all RSS 2.0 elements in db with php. I try to design
optimal database structure.

Is there some recommended structure or something?

Well, common sense?
Define all the elements (attributes) you want to store.
Create a table that holds that information.
Use a serial (autonumber) primary key in that same table to identify
each record.

Regards,
Erwin Moller


tnx


i know that it looks simple, but it isn't

in RSS specification, some tags has own attributes and another nested tags
(etc. <enclosure> has attributes, <image> has 3 nested elements).




Reply With Quote
  #4  
Old   
Jasen Betts
 
Posts: n/a

Default Re: RSS SQL tables - 04-14-2009 , 06:38 AM



On 2009-04-14, croora <croora (AT) net (DOT) hr> wrote:
Quote:
Erwin Moller wrote:
croora schreef:
I like to store all RSS 2.0 elements in db with php. I try to design
optimal database structure.

Is there some recommended structure or something?

Well, common sense?
Define all the elements (attributes) you want to store.
Create a table that holds that information.
Use a serial (autonumber) primary key in that same table to identify
each record.

Regards,
Erwin Moller


tnx



i know that it looks simple, but it isn't

in RSS specification, some tags has own attributes and another nested tags
(etc. <enclosure> has attributes, <image> has 3 nested elements).
xml does not translate well to a relational database.

you might try something liek this.

CREATE TABLE xmlnode (
id serial PRIMARY KEY,
nodename TEXT,
parentnode integer references xmlnode(id) ON DELETE CASCADE,
textvalue TEXT
)

CREATE TABLE xmlattribute
{
node integer REFERENCES node(id) ON DELETE CASCADE,
attrnum INTGER,
attributename TEXT,
atrtribute TEXT,
PRIMARY KEY (node,attrnum)
}

but I can't see it being very useful.

why do you wish to represent the XML as relations, what sort of
manipulations do you plan to do on it using SQL?

I would be inclined to put entire articles into TEXT fields,


Reply With Quote
  #5  
Old   
croora
 
Posts: n/a

Default Re: RSS SQL tables - 04-14-2009 , 07:34 AM



Jasen Betts wrote:

Quote:
On 2009-04-14, croora <croora (AT) net (DOT) hr> wrote:
Erwin Moller wrote:
croora schreef:
I like to store all RSS 2.0 elements in db with php. I try to design
optimal database structure.

Is there some recommended structure or something?

Well, common sense?
Define all the elements (attributes) you want to store.
Create a table that holds that information.
Use a serial (autonumber) primary key in that same table to identify
each record.

Regards,
Erwin Moller


tnx



i know that it looks simple, but it isn't

in RSS specification, some tags has own attributes and another nested
tags (etc. <enclosure> has attributes, <image> has 3 nested elements).

xml does not translate well to a relational database.

you might try something liek this.

CREATE TABLE xmlnode (
id serial PRIMARY KEY,
nodename TEXT,
parentnode integer references xmlnode(id) ON DELETE CASCADE,
textvalue TEXT
)

CREATE TABLE xmlattribute
{
node integer REFERENCES node(id) ON DELETE CASCADE,
attrnum INTGER,
attributename TEXT,
atrtribute TEXT,
PRIMARY KEY (node,attrnum)
}

but I can't see it being very useful.

why do you wish to represent the XML as relations, what sort of
manipulations do you plan to do on it using SQL?

I would be inclined to put entire articles into TEXT fields,
i try to store misc RSS feeds in database, manipulate them and then restore
RSS again (mysql+php).

does have sence doing something like that? or it is waist of time?

i don't know, maybe i return to one TEXT field and XML parser

tnx on any advice


Reply With Quote
  #6  
Old   
Jasen Betts
 
Posts: n/a

Default Re: RSS SQL tables - 04-15-2009 , 06:35 AM



On 2009-04-14, croora <croora (AT) net (DOT) hr> wrote:
Quote:
Jasen Betts wrote:

On 2009-04-14, croora <croora (AT) net (DOT) hr> wrote:
Erwin Moller wrote:
croora schreef:
I like to store all RSS 2.0 elements in db with php. I try to design
optimal database structure.


why do you wish to represent the XML as relations, what sort of
manipulations do you plan to do on it using SQL?

I would be inclined to put entire articles into TEXT fields,

i try to store misc RSS feeds in database, manipulate them and then restore
RSS again (mysql+php).

does have sence doing something like that? or it is waist of time?

i don't know, maybe i return to one TEXT field and XML parser

tnx on any advice
unless there's functionality to be gained by breaking int into pieces
in the database (I can't see there being a performance gain)
just keep it as large chunks of XML in text fields and use a parser.



Reply With Quote
  #7  
Old   
croora
 
Posts: n/a

Default Re: RSS SQL tables - 04-15-2009 , 12:05 PM



Jasen Betts wrote:

Quote:
On 2009-04-14, croora <croora (AT) net (DOT) hr> wrote:
Jasen Betts wrote:

On 2009-04-14, croora <croora (AT) net (DOT) hr> wrote:
Erwin Moller wrote:
croora schreef:
I like to store all RSS 2.0 elements in db with php. I try to design
optimal database structure.


why do you wish to represent the XML as relations, what sort of
manipulations do you plan to do on it using SQL?

I would be inclined to put entire articles into TEXT fields,

i try to store misc RSS feeds in database, manipulate them and then
restore RSS again (mysql+php).

does have sence doing something like that? or it is waist of time?

i don't know, maybe i return to one TEXT field and XML parser

tnx on any advice

unless there's functionality to be gained by breaking int into pieces
in the database (I can't see there being a performance gain)
just keep it as large chunks of XML in text fields and use a parser.
sorry for stupid question and my bad english

tnx to all


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.