• Welcome to OS2World OLD-STATIC-BACKUP Forum.
 

News:

This is an old OS2World backup forum for reference only. IT IS READ ONLY!!!

If you need help with OS/2 - eComStation visit http://www.os2world.com/forum

Main Menu

Database engine written in rexx

Started by jep, 2011.12.24, 12:02:42

Previous topic - Next topic

jep

#15
REXX SQL Engine - Mid Summer Edition

Tweaks added The options you can set as environment variables
TCP/IP network connectionTested with a slightly modified example from EDM/2
External NLSNational Language Support available in Swedish and English


I'd like to ask for your help to add IPC through rxu.
A short example would be nice to have.

Regarding TCP/IP
Ensure that the port 2638 (41592, 41593, 42595, 41596, 41597, 42598, 45299 & 6110 if you consume ports by crashing) is open in your firewall and router.
Type in the command line:
rxdb TCPIP PRELOAD mytable
where "mytable" is a table in the right file format.
ON the "client" ide you can type tmsg <ip-number> SELECT TOP 300 COUNT(*),PATH FROM mytable WHERE PATH != '\' GROUP BY EXTENSION where <ip-number> should be replaced by something similar to 192.168.0.123
Close the server with QUIT on the client.

Use tmsg.cmd from EDM/2 (with port set to the one the server select to send the SQL query to use) and modify some of the code for example to:
/*------------------------------------------------------------------
* send message across ... loop in case entire message can't be sent
* in one SockSend()
*------------------------------------------------------------------*/
cr = d2c(13)
lf = d2c(10)
crlf = cr || lf

message = message || crlf

do while (message <> "")
  bytes = SockSend(socket,message)

  message = substr(message,bytes+1)
end
say date() time() ': sent'

   text = ''

IF TRANSLATE( ARG(1) ) <> 'QUIT' THEN
DO WHILE rc > -1 & chunk <> ''
   text = ''
       rc = SockRecv( socket, 'chunk', 1000 )
/*        IF rc < 0 | chunk = '' THEN
           text = text||crlf*/
       text = text||chunk
   SAY 'recieved:' rc ':' text
END
say date() time()


Is it possible to write code (workstation/client side) to figure out which port this db-server use when the client tries to connect?
How?
               
//Jan-Erik

jep

#16
Update to rxdb.cmd

Can now handle mixed and lower case statements.
Before:
SELECT * FROM mytable WHERE pos( 'DOCUMENTS', fname ) != 0
Now:
sELect * FRoM mytable WhErE pos( 'DOCUMENTS', fname ) != 0

You should now also get better results from:
SELECT count(*), sum(filesize) from mytable WHERE pos( 'DOCUMENTS', fname ) != 0 GROUP BY path


Note that you have to handle mixed case comparisons like before.

Example:
select * from mytable Where pos( 'DOCUMENTS', fname ) != 0
can only find filenames with the text DOCUMENTS in upper case, while

select * from mytable Where pos( 'DOCUMENTS', translate( fname ) ) != 0
will find any filename that contain the text documents as the function "translate(...)" convert the text to upper case before the comparison.

Note: rxdb.cmd is a stand alone database engine but it doesn't (yet) work with ODBC.

//Jan-Erik