Name
nntp_get, nntp_get_new, nntp_id_get — Returns information about an NNTP server.
Synopsis
array nntp_get(
|
in server varchar, |
| in command varchar, | |
| in group varchar, | |
| in first_message integer, | |
in last_message integer); |
Description
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:
- list: an array of vectors, each of which contain the name of the news group, the first message number, the last message number and a single character 'y' or 'n' as a flag for posting.
- group: a vector of three elements: total number of messages in the group, the number of the first message, and the number of the last message.
- stat: an array of vectors, each of which contains the number of the message and the message id.
- article, body, head: an array of vectors each containing the message number and the requested part of the message.
Parameters
server
The IP address or <hostname:port> of the host with which to
connect. There is no default for port, so to
connect to the standard port for NNTP, use <hostname/IP
address>:119.
command
Command string. Valid values are:
- article
- body
- head
- stat
- list
- group
- xover
group
A string containing the name of the newsgroup.
Return Types
A vector of vectors the content of which depends on the
command parameter.
Errors
Table 24.54. Errors signalled by
| SQLState | Error Code | Error Text |
|---|---|---|
| 22023 | NN006 | the command is not recognized |
| 22023 | NN001 | Large ID in nntp_id_get |
| 2E000 | NN002 | Invalid address for News Server at [host] |
| 08001 | NN003 | Unable to Contact News Server at [host] |
| 08006 | NN004 | Lost connection with NNTP server |
| 08006 | NN005 | Misc. error in connection in nntp_get |
Examples
Example 24.249. Get remote messages
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