From 5363acf332619a5fc823ff126363a0b030373f35 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Wed, 17 Jun 2009 12:43:00 +0000 Subject: =?UTF-8?q?=E2=80=A2=20changed=20regex=20of=20trigger=20a=20reload?= =?UTF-8?q?=20of=20table/db=20according=20to=20executed=20queries=20-=20no?= =?UTF-8?q?w=20it=20also=20recognizes=20such=20keywords=20with=20leading?= =?UTF-8?q?=20comments=20-=20still=20further=20improvements=20are=20needed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/CustomQuery.m | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Source/CustomQuery.m') diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m index 26888225..495f6b20 100644 --- a/Source/CustomQuery.m +++ b/Source/CustomQuery.m @@ -473,10 +473,11 @@ [errors setString:[mySQLConnection getLastErrorMessage]]; } } else { - // Check if table list needs an update - if(!tableListNeedsReload && [[queries objectAtIndex:i] isMatchedByRegex:@"(?i)^\\s*(create|alter|drop|rename)\\s"]) + // Check if table/db list needs an update + // The regex is a compromise between speed and usefullness. TODO: further improvements are needed + if(!tableListNeedsReload && [[queries objectAtIndex:i] isMatchedByRegex:@"(?i)\\b(create|alter|drop|rename)\\b\\s+."]) tableListNeedsReload = YES; - if(!databaseWasChanged && [[queries objectAtIndex:i] isMatchedByRegex:@"(?i)^\\s*(use|drop\\s+database|drop\\s+schema)\\s"]) + if(!databaseWasChanged && [[queries objectAtIndex:i] isMatchedByRegex:@"(?i)\\b(use|drop\\s+database|drop\\s+schema)\\b\\s+."]) databaseWasChanged = YES; } } -- cgit v1.2.3