ipstatsvr (Sat Oct 25 2014 01:31:01)

ipstatsvr

This program is used to allow interactive acces to/from the Statistics
Database.

It sits on a TCP Port - normally 9150 - waiting for XML-like requests which it
then parsed, hits the database and returns the data.

It can be used for either Sybase or MicroSoft SQLserver databases.

A parameter file for Sybasy sort of things is held in tables/stats and defaults
to STATSVR.

Keywords for STATSVR parameter file are :
	; comment line
	user: sybase user name
		user:sa
	passwd:	Sybase passwd
		passwd:sports
	server:	Sybase server name
		server:JERRYSYB

Input Switches (all optional) :
	-l : log requests and connections	default: no
	-n : optional name for logging		default: stat
	-P : Port no to receive messages on	default: 9150
	-v : print version number and quit	default: no

---- Notes ----

Return Codes

Ok - in the range 200-299

211 - Read complete
212 - Filter returns nothing
221 - Store complete
231 - Directory List complete

errors - in the range 400-499   

general errors
401 - Nothing !
402 - No Action Specified
403 - No Logon Specified
404 - Password Incorrect
405 - Unknown Action Specified
406 - Timeout - incomplete Token

411 - No SQL Specified
412 - No DataBase Specified


TagWrapper is FIPSQL
Action is always SQL
Logon and Password - ok
DataBase - need even if 'master'
CMD - sql - must have
maxrows - defaults to all (0)
formatlength - only if you have a Output format template
leavespaces/ - normally leading and trailing spaces are stipped from all fields
except TEXT/BINARY, use this to preserve.
nochrtranslate/ - do not translate '<>&;' into &gt; etc

The Format template is applied to each row of data.
It is a FipSeq string like 

	Name is FA, Title FB, as at $d-$m-$e$yn

Each database field is stuffed in a FipHdr field starting FA.
So	FA holds the first field
	FB the second 
	..
	FZ the twenty sixth
**Text and Binary which should be one and only field are left WITHOUT
formatting.

Exmaple : 
 
<?xml version="1.0">
<FIPSQL>
	<ACTION>sql</ACTION>
	<LOGON>chris</LOGON>
	<password>oinky97</password>

	<DATABASE>master</DATABASE>
	<CMD>sp_helpdb</CMD>
	<FORMATLENGTH>100</FORMATLENGTH>
</FIPSQL>
Database is FA, Size FB, Owner FC, Id FD, Date FEnttOptions FF as at
$d-$m-$e$yn

<?xml version="1.0">
<FIPSQL>
	<ACTION>sql</ACTION>
	<LOGON>chris</LOGON>
	<password>oinky97</password>

	<DATABASE>SOCCER</DATABASE>
	<CMD>select * from MATCHPLAYERS where Name = "Owen"</CMD>
	<MAXROWS>99</MAXROWS>
	<FORMATLENGTH>101</FORMATLENGTH>
</FIPSQL>
Name is FA, Title FB, No of Goals Scored: FC (correct to $d-$m-$e$y)n

Return is
<FIPSQL>
<REPLY>
	<ACTION>SQL</ACTION>
	<RESULT>231</RESULT>
	<DEVICE-RESULT>0</DEVICE-RESULT>
	<FORMATLENGTH>7527</FORMATLENGTH>
</REPLY>
</FIPSQL>
Label.ASV-CDAJA5195-Hits of '30-72-0-0-1-Mid--0-0-
... data up to 7527 bytes


(copyright) 2014 and previous years FingerPost Ltd.