Project

General

Profile

« Previous | Next » 

Revision 2568

sql_gen.py: Added is_safe_name()

View differences:

sql_gen.py
1 1
# SQL code generation
2 2

  
3 3
import operator
4
import re
4 5

  
5 6
import objects
6 7
import strings
......
8 9

  
9 10
##### Escaping
10 11

  
12
def is_safe_name(name): return re.match(r'^\w+$', name)
13

  
11 14
def esc_name(name, quote='"'):
12 15
    return quote + name.replace(quote, quote+quote) + quote
13 16
        # doubling an embedded quote escapes it in both PostgreSQL and MySQL

Also available in: Unified diff