@echo off rem **************************************************************************/ rem * */ rem * Licensed Materials - Property of IBM */ rem * */ rem * "Restricted Materials of IBM" */ rem * */ rem * IBM Informix Dynamic Server */ rem * Copyright IBM Corporation 2007, 2009 All rights reserved. */ rem * */ rem **************************************************************************/ if %1test==/?test goto usage if %1test==--test goto usage if %1test==-?test goto usage if %1test==-helptest goto usage if "%INFORMIXDIR%notset" == "notset" goto error_infxdir if "%INFORMIXSERVER%notset" == "notset" goto error_infxserver if not exist %INFORMIXDIR%\demo\dbaccess\demo_ud goto error_demodir set CLIENT_LOCALE_SAV=%CLIENT_LOCALE% echo Running dbaccessdemo_ud requires that you have a smartblob space echo named sbspace. If this sbspace does not exist the demo will fail. echo Please make sure that this sbspace exists. echo. echo To create the sbspace run the following command as a member echo of the Informix-admin group: echo. echo " onspaces -c -S sbspace -p -o 0 -s 4000 " echo. echo where PATH is the location of an existing file in which the sbspace will echo be created. You can use either a full pathname or a relative pathname. echo Relative pathname must be relative to the directory that was the current echo directory when you initialized the database server. echo. echo Press CTRL-C if you want to exit the demo now. pause set GL_DATE_SAV=%GL_DATE% set DBMONEY_SAV=%DBMONEY% set CREATE_SAV=%CREATE% set DB_SAV=%DB% set IN_SAV=%IN% set DBSPACE_SAV=%DBSPACE% set WLOG_SAV=%WLOG% set GL_DATE=%%m/%%d/%%Y set DBMONEY=$. set CREATE=CREATE DATABASE set DB=superstores_demo set IN= set DBSPACE= set WLOG= REM evaluate command line arguments if %1test==test goto startdb if %1test==-logtest goto log1 if %1test==-dbspacetest goto dbspace1 set DB=%1 goto test2 :log1 set WLOG=WITH LOG goto test2 :dbspace1 set IN=in set DBSPACE=%2 :test2 if %2test==test goto startdb if %2test==-logtest goto log2 if %2test==-dbspacetest goto dbspace2 if NOT %1test==-dbspacetest SET DB=%2 goto test3 :log2 set WLOG=WITH LOG goto test3 :dbspace2 set IN=in set DBSPACE=%3 :test3 if %3test==test goto startdb if %3test==-logtest goto log3 if %3test==-dbspacetest goto dbspace3 if NOT %2test==-dbspacetest SET DB=%3 goto test4 :log3 set WLOG=WITH LOG goto test4 :dbspace3 set IN=in set DBSPACE=%4 :test4 if %4test==test goto startdb if %4test==-logtest goto log4 if NOT %3test==-dbspacetest SET DB=%4 goto startdb: :log4 set WLOG=WITH LOG :startdb REM cd %INFORMIXDIR%\demo\dbaccess\demo_ud call %INFORMIXDIR%\%INFORMIXSERVER%.cmd if /i "%DB_LOCALE%notset" == "notset" set DB_LOCALE=EN_US.8859-1 if /i "%DB_LOCALE%" == "EN_US.C" set DB_LOCALE=EN_US.8859-1 if /i "%DB_LOCALE%" == "EN_US.POSIX" set DB_LOCALE=EN_US.8859-1 if /i "%DB_LOCALE%" == "EN_US.Latin-1" set DB_LOCALE=EN_US.8859-1 if /i "%DB_LOCALE%" == "EN_US.819" set DB_LOCALE=EN_US.8859-1 if /i not "%DB_LOCALE%" == "EN_US.8859-1" echo Setting DB_LOCALE to EN_US.8859-1 set DB_LOCALE=EN_US.8859-1 set CLIENT_LOCALE=EN_US.CP1252 pushd %INFORMIXDIR%\demo\dbaccess\demo_ud REM drop the existing %DB% database echo Dropping existing %DB% database... echo DROP DATABASE %DB% | dbaccess - REM copy CLOBFILES to \tmp echo Copying demo data files... md \tmp copy %INFORMIXDIR%\demo\dbaccess\demo_ud\cn_1001.gif \tmp copy %INFORMIXDIR%\demo\dbaccess\demo_ud\cn_1027.gif \tmp copy %INFORMIXDIR%\demo\dbaccess\demo_ud\cn_1031.gif \tmp copy %INFORMIXDIR%\demo\dbaccess\demo_ud\cn_1046.gif \tmp copy %INFORMIXDIR%\demo\dbaccess\demo_ud\cn_1049.gif \tmp copy %INFORMIXDIR%\demo\dbaccess\demo_ud\catalog.des \tmp echo. REM create the database echo Creating %DB% database... echo %CREATE% %DB% %IN% %DBSPACE% %WLOG% | dbaccess - if not errorlevel 0 goto error_cdb REM create external table echo preparing external table command... echo create external table ext_customer sameas customer > %INFORMIXDIR%\demo\dbaccess\demo_ud\c_ext_table.sql echo using (datafiles ("disk:%INFORMIXDIR%\demo\dbaccess\demo_ud\ext_customer_9.unl"), >> %INFORMIXDIR%\demo\dbaccess\demo_ud\c_ext_table.sql echo numrows 3 >> %INFORMIXDIR%\demo\dbaccess\demo_ud\c_ext_table.sql echo ); >> %INFORMIXDIR%\demo\dbaccess\demo_ud\c_ext_table.sql REM create the tables echo Creating tables... dbaccess %DB% %INFORMIXDIR%\demo\dbaccess\demo_ud\c_tables.sql if not errorlevel 0 goto error_ctables REM create external table echo Creating externl table... dbaccess %DB% %INFORMIXDIR%\demo\dbaccess\demo_ud\c_ext_table.sql if not errorlevel 0 goto error_ctables REM load data echo Loading data... dbaccess %DB% %INFORMIXDIR%\demo\dbaccess\demo_ud\c_load.sql if not errorlevel 0 goto error_load REM remove CLOBFILES from \tmp echo. echo Removing demo data files... del \tmp\cn_1001.gif del \tmp\cn_1027.gif del \tmp\cn_1031.gif del \tmp\cn_1046.gif del \tmp\cn_1049.gif del \tmp\catalog.des echo. goto SUCCESS :usage echo "Usage: dbaccessdemo_ud [-log] [-dbspace ] []" goto end :error_infxdir echo INFORMIXDIR environment variable not set. goto end :error_infxserver echo INFORMIXSERVER environment variable not set goto end :error_cdb echo Database creation failed. goto end :error_ctables echo Tables creation failed. goto end :error_load echo Load data failed. goto end :error_demodir echo Directory %INFORMIXDIR%\demo\dbaccess\demo_ud not found. goto end :SUCCESS echo The %DB% database created successfully. echo The demo files can be found in %INFORMIXDIR%\demo\dbaccess\demo_ud. echo. :end set GL_DATE=%GL_DATE_SAV% set DBMONEY=%DBMONEY_SAV% set CREATE=%CREATE_SAV% set DB=%DB_SAV% set IN=%IN_SAV% set DBSPACE=%DBSPACE_SAV% set WLOG=%WLOG_SAV% set CLIENT_LOCALE=%CLIENT_LOCALE_SAV% set GL_DATE_SAV= set DBMONEY_SAV= set CREATE_SAV= set DB_SAV= set IN_SAV= set DBSPACE_SAV= set WLOG_SAV= set CLIENT_LOCALE_SAV= echo. popd