Skip to content

Commit

Permalink
- Fix regexer.
Browse files Browse the repository at this point in the history
- Fix columns fetchFromTable()
  • Loading branch information
christoph2 committed Dec 31, 2018
1 parent 554fd95 commit 2fc7f1c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pydbc/db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
DB_EXTENSION = "vndb"

def regexer(expr, value):
return re.search(expr, value, re.UNICODE) is not None
return re.match(expr, value, re.UNICODE) is not None

def calculateCacheSize(value):
return -(value // PAGE_SIZE)
Expand Down Expand Up @@ -183,7 +183,8 @@ def replaceStatement(self, cur, tname, columns, *values):
def fetchFromTable(self, cur, tname, columns = None, where = None, orderBy = None):
whereClause = "" if not where else "WHERE {}".format(where)
orderByClause = "ORDER BY rowid" if not orderBy else "ORDER BY {}".format(orderBy)
result = cur.execute("""SELECT * FROM {} {} {}""".format(tname, whereClause, orderByClause), [])
columnsClause = columns if columns else "*"
result = cur.execute("""SELECT {} FROM {} {} {}""".format(columnsClause, tname, whereClause, orderByClause), [])
while True:
row = cur.fetchone()
if row is None:
Expand Down

0 comments on commit 2fc7f1c

Please sign in to comment.