Project

General

Profile

« Previous | Next » 

Revision 2061

sql.py: esc_name_by_module(): Changed preserve_case to ignore_case, which defaults to False

View differences:

lib/sql.py
226 226
    if re.search(r'\W', name) != None: raise NameException('Name "'+name
227 227
        +'" may contain only alphanumeric characters and _')
228 228

  
229
def esc_name_by_module(module, name, preserve_case=True):
229
def esc_name_by_module(module, name, ignore_case=False):
230 230
    if module == 'psycopg2':
231
        if preserve_case: quote = '"'
232
        # Don't enclose in quotes because this disables case-insensitivity
233
        else:
231
        if ignore_case:
232
            # Don't enclose in quotes because this disables case-insensitivity
234 233
            check_name(name)
235 234
            return name
235
        else: quote = '"'
236 236
    elif module == 'MySQLdb': quote = '`'
237 237
    else: raise NotImplementedError("Can't escape name for "+module+' database')
238 238
    return quote + name.replace(quote, '') + quote

Also available in: Unified diff