2023-02-03 23:10:12 +01:00
#!/usr/bin/env python
"""
2026-01-01 19:12:07 +01:00
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
2023-02-03 23:10:12 +01:00
See the file ' LICENSE ' for copying permission
"""
2023-02-04 00:00:21 +01:00
from lib . core . convert import getOrds
2023-02-03 23:10:12 +01:00
from plugins . generic . syntax import Syntax as GenericSyntax
class Syntax ( GenericSyntax ) :
@staticmethod
def escape ( expression , quote = True ) :
"""
2023-02-04 00:00:21 +01:00
>>> Syntax.escape( " SELECT ' abcdefgh ' FROM foobar " ) == " SELECT char(97)||char(98)||char(99)||char(100)||char(101)||char(102)||char(103)||char(104) FROM foobar "
2023-02-03 23:10:12 +01:00
True
"""
2023-02-04 00:00:21 +01:00
def escaper ( value ) :
return " || " . join ( " char( %d ) " % _ for _ in getOrds ( value ) )
return Syntax . _escape ( expression , quote , escaper )