home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
sybaserx.zip
/
README.TXT
next >
Wrap
Text File
|
1995-12-11
|
5KB
|
222 lines
SYBREXX.DLL is a set of REXX extensions that can be used to access SYBASE
SQL Server. In most cases the functions are very similar to the DB-LIBRARY
functions. Not all functions have been implemented and if you need specific
functions let me know and I can probably add them to the library for you.
Mostly it is fairly trivial to create a REXX equivalent for the functions,
but some functions such as dbbind() may prove to be more difficult. These
require a good understanding of how the REXX variable pool works - which I
don't have.
The following functions are provided in this release:
RxSybLoadFuncs
--------------
Loads all the SYBREXX functions
RxSybDropFuncs
--------------
Drops all the SYBREXX functions
iVersion = RxDbversion
----------------------
Returns the REXX library version
RxDbsethandlers(filename)
---------------------------
Registers the error and message handlers
These are internal routines that write
the messages to the screen or to a log file.
In this release no log file is created but
when a filename (or any string) is entered
messages are not displayed. A NULL string
will result in the messages being sent to
the screen (or STDOUT)
RxDbsetlogintime(time)
----------------------
Sets the number of seconds that DB-LIBRARY waits
for an SQL Server response to a request for a
DBPROCESS connection
RxDbsettime(time)
-----------------
Sets the number of seconds that DB-LIBRARY will
wait for an SQL Server response to TRANSACT-SQL
statement
pLoginrec = RxDblogin()
-----------------------
Allocates a login record for use in RxDbopen().
Returns a pointer to a LOGINREC structure. 0 is
returned is the structure could not be
allocated
RxDbsetluser(pLoginrec, username)
---------------------------------
Sets the username in the LOGINREC structure
RxDbsetlpwd(pLoginrec, password)
--------------------------------
Sets the password in the LOGINREC structure
RxDbsetlhost(pLoginrec, hostname)
---------------------------------
Sets the hostname in the LOGINREC structure
RxDbsetlapp(pLoginrec, application)
-----------------------------------
Sets the application name in the LOGINREC structure
RxDbsetlencrypt(pLoginrec, EncryptFlag)
-----------------------------------
Sets the password encryption (EncryptFlag = TRUE or FALSE)
dbproc = RxDbopen(pLoginrec, servername)
----------------------------------------
Allocates and initialises a DBPROCESS structure. DO NOT modify the dbproc
variable and be sure to check its value before using it.
The function returns 0 if it was unable to obtain a dbproc structure. Check
the messages from the SQL Server.
RxDbclose(dbproc)
-----------------
Closes and frees a single DBPROCESS structure
RetCode = RxDbuse(dbproc, databasename)
---------------------------------------
Uses a particular database
RetCode = RxDbcmd(dbproc, cmdstring)
------------------------------------
Adds text to the DBPROCESS command buffer
RetCode = RxDbsqlexec(dbproc)
-----------------------------
Sends a command batch to SQL Server.
RetCode = RxDbsqlsend(dbproc)
-----------------------------
Sends an asynchronous command batch to SQL Server.
RetCode = RxDbok(dbproc)
-----------------------------
Checks whether the command batch has been processed.
RetCode = RxDbresults(dbproc)
-----------------------------
Sets up the results of the next query
RetCode = RxDbrows(dbproc)
--------------------------
Indicates whether the current statement returned rows
RetCode = RxDbnextrow(dbproc)
-----------------------------
Reads in the next row
variable = RxDbdata(dbproc, column)
-----------------------------------
Returns the data for the result column. Note that this function is
not the same as the dbdata() function provided by SYBASE. The actual code
is as follows:
/* Check how much space is required and allocate more if necessary */
ulLen = dbdatlen(dbproc,iColumn);
if (ulLen > 256) {
if (DosAllocMem((PPVOID)&retstr->strptr, ulLen, PAG_WRITE | PAG_COMMIT)) {
printf("DosAllocMem error: return code = %u\n", ulrc);
BUILDRXSTRING(retstr, ERROR_NOMEM);
return VALID_ROUTINE;
}
}
ulLen = dbconvert(dbproc,
(dbcoltype(dbproc,iColumn)),
(dbdata(dbproc,iColumn)),
(dbdatlen(dbproc,iColumn)),
SYBCHAR,
retstr->strptr,
(DBINT)-1);
if (ulLen == -1) {
puts("dbconvert returned -1");
return INVALID_ROUTINE;
}
retstr->strlength = strlen(retstr->strptr);
So the data is always converted to a string before being sent back. If this
presents any problems let me know and I will see if I can fix it.
number = RxDbnumcols(dbproc)
----------------------------
Returns the number of columns for the current set of results
colname = RxDbcolname(dbproc, column)
-------------------------------------
Returns the name of a particular result column
collen = RxDbcollen(dbproc, column)
-------------------------------------
Returns the maximum length of the data for a column
coltype = RxDbcoltype(dbproc, column)
-------------------------------------
Returns the type of the data for a column