41 lines
1.5 KiB
Batchfile
41 lines
1.5 KiB
Batchfile
@echo off
|
|
|
|
set table_name="test_db"
|
|
set create_table="create table %table_name%(user_code VARCHAR(20),user_name VARCHAR(20),user_desc VARCHAR(50));"
|
|
set drop_table="drop table %table_name%;"
|
|
set insert_table="insert into %table_name% values('test','test','test');"
|
|
set query_table="select count(*) from %table_name%;"
|
|
|
|
if "%1" == "create" goto create
|
|
if "%1" == "drop" goto drop
|
|
if "%1" == "insert" goto insert
|
|
if "%1" == "query" goto query
|
|
echo "ERROR"
|
|
exit
|
|
|
|
:create
|
|
isql -h localhost -U SYSTEM -W 123456 -d %2 -p 54321 -c %create_table%
|
|
exit
|
|
|
|
:drop
|
|
isql -h localhost -U SYSTEM -W 123456 -d %2 -p 54321 -c %drop_table%
|
|
exit
|
|
|
|
:insert:
|
|
isql -h localhost -U SYSTEM -W 123456 -d %2 -p 54321 -c %insert_table%
|
|
isql -h localhost -U SYSTEM -W 123456 -d %2 -p 54321 -c %insert_table%
|
|
isql -h localhost -U SYSTEM -W 123456 -d %2 -p 54321 -c %insert_table%
|
|
isql -h localhost -U SYSTEM -W 123456 -d %2 -p 54321 -c %insert_table%
|
|
isql -h localhost -U SYSTEM -W 123456 -d %2 -p 54321 -c %insert_table%
|
|
isql -h localhost -U SYSTEM -W 123456 -d %2 -p 54321 -c %insert_table%
|
|
isql -h localhost -U SYSTEM -W 123456 -d %2 -p 54321 -c %insert_table%
|
|
isql -h localhost -U SYSTEM -W 123456 -d %2 -p 54321 -c %insert_table%
|
|
isql -h localhost -U SYSTEM -W 123456 -d %2 -p 54321 -c %insert_table%
|
|
isql -h localhost -U SYSTEM -W 123456 -d %2 -p 54321 -c %insert_table%
|
|
exit
|
|
|
|
:query
|
|
setlocal enabledelayedexpansion
|
|
for /f "delims=" %%i in ('isql -h localhost -U SYSTEM -W 123456 -d %2 -p 54321 -c %query_table%') do (set /a n+=1 & if !n!==3 set num=%%i)
|
|
echo %num%
|
|
exit |