@echo off

echo rollback mysql begin...

if not exist ..\Runtime\jre6.0.18\bin (
	echo collector no need to rollback mysql.
	GOTO :EOF
)

setlocal enabledelayedexpansion
set username="";
set password="";

for /f %%1 in ('.\..\Runtime\jre6.0.18\bin\java -jar DecryptUtil-1.0.jar') do (
	set str=%%1
	echo !str!|findstr "username=" >nul
	if !errorlevel! equ 0 (
	set username=!str:~9!)
	echo !str!|findstr "password=" >nul
	if !errorlevel! equ 0 (
	set password=!str:~9!)
)

if exist ..\Runtime\Tomcat6\Lego-UI-Plat\WEB-INF\lib (

	..\MySQL\bin\mysql.exe -u%username% -p%password% < .\sql\6.7.090_create_others_rollback.sql >>.\log\rollback_mysql.log 2>&1
	if %errorlevel% NEQ 0 (GOTO :EOF)
	..\MySQL\bin\mysql.exe -u%username% -p%password% < .\sql\6.7.091_create_others_rollback.sql >>.\log\rollback_mysql.log 2>&1
	if %errorlevel% NEQ 0 (GOTO :EOF)
	..\MySQL\bin\mysql.exe -u%username% -p%password% < .\sql\6.7.100_create_others_rollback.sql >>.\log\rollback_mysql.log 2>&1
	if %errorlevel% NEQ 0 (GOTO :EOF)
	..\MySQL\bin\mysql.exe -u%username% -p%password% < .\sql\6.7.101_create_others_rollback.sql >>.\log\rollback_mysql.log 2>&1
	if %errorlevel% NEQ 0 (GOTO :EOF)
	
)

echo rollback mysql finished.

@echo off
