Skip to content

Commit 67fdcc8

Browse files
committed
Added Field List as Possible Query
1 parent 512dee5 commit 67fdcc8

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

monitor.py

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ class TYPE(IntEnum):
135135
Statistics = 5
136136
Continued = 6
137137
InitDB = 7
138+
FieldList = 8
138139

139140
# The cPanel users associated with databases
140141
# Used to represent values in COL.User
@@ -185,10 +186,14 @@ def getType(string):
185186
elif string == "Statistics":
186187
return TYPE.Statistics.value
187188

188-
elif string == "InitDB":
189+
elif string == "Init DB":
189190
return TYPE.InitDB.value
190191

192+
elif string == "Field List":
193+
return TYPE.FieldList.value
194+
191195
else:
196+
print(string)
192197
print("Unknown type for line")
193198
lock.exit()
194199

@@ -316,7 +321,9 @@ def main():
316321
is_type = re.compile("^Query|^Connect|^Quit")
317322
statistics = re.compile("^Statistics")
318323
init = re.compile("^Init")
319-
db = re.compile("DB")
324+
db = re.compile("^DB")
325+
field = re.compile("^Field")
326+
list = re.compile("^List")
320327

321328
# Information from sql log now stored in array
322329
# Begin processing array information
@@ -378,13 +385,32 @@ def main():
378385

379386
if init.match(split[1]):
380387
# Insert the type to the array
381-
sqllog[x].insert(COL.Type.value, getType(split[1] + split[2]))
388+
sqllog[x].insert(COL.Type.value, getType(split[1] + " " + split[2]))
389+
# Insert the Query Number into the array
390+
sqllog[x].insert(COL.QueryNo.value, split[0])
391+
392+
else:
393+
# Insert the type to the array
394+
sqllog[x].insert(COL.Type.value, getType(split[3]) + " " + split[4])
395+
# Insert the Query Number into the array
396+
sqllog[x].insert(COL.QueryNo.value, split[2])
397+
398+
# Insert the index of this query to the array
399+
sqllog[x].insert(COL.StartIndex.value, x)
400+
401+
# Field List Command
402+
# Check to see if this is a 'Field List' command if it is none of the above
403+
elif (is_number.match(split[0]) and field.match(split[1]) and list.match(split[2])) or (is_number.match(split[0]) and is_time.match(split[1]) and is_number.match(split[2]) and field.match(split[3]) and list.match(split[4])):
404+
405+
if field.match(split[1]):
406+
# Insert the type to the array
407+
sqllog[x].insert(COL.Type.value, getType(split[1] + " " + split[2]))
382408
# Insert the Query Number into the array
383409
sqllog[x].insert(COL.QueryNo.value, split[0])
384410

385411
else:
386412
# Insert the type to the array
387-
sqllog[x].insert(COL.Type.value, getType(split[3]) + split[4])
413+
sqllog[x].insert(COL.Type.value, getType(split[3]) + " " + split[4])
388414
# Insert the Query Number into the array
389415
sqllog[x].insert(COL.QueryNo.value, split[2])
390416

0 commit comments

Comments
 (0)