Mercurial > sqlpython
changeset 496:af846fd968cd
wildcards in find -c
author | Catherine Devlin <catherine.devlin@gmail.com> |
---|---|
date | Wed, 15 Sep 2010 17:28:25 -0400 |
parents | 490ede56f348 |
children | 128aa57c4b8d 2b3974b0a584 |
files | sqlpython/connections.py sqlpython/pgSession.txt |
diffstat | 2 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/sqlpython/connections.py Tue Sep 14 23:21:57 2010 -0400 +++ b/sqlpython/connections.py Wed Sep 15 17:28:25 2010 -0400 @@ -199,7 +199,7 @@ >>> (str(result.owner), str(result.type), str(result.name)) ('scott', 'table', '%') """ - identifier = identifier.replace('*', '%') + identifier = self.sql_format_wildcards(identifier) result = {'owner': '%', 'type': '%', 'name': '%'} result.update(dict(self.ls_parser.parseString(identifier))) return result @@ -208,7 +208,9 @@ operator = 'LIKE' else: operator = '=' - return operator + return operator + def sql_format_wildcards(self, target): + return target.replace('*', '%').replace('?', '_') def objects(self, target, opts): identifier = self.parse_identifier(target) clauses = [] @@ -229,6 +231,7 @@ curs.execute(qry, self.bindVariables(binds)) return curs def columns(self, target, opts): + target = self.sql_format_wildcards(target) if opts.all: owner = '%' else:
--- a/sqlpython/pgSession.txt Tue Sep 14 23:21:57 2010 -0400 +++ b/sqlpython/pgSession.txt Wed Sep 15 17:28:25 2010 -0400 @@ -9,6 +9,7 @@ SQL.No_Connection> set colors off /.*/ SQL.No_Connection> connect --postgres --password=testpassword testplatform testuser +0:testuser@testplatform> 0:testuser@testplatform> drop table play; /.*/