Previous Next Table of Contents

3. SQLkit_sol functions.

3.1 open_sol()

Connect to a Solid database. This function must be called before any other SQLkit_sol function.

PARAMETERS     : Three required. (Server, uid, passwd)

RETURN VALUE   : integer : zero means success,  negative  
                 one (-1) indicates an error. Tail PG_ERROR_LOG
                 for the specific error message.

EXAMPLE  :   

LOCAL nRetVal := open_sol ("tcp localhost 1313", "solid", "MySecret" )

LOCAL nRetVal := open_sol ("UPipe SOLID", "solid", "MySecret" )

See the Solid documentation for the different ways you may setup your server.

3.2 close_sol()

Disconnect from a Solid database.

PARAMETERS     : none.

RETURN VALUE   : integer : zero means success,  negative  
                 one (-1) indicates an error. Tail SQL_ERROR_LOG
                 for the specific error message.
EXAMPLE  :   

LOCAL nRetVal := close_sol()

3.3 commit_sol()

Commit a transaction.

PARAMETERS     : none.

RETURN VALUE   : integer : zero means success,  negative  
                 one (-1) indicates an error. Tail SQL_ERROR_LOG
                 for the specific error message.

EXAMPLE  :   

LOCAL nRetVal := commit_sol()

3.4 rb_sol()

ROLLBACK a transaction.

PARAMETERS     : none.

RETURN VALUE   : integer : zero means success,  negative  
                 one (-1) indicates an error. Tail SQL_ERROR_LOG
                 for the specific error message.

EXAMPLE  :   

LOCAL nRetVal := rb_sol()

3.5 ret_sol()

Retrieve (select) records from a Solid database.

PARAMETERS     :  three required.

   cSelect     :  SQL select statement

   @tfilename  :  a pointer to a variable that will contain the
                  temporary file name where the retrieved records
                  are stored.

   @fieldcount :  a pointer to a variable that will contain the
                  number of fields making up each retrieved record.

RETURN VALUE   :  A positive integer or zero indicating the number
                  of records retrieved; or a negative one (-1) 
                  indicating an error. Tail SQL_ERROR_LOG for the
                  specific error message. 
                  If zero or -1 is returned, no temporary file is 
                  created.
EXAMPLE  :  

LOCAL cSelect := "select * from part order by part_no" 
LOCAL tfilename := "" 
LOCAL fieldcount := 0 
LOCAL nRowCount := ret_sol(cSelect, @tfilename, @fieldcount) 

This will retrieve into a temporary file all records in the part table in ascending order of their part number. Please note that parameters two and three are pointers and must have ``@'' in front of them. Their values are available after ret_sol() returns.

3.6 exec_sol()

Execute a non-select SQL statement.

PARAMETER   : one required.

  cStatement   : SQL statement

RETURN VALUE   : integer : zero means success,  negative  
                 one (-1) indicates an error. Tail SQL_ERROR_LOG
                 for the specific error message.

EXAMPLE  :   

LOCAL cStatement := "update part set name = 'radiator' where part_no = 1034"
LOCAL nRetVal := exec_sol( cStatement )

3.7 aret_sol()

Retrieve count of tuples from a Solid Server.

PARAMETERS     :  One required.

   cSelect     :  SQL select statement


RETURN VALUE   :  A positive integer or zero indicating the number
                  of records retrieved; or a negative one (-1) 
                  indicating an error. Tail SQL_ERROR_LOG for the
                  specific error message. 
EXAMPLE  :  

LOCAL cSelect := "select part_no from part where quantity > 12" 
LOCAL nRowCount := aret_sol( cSelect )

This will establish the number of qualifying tuples. Unlike the SQL statement count(*), aret_sol() will lock the select records, so it may be advisable to call commit_sol() or rb_sol() after using this function.


Previous Next Table of Contents