dbdemo_ud.cmd 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. @echo off
  2. rem **************************************************************************/
  3. rem * */
  4. rem * Licensed Materials - Property of IBM */
  5. rem * */
  6. rem * "Restricted Materials of IBM" */
  7. rem * */
  8. rem * IBM Informix Dynamic Server */
  9. rem * Copyright IBM Corporation 2007, 2009 All rights reserved. */
  10. rem * */
  11. rem **************************************************************************/
  12. if %1test==/?test goto usage
  13. if %1test==--test goto usage
  14. if %1test==-?test goto usage
  15. if %1test==-helptest goto usage
  16. if "%INFORMIXDIR%notset" == "notset" goto error_infxdir
  17. if "%INFORMIXSERVER%notset" == "notset" goto error_infxserver
  18. if not exist %INFORMIXDIR%\demo\dbaccess\demo_ud goto error_demodir
  19. set CLIENT_LOCALE_SAV=%CLIENT_LOCALE%
  20. echo Running dbaccessdemo_ud requires that you have a smartblob space
  21. echo named sbspace. If this sbspace does not exist the demo will fail.
  22. echo Please make sure that this sbspace exists.
  23. echo.
  24. echo To create the sbspace run the following command as a member
  25. echo of the Informix-admin group:
  26. echo.
  27. echo " onspaces -c -S sbspace -p <PATH> -o 0 -s 4000 "
  28. echo.
  29. echo where PATH is the location of an existing file in which the sbspace will
  30. echo be created. You can use either a full pathname or a relative pathname.
  31. echo Relative pathname must be relative to the directory that was the current
  32. echo directory when you initialized the database server.
  33. echo.
  34. echo Press CTRL-C if you want to exit the demo now.
  35. pause
  36. set GL_DATE_SAV=%GL_DATE%
  37. set DBMONEY_SAV=%DBMONEY%
  38. set CREATE_SAV=%CREATE%
  39. set DB_SAV=%DB%
  40. set IN_SAV=%IN%
  41. set DBSPACE_SAV=%DBSPACE%
  42. set WLOG_SAV=%WLOG%
  43. set GL_DATE=%%m/%%d/%%Y
  44. set DBMONEY=$.
  45. set CREATE=CREATE DATABASE
  46. set DB=superstores_demo
  47. set IN=
  48. set DBSPACE=
  49. set WLOG=
  50. REM evaluate command line arguments
  51. if %1test==test goto startdb
  52. if %1test==-logtest goto log1
  53. if %1test==-dbspacetest goto dbspace1
  54. set DB=%1
  55. goto test2
  56. :log1
  57. set WLOG=WITH LOG
  58. goto test2
  59. :dbspace1
  60. set IN=in
  61. set DBSPACE=%2
  62. :test2
  63. if %2test==test goto startdb
  64. if %2test==-logtest goto log2
  65. if %2test==-dbspacetest goto dbspace2
  66. if NOT %1test==-dbspacetest SET DB=%2
  67. goto test3
  68. :log2
  69. set WLOG=WITH LOG
  70. goto test3
  71. :dbspace2
  72. set IN=in
  73. set DBSPACE=%3
  74. :test3
  75. if %3test==test goto startdb
  76. if %3test==-logtest goto log3
  77. if %3test==-dbspacetest goto dbspace3
  78. if NOT %2test==-dbspacetest SET DB=%3
  79. goto test4
  80. :log3
  81. set WLOG=WITH LOG
  82. goto test4
  83. :dbspace3
  84. set IN=in
  85. set DBSPACE=%4
  86. :test4
  87. if %4test==test goto startdb
  88. if %4test==-logtest goto log4
  89. if NOT %3test==-dbspacetest SET DB=%4
  90. goto startdb:
  91. :log4
  92. set WLOG=WITH LOG
  93. :startdb
  94. REM cd %INFORMIXDIR%\demo\dbaccess\demo_ud
  95. call %INFORMIXDIR%\%INFORMIXSERVER%.cmd
  96. if /i "%DB_LOCALE%notset" == "notset" set DB_LOCALE=EN_US.8859-1
  97. if /i "%DB_LOCALE%" == "EN_US.C" set DB_LOCALE=EN_US.8859-1
  98. if /i "%DB_LOCALE%" == "EN_US.POSIX" set DB_LOCALE=EN_US.8859-1
  99. if /i "%DB_LOCALE%" == "EN_US.Latin-1" set DB_LOCALE=EN_US.8859-1
  100. if /i "%DB_LOCALE%" == "EN_US.819" set DB_LOCALE=EN_US.8859-1
  101. if /i not "%DB_LOCALE%" == "EN_US.8859-1" echo Setting DB_LOCALE to EN_US.8859-1
  102. set DB_LOCALE=EN_US.8859-1
  103. set CLIENT_LOCALE=EN_US.CP1252
  104. pushd %INFORMIXDIR%\demo\dbaccess\demo_ud
  105. REM drop the existing %DB% database
  106. echo Dropping existing %DB% database...
  107. echo DROP DATABASE %DB% | dbaccess -
  108. REM copy CLOBFILES to \tmp
  109. echo Copying demo data files...
  110. md \tmp
  111. copy %INFORMIXDIR%\demo\dbaccess\demo_ud\cn_1001.gif \tmp
  112. copy %INFORMIXDIR%\demo\dbaccess\demo_ud\cn_1027.gif \tmp
  113. copy %INFORMIXDIR%\demo\dbaccess\demo_ud\cn_1031.gif \tmp
  114. copy %INFORMIXDIR%\demo\dbaccess\demo_ud\cn_1046.gif \tmp
  115. copy %INFORMIXDIR%\demo\dbaccess\demo_ud\cn_1049.gif \tmp
  116. copy %INFORMIXDIR%\demo\dbaccess\demo_ud\catalog.des \tmp
  117. echo.
  118. REM create the database
  119. echo Creating %DB% database...
  120. echo %CREATE% %DB% %IN% %DBSPACE% %WLOG% | dbaccess -
  121. if not errorlevel 0 goto error_cdb
  122. REM create external table
  123. echo preparing external table command...
  124. echo create external table ext_customer sameas customer > %INFORMIXDIR%\demo\dbaccess\demo_ud\c_ext_table.sql
  125. echo using (datafiles ("disk:%INFORMIXDIR%\demo\dbaccess\demo_ud\ext_customer_9.unl"), >> %INFORMIXDIR%\demo\dbaccess\demo_ud\c_ext_table.sql
  126. echo numrows 3 >> %INFORMIXDIR%\demo\dbaccess\demo_ud\c_ext_table.sql
  127. echo ); >> %INFORMIXDIR%\demo\dbaccess\demo_ud\c_ext_table.sql
  128. REM create the tables
  129. echo Creating tables...
  130. dbaccess %DB% %INFORMIXDIR%\demo\dbaccess\demo_ud\c_tables.sql
  131. if not errorlevel 0 goto error_ctables
  132. REM create external table
  133. echo Creating externl table...
  134. dbaccess %DB% %INFORMIXDIR%\demo\dbaccess\demo_ud\c_ext_table.sql
  135. if not errorlevel 0 goto error_ctables
  136. REM load data
  137. echo Loading data...
  138. dbaccess %DB% %INFORMIXDIR%\demo\dbaccess\demo_ud\c_load.sql
  139. if not errorlevel 0 goto error_load
  140. REM remove CLOBFILES from \tmp
  141. echo.
  142. echo Removing demo data files...
  143. del \tmp\cn_1001.gif
  144. del \tmp\cn_1027.gif
  145. del \tmp\cn_1031.gif
  146. del \tmp\cn_1046.gif
  147. del \tmp\cn_1049.gif
  148. del \tmp\catalog.des
  149. echo.
  150. goto SUCCESS
  151. :usage
  152. echo "Usage: dbaccessdemo_ud [-log] [-dbspace <dbspace name>] [<database name>]"
  153. goto end
  154. :error_infxdir
  155. echo INFORMIXDIR environment variable not set.
  156. goto end
  157. :error_infxserver
  158. echo INFORMIXSERVER environment variable not set
  159. goto end
  160. :error_cdb
  161. echo Database creation failed.
  162. goto end
  163. :error_ctables
  164. echo Tables creation failed.
  165. goto end
  166. :error_load
  167. echo Load data failed.
  168. goto end
  169. :error_demodir
  170. echo Directory %INFORMIXDIR%\demo\dbaccess\demo_ud not found.
  171. goto end
  172. :SUCCESS
  173. echo The %DB% database created successfully.
  174. echo The demo files can be found in %INFORMIXDIR%\demo\dbaccess\demo_ud.
  175. echo.
  176. :end
  177. set GL_DATE=%GL_DATE_SAV%
  178. set DBMONEY=%DBMONEY_SAV%
  179. set CREATE=%CREATE_SAV%
  180. set DB=%DB_SAV%
  181. set IN=%IN_SAV%
  182. set DBSPACE=%DBSPACE_SAV%
  183. set WLOG=%WLOG_SAV%
  184. set CLIENT_LOCALE=%CLIENT_LOCALE_SAV%
  185. set GL_DATE_SAV=
  186. set DBMONEY_SAV=
  187. set CREATE_SAV=
  188. set DB_SAV=
  189. set IN_SAV=
  190. set DBSPACE_SAV=
  191. set WLOG_SAV=
  192. set CLIENT_LOCALE_SAV=
  193. echo.
  194. popd