nntp_get() is used to retrieve messages from a server running the Network News Transfer Protocol (NNTP) as defined in RFC977. It returns an array whose structure depends on the command parameter, thus:
A vector of vectors the content of which depends on the command parameter.
This example retrieves messages from a remote NNTP server and stores them in a table.
create table my_news (m_id integer, m_group varchar, m_text long varchar,
primary key (m_id, m_group));
create procedure get_my_news (in server varchar, in grp varchar)
{
declare res, ent any;
declare i, l integer;
res := nntp_get (server, 'article', grp, 0, 1000);
i := 0; l := length (res);
while (i < l)
{
ent := res [i];
insert replacing my_news (m_id, m_group, m_text)
values (ent[0], grp, ent[1]);
i := i + 1;
}
}
Here is a test run. We extract the article subject with the mail_header() function.
SQL> get_my_news ('news.techno-link.com:119', 'comp.lang.java.api');
SQL> select m_id, mail_header (m_text, 'Subject') from my_news;
m_id callret
INTEGER NOT NULL VARCHAR
_______________________________________________________________________________
2 New java method modifier "partial": not quite abstract, not quite concrete
3 Senior Design Project Ideas
4 java & dummy terminals
5 Re: What is the equivalent of WORD in Java
6 Re: What is the equivalent of WORD in Java