From ce19b0c431a9546e75e703a28372ceafae7db33e Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Fri, 31 Dec 2010 12:21:02 +0000 Subject: [PATCH] optimization of comment checking in MySQL --- plugins/dbms/mysql/fingerprint.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/plugins/dbms/mysql/fingerprint.py b/plugins/dbms/mysql/fingerprint.py index f1ae9c2cd..667513b28 100644 --- a/plugins/dbms/mysql/fingerprint.py +++ b/plugins/dbms/mysql/fingerprint.py @@ -60,10 +60,22 @@ class Fingerprint(GenericFingerprint): (60000, 60011), # MySQL 6.0 ) - for element in versions: + index = None + for i in xrange(len(versions)): + element = versions[i] + version = element[0] + randInt = randomInt() + version = getUnicode(version) + result = inject.checkBooleanExpression("%d=%d/*!%s AND %d=%d*/" % (randInt, randInt, version, randInt, randInt + 1)) + + if result: + index = i - 1 + break + + if index and index >= 0: prevVer = None - for version in range(element[0], element[1] + 1): + for version in range(versions[index][0], versions[index][1] + 1): randInt = randomInt() version = getUnicode(version) result = inject.checkBooleanExpression("%d=%d/*!%s AND %d=%d*/" % (randInt, randInt, version, randInt, randInt + 1))