Script execution
This commit is contained in:
@@ -24,7 +24,7 @@ stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_REA
|
||||
results = stmt.executeQuery("SELECT Command,Result,Year,Month, Start FROM .");
|
||||
|
||||
#Command,Args,Source,Start,End,Background,Result,Return
|
||||
|
||||
"""
|
||||
if results.last():
|
||||
print("Command= " + results.getString("Command") + " Result= " + results.getString("Result"))
|
||||
if (results.first()):
|
||||
@@ -33,6 +33,7 @@ if results.last():
|
||||
results = stmt.executeQuery("SELECT Command,Result,Start FROM . WHERE Result = 'success'")
|
||||
while results.next():
|
||||
print("Command= " + results.getString("Command") + " Result= " + results.getString("Result"))
|
||||
"""
|
||||
|
||||
def _get_count(sql):
|
||||
ret = 0
|
||||
@@ -44,16 +45,23 @@ def _get_count(sql):
|
||||
def get_count(command, result):
|
||||
return _get_count("Command LIKE '"+ command +"' AND Result = '"+ result +"'")
|
||||
|
||||
command = "*test1.py"
|
||||
s = get_count(command, "success")
|
||||
a = get_count(command, "abort")
|
||||
e = get_count(command, "error")
|
||||
t=s+a+e
|
||||
print s, a, e
|
||||
print "Success: ", ("%1.2f%% of %d" % ((float(s)/t) * 100, t))
|
||||
print "Error: ", ("%1.2f%% of %d" % ((float(e)/t) * 100, t))
|
||||
print "Abort: ", ("%1.2f%% of %d" % ((float(a)/t) * 100, t))
|
||||
|
||||
def print_stats(command):
|
||||
print "Statistics for: " + command
|
||||
s = get_count(command, "success")
|
||||
a = get_count(command, "abort")
|
||||
e = get_count(command, "error")
|
||||
t=s+a+e
|
||||
if t==0:
|
||||
print "No records"
|
||||
else:
|
||||
print "Success: ", ("%1.2f%% of %d" % ((float(s)/t) * 100, t))
|
||||
print "Error: ", ("%1.2f%% of %d" % ((float(e)/t) * 100, t))
|
||||
print "Abort: ", ("%1.2f%% of %d" % ((float(a)/t) * 100, t))
|
||||
|
||||
print_stats ("%test1.py")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user