home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / eupm2_24.zip / QueryDB.cmd < prev    next >
OS/2 REXX Batch file  |  1999-08-11  |  2KB  |  78 lines

  1. /* Das Script liefert Informationen zur übergebenen Tabelle */
  2.  
  3. call RxFuncAdd SysLoadFuncs, RexxUtil, SysLoadFuncs
  4. call SysLoadFuncs
  5.  
  6. call RxFuncAdd 'DbRxLoadFuncs', CaTable, 'DbRxLoadFuncs' 
  7. call DbRxLoadFuncs
  8.  
  9. parse arg Name
  10.  
  11. if length( Name )=0 then
  12. do 
  13.    say 'Dieses Script liefert Informationen zu einer Tabelle'
  14.    say 'welche von CaTable verwaltet wird.'
  15.    say 'Syntax:'
  16.    say 'QueryDB.cmd Dateiname'
  17.    exit
  18. end /* do */
  19.  
  20. say 'CaTable Version 'DbRxVersion()
  21.  
  22.  
  23. rc = SysFileTree( Name, 'Dir', 'FO' )
  24. do i=1 to Dir.0
  25.    ulCount = TestFile( Dir.i )
  26.    if ulCount==0 then
  27.    call SysFileDelete Dir.i
  28. end /* do */
  29.  
  30. exit
  31.  
  32.  
  33. TestFile:
  34. procedure
  35. parse arg name
  36.  
  37. ulCount = 1
  38. say ''
  39. say Name
  40. rc = DbRxOpen( Name, 'hTable' )
  41. if rc>0 then 
  42. do 
  43.    say 'Die Datei 'Name' ist warscheinlich keine Datenbanktatei'
  44.    say DbRxGetErrorText( rc ) 'bei open'
  45.    return rc
  46. end /* do */
  47.  
  48. rc = DbRxQueryColDef( hTable, 'Def' )
  49. if rc>0 then say DbRxGetErrorText( rc ) 'bei DbRxQueryColDef'
  50. else say 'Spaltendefinition:' Def
  51.  
  52. rc = DbRxQueryComment( hTable, 'Comment' )
  53. if rc>0 then say DbRxGetErrorText( rc ) 'bei DbQueryComment'
  54. else say 'Kommentar:' Comment
  55.  
  56. rc = DbRxQueryUserVersion( hTable, 'Version' )
  57. if rc>0 then say DbRxGetErrorText( rc ) 'bei DbRxQueryUserVersion'
  58. else say 'Version:' Version
  59.  
  60. rc = DbRxStartRead( hTable, 'hRead', 'ulCount' )
  61. if rc>0 then say DbRxGetErrorText( rc ) 'bei DbRxStartRead'
  62. else 
  63. do 
  64.    say 'Anzahl der enthaltenen Datensätze:' ulCount
  65.    rc = DbRxEndRead( hRead )
  66.    if rc>0 then say DbRxGetErrorText( rc ) 'bei DbRxEndRead'
  67. end /* do */
  68.  
  69. rc = DbRxClose( hTable );
  70. if rc>0 then 
  71. do 
  72.    say DbRxGetErrorText( rc ) 'bei Close'
  73. end /* do */
  74.    call SysSleep 1
  75.  
  76. return ulCount
  77.  
  78.