Skip to content

Commit

Permalink
Patched /Users/codelion/Documents/GitHub/dvpwa/sqli/dao/student.py
Browse files Browse the repository at this point in the history
  • Loading branch information
patched.codes[bot] committed Aug 2, 2024
1 parent a37e908 commit 9f51eeb
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions sqli/dao/student.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ async def get_many(conn: Connection, limit: Optional[int] = None,
q = 'SELECT id, name FROM students'
params = {}
if limit is not None:
q += ' LIMIT + %(limit)s '
q += ' LIMIT %(limit)s'
params['limit'] = limit
if offset is not None:
q += ' OFFSET + %(offset)s '
q += ' OFFSET %(offset)s'
params['offset'] = offset
async with conn.cursor() as cur:
await cur.execute(q, params)
Expand All @@ -39,9 +39,6 @@ async def get_many(conn: Connection, limit: Optional[int] = None,

@staticmethod
async def create(conn: Connection, name: str):
q = ("INSERT INTO students (name) "
"VALUES ('%(name)s')" % {'name': name})
q = "INSERT INTO students (name) VALUES (%(name)s)"
async with conn.cursor() as cur:
await cur.execute(q)


await cur.execute(q, {'name': name})

0 comments on commit 9f51eeb

Please sign in to comment.