-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·159 lines (122 loc) · 6.56 KB
/
test.sh
File metadata and controls
executable file
·159 lines (122 loc) · 6.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/bin/bash
ip=$1
if [[ -n "$ip" ]]; then
echo "Using IP: $ip"
else
echo "No IP argument supplied"
exit 1
fi
set -x # echo on
set -e # exit on error
mssql="Server=$ip;Database=NorthWind;User Id=testuser;Password=testpass;"
mysql="Server=$ip;Database=NorthWind;User Id=testuser;Password=testpass;"
rm -rf ./test
mkdir ./test
cp ./publish/osx-x64/huc ./test
cd test
#clear
echo --- SQL MSSQL ---
./huc sql -c="$mssql" -s="SELECT TOP 100 * FROM Orders" Orders100.txt
./huc sql -c="$mssql" -s="SELECT * FROM Orders; SELECT * FROM Employees" Orders.txt Employees.txt
./huc sql -c="$mssql" -s="PRINT 'Hello'; PRINT 'World';"
printf "SELECT TOP 100 *\nFROM Orders" > mssqlscript.sql
./huc sql -c="$mssql" -f="mssqlscript.sql" OrdersFromScript.txt
./huc sql -c="$mssql" -s="if exists (select * from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'TempOrders' AND TABLE_SCHEMA = 'dbo') DROP TABLE NorthWind.dbo.TempOrders;"
echo --- SQLLOAD MSSQL ---
./huc sqlload -c="$mssql" -drop -rowNumberColumnName=RowNumber -currentUtcDateTimeColumnName=UploadTime -d=NorthWind -s=dbo -t=TempOrders -dct -cv Orders.txt
./huc sqlload -c="$mssql" -drop -rowNumberColumnName=RowNumber -currentUtcDateTimeColumnName=UploadTime -d=NorthWind -s=dbo -t=TempOrders Orders.txt
./huc sqlload -c="$mssql" -rowNumberColumnName=RowNumber -currentUtcDateTimeColumnName=UploadTime -d=NorthWind -s=dbo -t=TempOrders Orders.txt
./huc sqlload -c="$mssql" -d=NorthWind -s=dbo -t=TempOrders Orders.txt
./huc sql -c="$mssql" -s="SELECT * FROM TempOrders" TempOrders.txt
printf "BITS,0,1,t,F,true,FaLSe,y,N,yEs,no \n" > mssqldct.txt
printf "TINYINTS,0,1,255,0,0,0,0,0,0,0 \n" >> mssqldct.txt
printf "SMALLINTS,-32768,-1,0,1,32767,0,0,0,0,0 \n" >> mssqldct.txt
printf "INTS,-2147483648,-1,0,1,2147483647,0,0,0,0,0 \n" >> mssqldct.txt
./huc FileReplaceString "," "\\t" mssqldct.txt
./huc TableTranspose mssqldct.txt
./huc sqlload -c="$mssql" -drop -d=NorthWind -dct -cv mssqldct.txt
echo --- SQL MySQL ---
./huc sql -st=MySQL -c="$mysql" -s="SELECT * FROM products LIMIT 100;" Products100.txt
./huc sql -st=MySQL -c="$mysql" -s="SELECT * FROM products; SELECT * FROM invoices;" Products.txt Invoices.txt
#./huc sql -st=MySQL -c="$mysql" -s="PRINT 'Hello'; PRINT 'World';"
echo --- SQLLOAD MySQL ---
./huc sqlload -st=MySQL -c="$mysql" -drop -rowNumberColumnName=RowNumber -currentUtcDateTimeColumnName=UploadTime -d=NorthWind -t=TempProducts Products.txt
./huc sqlload -st=MySQL -c="$mysql" -rowNumberColumnName=RowNumber -currentUtcDateTimeColumnName=UploadTime -d=NorthWind -t=TempProducts Products.txt
./huc sqlload -st=MySQL -c="$mysql" -d=NorthWind -t=TempProducts Products.txt
./huc sql -st=MySQL -c="$mysql" -s="SELECT * FROM TempProducts;" TempProducts.txt
echo --- TABLE ---
cp Orders.txt Orders.csv
./huc table Orders.csv
cp Orders100.txt Orders100.csv
./huc table -hd=pipe -hq=none -he=true -dd=pipe -dq=none -he=false Orders100.csv
echo --- TABLEHTML ---
cp Orders.txt Orders.html
./huc tablehtml Orders.html
echo --- TABLEXML ---
cp Orders.txt Orders.xml
./huc tablexml Orders.xml
echo --- TABLEJSON ---
cp Orders.txt Orders.json
./huc tablejson Orders.json
echo --- DIRECTORYFLATTEN ---
mkdir subdir1
mkdir subdir2
cp Orders.txt ./subdir1
mv Orders.xml ./subdir2
mv Orders.json ./subdir2
./huc directoryFlatten -c=KeepNewest .
echo --- DIRECTORYSIZE ---
./huc DirectorySize .
echo --- FTP ---
./huc GenerateRandomFile -l=1000000 testdata1.txt testdata2.txt testdata3.txt
./huc ftpput -h=$ip -u=testuser -p=testpass testdata1.txt
./huc ftpput -h=$ip -u=testuser -p=testpass testdata2.txt testdata3.txt
./huc ftpdelete -h=$ip -u=testuser -p=testpass testdata1.txt
./huc ftpdelete -h=$ip -u=testuser -p=testpass testdata2.txt testdata3.txt
./huc ftpput -h=$ip -u=testuser -p=testpass "testdata?.txt"
./huc ftpdelete -h=$ip -u=testuser -p=testpass "testdata?.txt"
./huc ftpput -h=$ip -u=testuser -p=testpass testdata1.txt testdata2.txt testdata3.txt
rm -f testdata*.txt
./huc ftpget -h=$ip -u=testuser -p=testpass te*.txt
./huc ftpget -h=$ip -u=testuser -p=testpass testdata?.txt
echo --- FTP IMPLICIT ---
./huc GenerateRandomFile -l=1000000 testdata1.txt testdata2.txt testdata3.txt
./huc ftpput -e=Implicit -h=$ip -u=testuser -p=testpass testdata1.txt
./huc ftpput -e=Implicit -h=$ip -u=testuser -p=testpass testdata2.txt testdata3.txt
./huc ftpdelete -e=Implicit -h=$ip -u=testuser -p=testpass testdata1.txt
./huc ftpdelete -e=Implicit -h=$ip -u=testuser -p=testpass testdata2.txt testdata3.txt
./huc ftpput -e=Implicit -h=$ip -u=testuser -p=testpass "testdata?.txt"
./huc ftpdelete -e=Implicit -h=$ip -u=testuser -p=testpass "testdata?.txt"
./huc ftpput -h=$ip -u=testuser -p=testpass testdata1.txt testdata2.txt testdata3.txt
rm -f testdata*.txt
./huc ftpget -e=Implicit -h=$ip -u=testuser -p=testpass te*.txt
./huc ftpget -e=Implicit -h=$ip -u=testuser -p=testpass testdata?.txt
echo --- FTP EXPLICIT ---
./huc GenerateRandomFile -l=1000000 testdata1.txt testdata2.txt testdata3.txt
./huc ftpput -e=Explicit -h=$ip -u=testuser -p=testpass testdata1.txt
./huc ftpput -e=Explicit -h=$ip -u=testuser -p=testpass testdata2.txt testdata3.txt
./huc ftpdelete -e=Explicit -h=$ip -u=testuser -p=testpass testdata1.txt
./huc ftpdelete -e=Explicit -h=$ip -u=testuser -p=testpass testdata2.txt testdata3.txt
./huc ftpput -e=Explicit -h=$ip -u=testuser -p=testpass "testdata?.txt"
./huc ftpdelete -e=Explicit -h=$ip -u=testuser -p=testpass "testdata?.txt"
./huc ftpput -h=$ip -u=testuser -p=testpass testdata1.txt testdata2.txt testdata3.txt
rm -f testdata*.txt
./huc ftpget -e=Explicit -h=$ip -u=testuser -p=testpass te*.txt
./huc ftpget -e=Explicit -h=$ip -u=testuser -p=testpass testdata?.txt
echo --- FTP SSH ---
./huc GenerateRandomFile -l=1000000 testdata1.txt testdata2.txt testdata3.txt
./huc ftpput -e=SSH -h=$ip -u=testuser -p=testpass testdata1.txt
./huc ftpput -e=SSH -h=$ip -u=testuser -p=testpass testdata2.txt testdata3.txt
./huc ftpdelete -e=SSH -h=$ip -u=testuser -p=testpass testdata1.txt
./huc ftpdelete -e=SSH -h=$ip -u=testuser -p=testpass testdata2.txt testdata3.txt
./huc ftpput -e=SSH -h=$ip -u=testuser -p=testpass "testdata?.txt"
./huc ftpdelete -e=SSH -h=$ip -u=testuser -p=testpass "testdata?.txt"
./huc ftpput -h=$ip -u=testuser -p=testpass testdata1.txt
./huc ftpget -h=$ip -u=testuser -p=testpass testdata1.txt
./huc ftpput -h=$ip -u=testuser -p=testpass testdata1.txt testdata2.txt testdata3.txt
rm -f testdata*.txt
./huc ftpget -e=SSH -h=$ip -u=testuser -p=testpass te*.txt
./huc ftpget -e=SSH -h=$ip -u=testuser -p=testpass testdata?.txt
echo --- ZIP ---
./huc GenerateRandomFile -l=1000000 testdata1.txt testdata2.txt testdata3.txt
./huc zip testdata.zip "testdata?.txt"