ObjSQLite3  Check-in [74061183c3]

Overview
Comment:Adjust to ObjFW changes
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 74061183c3d3a89e28df2eb665b75ff11df6acd629ffce6f0f11ecd52915651d
User & Date: js on 2021-04-28 22:54:37
Other Links: manifest | tags
Context
2023-04-17
18:17
configure: Update for autoconf 2.71 check-in: 7237f5df86 user: js tags: trunk
2021-04-28
22:54
Adjust to ObjFW changes check-in: 74061183c3 user: js tags: trunk
2020-10-09
22:10
Make row{Array,Dictionary} a property check-in: 643e6c6da7 user: js tags: trunk
Changes

Modified src/SL3PreparedStatement.m from [94b4feb125] to [68afbf8877].

191
192
193
194
195
196
197
198

199
200
201
202
203
204
205
191
192
193
194
195
196
197

198
199
200
201
202
203
204
205







-
+







	case SQLITE_BLOB:
		return [OFData
		    dataWithItems: sqlite3_column_blob(_stmt, column)
			    count: sqlite3_column_bytes(_stmt, column)];
	case SQLITE_NULL:
		return [OFNull null];
	default:
		OF_ENSURE(0);
		OFEnsure(0);
	}
}

- (size_t)columnCount
{
	return sqlite3_column_count(_stmt);
}

Modified tests/Tests.m from [7e8b70e4f0] to [fc0d081528].

66
67
68
69
70
71
72
73
74
75
76




77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92

93
94
95
96
97



98
99

100
101

102
103
104
105
106
107
108
66
67
68
69
70
71
72




73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91

92
93
94



95
96
97
98

99
100

101
102
103
104
105
106
107
108







-
-
-
-
+
+
+
+















-
+


-
-
-
+
+
+

-
+

-
+








	stmt = [conn prepareStatement: @"SELECT * FROM test"];
	for (size_t i = 0; [stmt step]; i++) {
		OFNumber *a;
		OFString *b;
		OFData *c;

		OF_ENSURE([stmt columnCount] == 3);
		OF_ENSURE([[stmt nameForColumn: 0] isEqual: @"a"]);
		OF_ENSURE([[stmt nameForColumn: 1] isEqual: @"b"]);
		OF_ENSURE([[stmt nameForColumn: 2] isEqual: @"c"]);
		OFEnsure([stmt columnCount] == 3);
		OFEnsure([[stmt nameForColumn: 0] isEqual: @"a"]);
		OFEnsure([[stmt nameForColumn: 1] isEqual: @"b"]);
		OFEnsure([[stmt nameForColumn: 2] isEqual: @"c"]);

		switch (i) {
		case 0:
			a = [OFNumber numberWithInt: 5];
			b = @"String";
			c = [OFData dataWithItems: "abc"
					    count: 3];
			break;
		case 1:
			a = [OFNumber numberWithInt: 7];
			b = @"Test";
			c = [OFData dataWithItems: "xyz"
					    count: 3];
			break;
		default:
			OF_ENSURE(0);
			OFEnsure(0);
		}

		OF_ENSURE([[stmt objectForColumn: 0] isEqual: a]);
		OF_ENSURE([[stmt objectForColumn: 1] isEqual: b]);
		OF_ENSURE([[stmt objectForColumn: 2] isEqual: c]);
		OFEnsure([[stmt objectForColumn: 0] isEqual: a]);
		OFEnsure([[stmt objectForColumn: 1] isEqual: b]);
		OFEnsure([[stmt objectForColumn: 2] isEqual: c]);

		OF_ENSURE([[stmt rowArray] isEqual: ([OFArray arrayWithObjects:
		OFEnsure([[stmt rowArray] isEqual: ([OFArray arrayWithObjects:
		    a, b, c, nil])]);
		OF_ENSURE([[stmt rowDictionary] isEqual:
		OFEnsure([[stmt rowDictionary] isEqual:
		    ([OFDictionary dictionaryWithKeysAndObjects:
		    @"a", a, @"b", b, @"c", c, nil])]);
	}

	[OFApplication terminate];
}
@end