www.openlinksw.com
docs.openlinksw.com

Book Home

Contents
Preface

Virtuoso Functions Guide

Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
mime_body
mime_part
mime_tree
nntp_auth_get
nntp_auth_post
nntp_get
nntp_post
pem_certificates_to_...
pop3_get
smime_sign
smime_verify
smtp_send
uuvalidate
Miscellaneous
Number
Remote SQL Data Source
Replication
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web Server & Internet
XML
XPATH & XQUERY

Functions Index

nntp_get

Returns information about an NNTP server.
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:

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
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
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