Lines Matching refs:row
32 def dict_factory(cursor, row): argument
35 d[col[0]] = row[idx]
83 row = cur.fetchone()
84 self.assertIsInstance(row, dict)
95 self.con.row_factory = lambda cur, row: list(row)
96 row = self.con.execute("select 1, 2").fetchone()
97 self.assertIsInstance(row, list)
101 row = self.con.execute("select 1 as a_1, 2 as b").fetchone()
102 self.assertIsInstance(row, sqlite.Row)
104 self.assertEqual(row["a_1"], 1, "by name: wrong result for column 'a_1'")
105 self.assertEqual(row["b"], 2, "by name: wrong result for column 'b'")
107 self.assertEqual(row["A_1"], 1, "by name: wrong result for column 'A_1'")
108 self.assertEqual(row["B"], 2, "by name: wrong result for column 'B'")
110 self.assertEqual(row[0], 1, "by index: wrong result for column 0")
111 self.assertEqual(row[1], 2, "by index: wrong result for column 1")
112 self.assertEqual(row[-1], 2, "by index: wrong result for column -1")
113 self.assertEqual(row[-2], 1, "by index: wrong result for column -2")
116 row['c']
118 row['a_\x11']
120 row['a\x7f1']
122 row[2]
124 row[-3]
126 row[2**1000]
130 row = self.con.execute("select 1 as \xff").fetchone()
131 self.assertEqual(row["\xff"], 1)
133 row['\u0178']
135 row['\xdf']
140 row = self.con.execute("select 1, 2, 3, 4").fetchone()
141 self.assertEqual(row[0:0], ())
142 self.assertEqual(row[0:1], (1,))
143 self.assertEqual(row[1:3], (2, 3))
144 self.assertEqual(row[3:1], ())
146 self.assertEqual(row[1:], (2, 3, 4))
147 self.assertEqual(row[:3], (1, 2, 3))
149 self.assertEqual(row[-2:-1], (3,))
150 self.assertEqual(row[-2:], (3, 4))
152 self.assertEqual(row[0:4:2], (1, 3))
153 self.assertEqual(row[3:0:-2], (4, 2))
158 row = self.con.execute("select 1 as a, 2 as b").fetchone()
159 for col in row:
165 row = self.con.execute("select 1 as a, 2 as b").fetchone()
166 t = tuple(row)
167 self.assertEqual(t, (row['a'], row['b']))
172 row = self.con.execute("select 1 as a, 2 as b").fetchone()
173 d = dict(row)
174 self.assertEqual(d["a"], row["a"])
175 self.assertEqual(d["b"], row["b"])
214 row = self.con.execute("select 1 as a, 2 as b").fetchone()
216 as_tuple = tuple(row)
217 self.assertEqual(list(reversed(row)), list(reversed(as_tuple)))
218 self.assertIsInstance(row, Sequence)
239 row = self.con.execute("select ?", (austria,)).fetchone()
240 self.assertEqual(type(row[0]), str, "type of row[0] must be unicode")
245 row = self.con.execute("select ?", (austria,)).fetchone()
246 self.assertEqual(type(row[0]), bytes, "type of row[0] must be bytes")
247 … self.assertEqual(row[0], austria.encode("utf-8"), "column must equal original data in UTF-8")
252 row = self.con.execute("select ?", (austria,)).fetchone()
253 self.assertEqual(type(row[0]), str, "type of row[0] must be unicode")
254 self.assertTrue(row[0].endswith("reich"), "column must contain original data")
278 row = self.con.execute("select value from test").fetchone()
279 self.assertIs(type(row[0]), str)
280 self.assertEqual(row[0], "a\x00b")
284 row = self.con.execute("select value from test").fetchone()
285 self.assertIs(type(row[0]), bytes)
286 self.assertEqual(row[0], b"a\x00b")
290 row = self.con.execute("select value from test").fetchone()
291 self.assertIs(type(row[0]), bytearray)
292 self.assertEqual(row[0], b"a\x00b")
297 row = self.con.execute("select value from test").fetchone()
298 self.assertIs(type(row[0]), bytes)
299 self.assertEqual(row[0], b"a\x00b")