home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rexxgdb2.zip / G2One.CMD < prev    next >
OS/2 REXX Batch file  |  1997-08-10  |  2KB  |  87 lines

  1. /* rexx */
  2. parse arg argument
  3.  
  4. signal on error
  5. signal on syntax  name error
  6. signal on halt    name error
  7. signal on failure name error
  8. '@echo off'
  9.  
  10. if pos('"', argument) = 0 then
  11.    sql = strip(argument)
  12. else
  13.    parse var argument '"' sql '"' .
  14. sql = strip(sql)
  15. if sql = '' then
  16.    sql = 'select name from staff where length(name) = ' ||,
  17.                  '(select max(length(name)) from staff)'
  18. 'cls'
  19. say
  20. say 'G2One --- Testing REXXGDB2.DLL function: G2SelectOne'
  21. say 'Simon Husin (husin@ibm.net)'
  22. say 'Kent, Washington, U.S.A., December 1995'
  23. say
  24. say 'SQL:' sql
  25.  
  26. if rxfuncquery('g2LoadFuncs') then do
  27.    say
  28.    say 'Loading REXXGDB2 Functions...'
  29.    call rxfuncadd 'g2LoadFuncs', 'REXXGDB2', 'g2LoadFuncs'
  30.    say 'Result =' g2LoadFuncs()
  31.    end
  32.  
  33. say
  34. call time 'R'
  35. say 'Connecting to SAMPLE database...'
  36. call g2connectshare 'SAMPLE'
  37. say 'Execution time    ' time('E') / 1
  38.  
  39. say
  40. call time 'R'
  41. returned = g2selectone(sql)
  42. elapse = time('E')
  43. say 'SelectOne returns ' returned
  44. say '           length ' length(returned)
  45. say ' G2SQLCODE        ' g2sqlcode
  46. say 'Execution time    ' elapse / 1
  47.  
  48. if g2sqlcode \= 0 |,
  49.    returned \= '' then do
  50.    say
  51.    call time 'R'
  52.    say 'Commiting...'
  53.    call g2commit
  54.    say 'Execution time    ' time('E') / 1
  55.    return /* returned value is not NULL */
  56.    end
  57.  
  58. say
  59. say 'Enter any character(s) to do the same query to replace NULL char.'
  60. parse pull nullchar
  61.  
  62. say
  63. call time 'R'
  64. returned = g2selectone(sql, nullchar)
  65. elapse = time('E')
  66. say 'SelectOne returns ' returned
  67. say '           length ' length(returned)
  68. say ' G2SQLCODE        ' g2sqlcode
  69. say 'Execution time    ' elapse / 1
  70.  
  71. say
  72. call time 'R'
  73. say 'Commiting...'
  74. call g2commit
  75. say 'Execution time    ' time('E') / 1
  76. return 0
  77.  
  78.  
  79.  
  80. error:
  81. say 'Error detected...'
  82. return 10
  83.  
  84. syntax:
  85. say 'Syntax error detected...'
  86. return 20
  87.