home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / sybaserx.zip / README.TXT next >
Text File  |  1995-12-11  |  5KB  |  222 lines

  1. SYBREXX.DLL is a set of REXX extensions that can be used to access SYBASE
  2. SQL Server.  In most cases the functions are very similar to the DB-LIBRARY
  3. functions.  Not all functions have been implemented and if you need specific
  4. functions let me know and I can probably add them to the library for you.
  5. Mostly it is fairly trivial to create a REXX equivalent for the functions,
  6. but some functions such as dbbind() may prove to be more difficult.  These
  7. require a good understanding of how the REXX variable pool works - which I
  8. don't have.
  9.  
  10.  
  11.  
  12. The following functions are provided in this release:
  13.  
  14. RxSybLoadFuncs
  15. --------------
  16.  
  17. Loads all the SYBREXX functions
  18.  
  19.  
  20. RxSybDropFuncs
  21. --------------
  22.  
  23. Drops all the SYBREXX functions
  24.  
  25.  
  26. iVersion = RxDbversion
  27. ----------------------
  28.  
  29. Returns the REXX library version
  30.  
  31.  
  32. RxDbsethandlers(filename)
  33. ---------------------------
  34.  
  35. Registers the error and message handlers
  36. These are internal routines that write
  37. the messages to the screen or to a log file.
  38. In this release no log file is created but
  39. when a filename (or any string) is entered
  40. messages are not displayed.  A NULL string
  41. will result in the messages being sent to
  42. the screen (or STDOUT)
  43.  
  44.  
  45. RxDbsetlogintime(time)
  46. ----------------------
  47.  
  48. Sets the number of seconds that DB-LIBRARY waits
  49. for an SQL Server response to a request for a
  50. DBPROCESS connection
  51.  
  52.  
  53. RxDbsettime(time)
  54. -----------------
  55.  
  56. Sets the number of seconds that DB-LIBRARY will
  57. wait for an SQL Server response to  TRANSACT-SQL
  58. statement
  59.  
  60.  
  61. pLoginrec = RxDblogin()
  62. -----------------------
  63.  
  64. Allocates a login record for use in RxDbopen().
  65. Returns a pointer to a LOGINREC structure. 0 is
  66. returned is the structure could not be
  67. allocated
  68.  
  69.  
  70. RxDbsetluser(pLoginrec, username)
  71. ---------------------------------
  72.  
  73. Sets the username in the LOGINREC structure
  74.  
  75.  
  76. RxDbsetlpwd(pLoginrec, password)
  77. --------------------------------
  78.  
  79. Sets the password in the LOGINREC structure
  80.  
  81.  
  82. RxDbsetlhost(pLoginrec, hostname)
  83. ---------------------------------
  84.  
  85. Sets the hostname in the LOGINREC structure
  86.  
  87.  
  88. RxDbsetlapp(pLoginrec, application)
  89. -----------------------------------
  90.  
  91. Sets the application name in the LOGINREC structure
  92.  
  93.  
  94. RxDbsetlencrypt(pLoginrec, EncryptFlag)
  95. -----------------------------------
  96.  
  97. Sets the password encryption (EncryptFlag = TRUE or FALSE)
  98.  
  99.  
  100. dbproc = RxDbopen(pLoginrec, servername)
  101. ----------------------------------------
  102.  
  103. Allocates and initialises a DBPROCESS structure. DO NOT modify the dbproc
  104. variable and be sure to check its value before using it.
  105. The function returns 0 if it was unable to obtain a dbproc structure. Check
  106. the messages from the SQL Server.
  107.  
  108.  
  109. RxDbclose(dbproc)
  110. -----------------
  111.  
  112. Closes and frees a single DBPROCESS structure
  113.  
  114.  
  115. RetCode = RxDbuse(dbproc, databasename)
  116. ---------------------------------------
  117.  
  118. Uses a particular database
  119.  
  120.  
  121. RetCode = RxDbcmd(dbproc, cmdstring)
  122. ------------------------------------
  123.  
  124. Adds text to the DBPROCESS command buffer
  125.  
  126.  
  127. RetCode = RxDbsqlexec(dbproc)
  128. -----------------------------
  129.  
  130. Sends a command batch to SQL Server.
  131.  
  132.  
  133. RetCode = RxDbsqlsend(dbproc)
  134. -----------------------------
  135.  
  136. Sends an asynchronous command batch to SQL Server.
  137.  
  138.  
  139. RetCode = RxDbok(dbproc)
  140. -----------------------------
  141.  
  142. Checks whether the command batch has been processed.
  143.  
  144.  
  145. RetCode = RxDbresults(dbproc)
  146. -----------------------------
  147.  
  148. Sets up the results of the next query
  149.  
  150.  
  151. RetCode = RxDbrows(dbproc)
  152. --------------------------
  153.  
  154. Indicates whether the current statement returned rows
  155.  
  156. RetCode = RxDbnextrow(dbproc)
  157. -----------------------------
  158.  
  159. Reads in the next row
  160.  
  161.  
  162. variable = RxDbdata(dbproc, column)
  163. -----------------------------------
  164.  
  165. Returns the data for the result column.  Note that this function is
  166. not the same as the dbdata() function provided by SYBASE.  The actual code
  167. is as follows:
  168.  
  169.   /* Check how much space is required and allocate more if necessary */
  170.   ulLen = dbdatlen(dbproc,iColumn);
  171.  
  172.   if (ulLen > 256) {
  173.     if (DosAllocMem((PPVOID)&retstr->strptr, ulLen, PAG_WRITE | PAG_COMMIT)) {
  174.       printf("DosAllocMem error: return code = %u\n", ulrc);
  175.       BUILDRXSTRING(retstr, ERROR_NOMEM);
  176.       return VALID_ROUTINE;
  177.     }
  178.   }
  179.  
  180.   ulLen = dbconvert(dbproc,
  181.                    (dbcoltype(dbproc,iColumn)),
  182.                    (dbdata(dbproc,iColumn)),
  183.                    (dbdatlen(dbproc,iColumn)),
  184.                    SYBCHAR,
  185.                    retstr->strptr,
  186.                    (DBINT)-1);
  187.  
  188.   if (ulLen == -1) {
  189.     puts("dbconvert returned -1");
  190.     return INVALID_ROUTINE;
  191.   }
  192.  
  193.   retstr->strlength = strlen(retstr->strptr);
  194.  
  195. So the data is always converted to a string before being sent back.  If this
  196. presents any problems let me know and I will see if I can fix it.
  197.  
  198.  
  199.  
  200. number = RxDbnumcols(dbproc)
  201. ----------------------------
  202.  
  203. Returns the number of columns for the current set of results
  204.  
  205.  
  206. colname = RxDbcolname(dbproc, column)
  207. -------------------------------------
  208.  
  209. Returns the name of a particular result column
  210.  
  211.  
  212. collen = RxDbcollen(dbproc, column)
  213. -------------------------------------
  214.  
  215. Returns the maximum length of the data for a column
  216.  
  217.  
  218. coltype = RxDbcoltype(dbproc, column)
  219. -------------------------------------
  220.  
  221. Returns the type of the data for a column
  222.