about summary refs log tree commit diff
path: root/fuzz.lua
blob: cbc4b43898a8fb761224b89c9b88c7b659c5f67d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
print("CREATE TABLE stuff (x string, y string, z srting);")

local chars = { "\"", "0", ",", "\t", "\n", "\\" }

local function literal ()
	local out = {"'"}
	for i = 1, math.random(1, 40) do
		table.insert(out, chars[math.random(#chars)])
	end

	table.insert(out, "'")

	return table.concat(out)
end

for i = 1, tonumber(arg[1]) do
	print(string.format("INSERT INTO stuff(x, y, z) VALUES (%s, %s, %s);",
		literal(), literal(), literal()))
end

print(".mode csv")
print("SELECT * from stuff;")