Rev | Line | |
---|
[976] | 1 | #
|
---|
| 2 | # Generic SQL Dialect
|
---|
| 3 | #
|
---|
| 4 | class Dialect(object):
|
---|
| 5 |
|
---|
| 6 | def __init__(self):
|
---|
| 7 |
|
---|
| 8 | self.datatypes = {}
|
---|
| 9 |
|
---|
| 10 | #
|
---|
| 11 | # Big Integer values
|
---|
| 12 | #
|
---|
| 13 | self.bigint = 'INTEGER'
|
---|
| 14 |
|
---|
| 15 | #
|
---|
| 16 | # Small Integer values
|
---|
| 17 | #
|
---|
| 18 | self.smallint = 'INTEGER'
|
---|
| 19 |
|
---|
| 20 | #
|
---|
| 21 | # Maximum VARCHAR length
|
---|
| 22 | #
|
---|
| 23 | self.maxvarchar = 'VARCHAR(255)'
|
---|
| 24 |
|
---|
| 25 | #
|
---|
| 26 | # Statement Terminator
|
---|
| 27 | #
|
---|
| 28 | self.go = 'GO'
|
---|
| 29 |
|
---|
| 30 | #
|
---|
| 31 | # Timestamp Data Type
|
---|
| 32 | #
|
---|
| 33 | self.timestamp = 'DATETIME'
|
---|
| 34 |
|
---|
| 35 | #
|
---|
| 36 | # name is left padded to length n
|
---|
| 37 | #
|
---|
| 38 | def lpad(self, name, n):
|
---|
| 39 |
|
---|
| 40 | fmt = '%%%ss' % (n)
|
---|
| 41 |
|
---|
| 42 | return fmt % (getattr(self, name))
|
---|
| 43 |
|
---|
| 44 | #
|
---|
| 45 | # name is right padded to length n
|
---|
| 46 | #
|
---|
| 47 | def rpad(self, name, n):
|
---|
| 48 |
|
---|
| 49 | fmt = '%%-%ss' % (n)
|
---|
| 50 |
|
---|
| 51 | return fmt % (getattr(self, name))
|
---|
| 52 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.