equal
deleted
inserted
replaced
144 |
144 |
145 def fetchall_dict(self, lstrip=None): |
145 def fetchall_dict(self, lstrip=None): |
146 '''Return all rows as OrderedDict''' |
146 '''Return all rows as OrderedDict''' |
147 rows = super(Cursor, self).fetchall() |
147 rows = super(Cursor, self).fetchall() |
148 return [self.row_dict(row, lstrip) for row in rows] |
148 return [self.row_dict(row, lstrip) for row in rows] |
|
149 |
|
150 def adapt(self, row): |
|
151 if isinstance(row, RowDict): |
|
152 # dict |
|
153 adapted = RowDict() |
|
154 for key in row.keys(): |
|
155 adapted[key] = self.mogrify('%s', [row[key]]).decode('utf8') |
|
156 else: |
|
157 # list |
|
158 adapted = [self.mogrify('%s', [x]).decode('utf8') for x in row] |
|
159 return adapted |
149 |
160 |
150 def fetchone_adapted(self, lstrip=None): |
161 def fetchone_adapted(self, lstrip=None): |
151 '''Like fetchone_dict() but values are quoted for direct inclusion in SQL query. |
162 '''Like fetchone_dict() but values are quoted for direct inclusion in SQL query. |
152 |
163 |
153 This is useful when you need to generate SQL script from data returned |
164 This is useful when you need to generate SQL script from data returned |