Skip to content

Instantly share code, notes, and snippets.

@lovasoa
Created January 29, 2018 21:02
Show Gist options
  • Save lovasoa/9f07640348dc65c22652d734dcc248d2 to your computer and use it in GitHub Desktop.
Save lovasoa/9f07640348dc65c22652d734dcc248d2 to your computer and use it in GitHub Desktop.
Ашот линтер
:: Avoids displaying the commands we execute
@ECHO OFF
:: Adds linter utilities to the path
SET PATH=%PATH%;C:\Program Files (x86)\Linter\bin
:: Creates a database table named people
set sqlstr=CREATE OR REPLACE TABLE people (id INTEGER PRIMARY KEY, name VARCHAR(1024));
echo %sqlstr% | inl -u SYSTEM/MANAGER -n Demo -t -q
:: generates the csv
del people.csv
for %%i in (1,2,3) do echo %%i,'User%%i'>>people.csv
:: loads the csv in the table
loarel -u SYSTEM/MANAGER -n Demo -f people.csv -t "PEOPLE" -r , -rt ' -rr >nul
:: tests the data in the table
echo select id,name from people where id=3; > query.sql
set sqlcmd=inl -u SYSTEM/MANAGER -n Demo -t -q -f query.sql
FOR /F "eol= skip=3 tokens=2 delims=|: " %%g IN ('%sqlcmd%') do (
if "%%g"=="User3" (
echo OK
) else (
echo KO
)
goto :eof
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment