37 void Check(TInt aValue, TInt aLine) |
37 void Check(TInt aValue, TInt aLine) |
38 { |
38 { |
39 if(!aValue) |
39 if(!aValue) |
40 { |
40 { |
41 DeleteTestFiles(); |
41 DeleteTestFiles(); |
|
42 TheTest.Printf(_L("*** Expression evaluated to false\r\n")); |
42 TheTest(EFalse, aLine); |
43 TheTest(EFalse, aLine); |
43 } |
44 } |
44 } |
45 } |
45 void Check(TInt aValue, TInt aExpected, TInt aLine) |
46 void Check(TInt aValue, TInt aExpected, TInt aLine) |
46 { |
47 { |
47 if(aValue != aExpected) |
48 if(aValue != aExpected) |
48 { |
49 { |
49 DeleteTestFiles(); |
50 DeleteTestFiles(); |
50 RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue); |
51 TheTest.Printf(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue); |
51 TheTest(EFalse, aLine); |
52 TheTest(EFalse, aLine); |
52 } |
53 } |
53 } |
54 } |
54 #define TEST(arg) ::Check((arg), __LINE__) |
55 #define TEST(arg) ::Check((arg), __LINE__) |
55 #define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__) |
56 #define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__) |
101 RSqlDatabase db; |
102 RSqlDatabase db; |
102 TInt err = db.Create(KTestDbName1); |
103 TInt err = db.Create(KTestDbName1); |
103 TEST2(err, KErrNone); |
104 TEST2(err, KErrNone); |
104 |
105 |
105 //Create test database |
106 //Create test database |
106 RDebug::Print(_L("###Create test database\r\n")); |
107 TheTest.Printf(_L("###Create test database\r\n")); |
107 _LIT(KCreateSql, "CREATE TABLE A(Name VARCHAR(100) COLLATE CompareF); CREATE INDEX AIdx ON A(Name COLLATE CompareF);"); |
108 _LIT(KCreateSql, "CREATE TABLE A(Name VARCHAR(100) COLLATE CompareF); CREATE INDEX AIdx ON A(Name COLLATE CompareF);"); |
108 err = db.Exec(KCreateSql); |
109 err = db.Exec(KCreateSql); |
109 TEST(err >= 0); |
110 TEST(err >= 0); |
110 |
111 |
111 //Insert some records. The column "Name" of each record contains the same name but the name characters are |
112 //Insert some records. The column "Name" of each record contains the same name but the name characters are |
112 //variation of upper/lower case letters. |
113 //variation of upper/lower case letters. |
113 RDebug::Print(_L("###Insert some records\r\n")); |
114 TheTest.Printf(_L("###Insert some records\r\n")); |
114 _LIT(KInsertSql, "INSERT INTO A(Name) VALUES("); |
115 _LIT(KInsertSql, "INSERT INTO A(Name) VALUES("); |
115 //Collation sort order: KNames[1] KNames[3] KNames[0] KNames[2] |
116 //Collation sort order: KNames[1] KNames[3] KNames[0] KNames[2] |
116 //Long "aaaa..." added to the end of each column value because SQLITE may use non-aligned strings |
117 //Long "aaaa..." added to the end of each column value because SQLITE may use non-aligned strings |
117 //only when the string length is in [32..<cache_page_size>] interval. |
118 //only when the string length is in [32..<cache_page_size>] interval. |
118 TPtrC KNames[] = { |
119 TPtrC KNames[] = { |
136 err = db.Exec(sql); |
137 err = db.Exec(sql); |
137 TEST2(err, 1); |
138 TEST2(err, 1); |
138 } |
139 } |
139 |
140 |
140 //The next "SELECT" statement must return a set containing all table records |
141 //The next "SELECT" statement must return a set containing all table records |
141 RDebug::Print(_L("###Select all records\r\n")); |
142 TheTest.Printf(_L("###Select all records\r\n")); |
142 _LIT(KSelectSql1, "SELECT * FROM A WHERE NAME = 'alex-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'"); |
143 _LIT(KSelectSql1, "SELECT * FROM A WHERE NAME = 'alex-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'"); |
143 RSqlStatement stmt; |
144 RSqlStatement stmt; |
144 err = stmt.Prepare(db, KSelectSql1); |
145 err = stmt.Prepare(db, KSelectSql1); |
145 TEST2(err, KErrNone); |
146 TEST2(err, KErrNone); |
146 TInt recCount = 0; |
147 TInt recCount = 0; |
147 while(stmt.Next() == KSqlAtRow) |
148 while(stmt.Next() == KSqlAtRow) |
148 { |
149 { |
149 ++recCount; |
150 ++recCount; |
150 TPtrC name = stmt.ColumnTextL(0); |
151 TPtrC name = stmt.ColumnTextL(0); |
151 RDebug::Print(_L("%S\r\n"), &name); |
152 TheTest.Printf(_L("%S\r\n"), &name); |
152 } |
153 } |
153 stmt.Close(); |
154 stmt.Close(); |
154 TEST(recCount == KInsertSqlStmtCnt); |
155 TEST(recCount == KInsertSqlStmtCnt); |
155 |
156 |
156 //The next "SELECT" statement must return a set containing all table records |
157 //The next "SELECT" statement must return a set containing all table records |
157 // this tests a LIKE clause with a bound parameter (with wildcards) |
158 // this tests a LIKE clause with a bound parameter (with wildcards) |
158 RDebug::Print(_L("###Select all records (LIKE with wildcard)\r\n")); |
159 TheTest.Printf(_L("###Select all records (LIKE with wildcard)\r\n")); |
159 _LIT(KSelectSql1a, "SELECT * FROM A WHERE NAME LIKE :Val"); |
160 _LIT(KSelectSql1a, "SELECT * FROM A WHERE NAME LIKE :Val"); |
160 _LIT(KSearchString,"alex-aaaa%"); |
161 _LIT(KSearchString,"alex-aaaa%"); |
161 err = stmt.Prepare(db, KSelectSql1a); |
162 err = stmt.Prepare(db, KSelectSql1a); |
162 TEST2(err, KErrNone); |
163 TEST2(err, KErrNone); |
163 TInt idx=stmt.ParameterIndex(_L(":Val")); |
164 TInt idx=stmt.ParameterIndex(_L(":Val")); |
166 recCount = 0; |
167 recCount = 0; |
167 while(stmt.Next() == KSqlAtRow) |
168 while(stmt.Next() == KSqlAtRow) |
168 { |
169 { |
169 ++recCount; |
170 ++recCount; |
170 TPtrC name = stmt.ColumnTextL(0); |
171 TPtrC name = stmt.ColumnTextL(0); |
171 RDebug::Print(_L("%S\r\n"), &name); |
172 TheTest.Printf(_L("%S\r\n"), &name); |
172 } |
173 } |
173 stmt.Close(); |
174 stmt.Close(); |
174 TEST(recCount == KInsertSqlStmtCnt); |
175 TEST(recCount == KInsertSqlStmtCnt); |
175 |
176 |
176 //The next "SELECT" statement must return a set containing all table records |
177 //The next "SELECT" statement must return a set containing all table records |
177 // this tests a LIKE clause with a bound parameter (with no wildcards) |
178 // this tests a LIKE clause with a bound parameter (with no wildcards) |
178 RDebug::Print(_L("###Select all records (LIKE with no wildcard)\r\n")); |
179 TheTest.Printf(_L("###Select all records (LIKE with no wildcard)\r\n")); |
179 _LIT(KSelectSql1b, "SELECT * FROM A WHERE NAME LIKE :Val"); |
180 _LIT(KSelectSql1b, "SELECT * FROM A WHERE NAME LIKE :Val"); |
180 _LIT(KSearchStringA, |
181 _LIT(KSearchStringA, |
181 "alex-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); |
182 "alex-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); |
182 err = stmt.Prepare(db, KSelectSql1b); |
183 err = stmt.Prepare(db, KSelectSql1b); |
183 idx=stmt.ParameterIndex(_L(":Val")); |
184 idx=stmt.ParameterIndex(_L(":Val")); |
186 recCount = 0; |
187 recCount = 0; |
187 while(stmt.Next() == KSqlAtRow) |
188 while(stmt.Next() == KSqlAtRow) |
188 { |
189 { |
189 ++recCount; |
190 ++recCount; |
190 TPtrC name = stmt.ColumnTextL(0); |
191 TPtrC name = stmt.ColumnTextL(0); |
191 RDebug::Print(_L("%S\r\n"), &name); |
192 TheTest.Printf(_L("%S\r\n"), &name); |
192 } |
193 } |
193 stmt.Close(); |
194 stmt.Close(); |
194 TEST(recCount == KInsertSqlStmtCnt); |
195 TEST(recCount == KInsertSqlStmtCnt); |
195 |
196 |
196 //The next "SELECT" statement must return a row |
197 //The next "SELECT" statement must return a row |
197 // this tests a LIKE clause with a bound parameter and funny characters |
198 // this tests a LIKE clause with a bound parameter and funny characters |
198 RDebug::Print(_L("###Select one records (LIKE with bound param with URL chars)\r\n")); |
199 TheTest.Printf(_L("###Select one records (LIKE with bound param with URL chars)\r\n")); |
199 err=db.Exec(_L("INSERT INTO A(Name) VALUES('http://a.b.c#d')")); |
200 err=db.Exec(_L("INSERT INTO A(Name) VALUES('http://a.b.c#d')")); |
200 TEST2(err,1); |
201 TEST2(err,1); |
201 _LIT(KSelectSql1c, "SELECT * FROM A WHERE NAME LIKE :Val"); |
202 _LIT(KSelectSql1c, "SELECT * FROM A WHERE NAME LIKE :Val"); |
202 _LIT(KSearchStringB,"http%"); |
203 _LIT(KSearchStringB,"http%"); |
203 err = stmt.Prepare(db, KSelectSql1c); |
204 err = stmt.Prepare(db, KSelectSql1c); |
207 recCount = 0; |
208 recCount = 0; |
208 while(stmt.Next() == KSqlAtRow) |
209 while(stmt.Next() == KSqlAtRow) |
209 { |
210 { |
210 ++recCount; |
211 ++recCount; |
211 TPtrC name = stmt.ColumnTextL(0); |
212 TPtrC name = stmt.ColumnTextL(0); |
212 RDebug::Print(_L("%S\r\n"), &name); |
213 TheTest.Printf(_L("%S\r\n"), &name); |
213 } |
214 } |
214 stmt.Close(); |
215 stmt.Close(); |
215 TEST(recCount == 1); |
216 TEST(recCount == 1); |
216 |
217 |
217 |
218 |
218 //The next "SELECT" statement must return a set containing all table records, folded comparison used for sorting |
219 //The next "SELECT" statement must return a set containing all table records, folded comparison used for sorting |
219 RDebug::Print(_L("###Select all records, folded string comparison\r\n")); |
220 TheTest.Printf(_L("###Select all records, folded string comparison\r\n")); |
220 _LIT(KSelectSql2, "SELECT * FROM A WHERE NAME = 'alex-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' ORDER BY NAME COLLATE CompareF"); |
221 _LIT(KSelectSql2, "SELECT * FROM A WHERE NAME = 'alex-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' ORDER BY NAME COLLATE CompareF"); |
221 err = stmt.Prepare(db, KSelectSql2); |
222 err = stmt.Prepare(db, KSelectSql2); |
222 TEST2(err, KErrNone); |
223 TEST2(err, KErrNone); |
223 |
224 |
224 recCount = 0; |
225 recCount = 0; |
226 { |
227 { |
227 err = stmt.Next(); |
228 err = stmt.Next(); |
228 TEST2(err, KSqlAtRow); |
229 TEST2(err, KSqlAtRow); |
229 ++recCount; |
230 ++recCount; |
230 TPtrC name = stmt.ColumnTextL(0); |
231 TPtrC name = stmt.ColumnTextL(0); |
231 RDebug::Print(_L("%S\r\n"), &name); |
232 TheTest.Printf(_L("%S\r\n"), &name); |
232 TEST(name == KNames[j]); |
233 TEST(name == KNames[j]); |
233 } |
234 } |
234 stmt.Close(); |
235 stmt.Close(); |
235 TEST(recCount == KInsertSqlStmtCnt); |
236 TEST(recCount == KInsertSqlStmtCnt); |
236 |
237 |
237 //The next "SELECT" statement must return a set containing all table records, collated comparison used for sorting |
238 //The next "SELECT" statement must return a set containing all table records, collated comparison used for sorting |
238 RDebug::Print(_L("###Select all records, collated string comparison\r\n")); |
239 TheTest.Printf(_L("###Select all records, collated string comparison\r\n")); |
239 _LIT(KSelectSql3, "SELECT * FROM A ORDER BY NAME COLLATE CompareC3"); |
240 _LIT(KSelectSql3, "SELECT * FROM A ORDER BY NAME COLLATE CompareC3"); |
240 err = stmt.Prepare(db, KSelectSql3); |
241 err = stmt.Prepare(db, KSelectSql3); |
241 TEST2(err, KErrNone); |
242 TEST2(err, KErrNone); |
242 |
243 |
243 for(TInt k=0;k<KInsertSqlStmtCnt;++k) |
244 for(TInt k=0;k<KInsertSqlStmtCnt;++k) |
244 { |
245 { |
245 err = stmt.Next(); |
246 err = stmt.Next(); |
246 TEST2(err, KSqlAtRow); |
247 TEST2(err, KSqlAtRow); |
247 TPtrC name = stmt.ColumnTextL(0); |
248 TPtrC name = stmt.ColumnTextL(0); |
248 RDebug::Print(_L("%S\r\n"), &name); |
249 TheTest.Printf(_L("%S\r\n"), &name); |
249 TEST(name == sortedNames[k]); |
250 TEST(name == sortedNames[k]); |
250 } |
251 } |
251 |
252 |
252 stmt.Close(); |
253 stmt.Close(); |
253 |
254 |
258 //To debug database reindexing |
259 //To debug database reindexing |
259 err = db.Open(KTestDbName1); |
260 err = db.Open(KTestDbName1); |
260 TEST2(err, KErrNone); |
261 TEST2(err, KErrNone); |
261 db.Close(); |
262 db.Close(); |
262 |
263 |
263 RDebug::Print(_L("###Delete test database\r\n")); |
264 TheTest.Printf(_L("###Delete test database\r\n")); |
264 (void)RSqlDatabase::Delete(KTestDbName1); |
265 (void)RSqlDatabase::Delete(KTestDbName1); |
265 } |
266 } |
266 |
267 |
267 /** |
268 /** |
268 @SYMTestCaseID SYSLIB-SQL-CT-1610 |
269 @SYMTestCaseID SYSLIB-SQL-CT-1610 |
279 RSqlDatabase db; |
280 RSqlDatabase db; |
280 TInt err = db.Create(KTestDbName1); |
281 TInt err = db.Create(KTestDbName1); |
281 TEST2(err, KErrNone); |
282 TEST2(err, KErrNone); |
282 |
283 |
283 //Create test database |
284 //Create test database |
284 RDebug::Print(_L("###Create test database\r\n")); |
285 TheTest.Printf(_L("###Create test database\r\n")); |
285 _LIT(KCreateSql, "CREATE TABLE A(Name VARCHAR(100) COLLATE CompareC3)"); |
286 _LIT(KCreateSql, "CREATE TABLE A(Name VARCHAR(100) COLLATE CompareC3)"); |
286 err = db.Exec(KCreateSql); |
287 err = db.Exec(KCreateSql); |
287 TEST(err >= 0); |
288 TEST(err >= 0); |
288 |
289 |
289 //Insert some records. |
290 //Insert some records. |
290 RDebug::Print(_L("###Insert some records\r\n")); |
291 TheTest.Printf(_L("###Insert some records\r\n")); |
291 _LIT(KInsertSql, "INSERT INTO A(Name) VALUES("); |
292 _LIT(KInsertSql, "INSERT INTO A(Name) VALUES("); |
292 TPtrC KNames[] = { |
293 TPtrC KNames[] = { |
293 _L("aAaA"), |
294 _L("aAaA"), |
294 _L("AAaa"), |
295 _L("AAaa"), |
295 _L("aaAA"), |
296 _L("aaAA"), |
308 |
309 |
309 RSqlStatement stmt; |
310 RSqlStatement stmt; |
310 |
311 |
311 //The next "SELECT" statement must return a set containing all table |
312 //The next "SELECT" statement must return a set containing all table |
312 //records which Name column value is bigger than "aaAA" |
313 //records which Name column value is bigger than "aaAA" |
313 RDebug::Print(_L("###Select all records, which Name column value is bigger than 'aaAA'\r\n")); |
314 TheTest.Printf(_L("###Select all records, which Name column value is bigger than 'aaAA'\r\n")); |
314 _LIT(KSelectSql2, "SELECT * FROM A WHERE NAME > 'aaAA'"); |
315 _LIT(KSelectSql2, "SELECT * FROM A WHERE NAME > 'aaAA'"); |
315 err = stmt.Prepare(db, KSelectSql2); |
316 err = stmt.Prepare(db, KSelectSql2); |
316 TEST2(err, KErrNone); |
317 TEST2(err, KErrNone); |
317 |
318 |
318 while((err = stmt.Next()) == KSqlAtRow) |
319 while((err = stmt.Next()) == KSqlAtRow) |
319 { |
320 { |
320 TPtrC name = stmt.ColumnTextL(0); |
321 TPtrC name = stmt.ColumnTextL(0); |
321 RDebug::Print(_L("%S\r\n"), &name); |
322 TheTest.Printf(_L("%S\r\n"), &name); |
322 TInt res = name.CompareC(KNames[2], 3, NULL); |
323 TInt res = name.CompareC(KNames[2], 3, NULL); |
323 TEST(res > 0); |
324 TEST(res > 0); |
324 } |
325 } |
325 stmt.Close(); |
326 stmt.Close(); |
326 TEST2(err, KSqlAtEnd); |
327 TEST2(err, KSqlAtEnd); |
327 |
328 |
328 //Cleanup |
329 //Cleanup |
329 db.Close(); |
330 db.Close(); |
330 RDebug::Print(_L("###Delete test database\r\n")); |
331 TheTest.Printf(_L("###Delete test database\r\n")); |
331 (void)RSqlDatabase::Delete(KTestDbName1); |
332 (void)RSqlDatabase::Delete(KTestDbName1); |
332 } |
333 } |
333 |
334 |
334 /** |
335 /** |
335 @SYMTestCaseID SYSLIB-SQL-CT-1627 |
336 @SYMTestCaseID SYSLIB-SQL-CT-1627 |
348 RSqlDatabase db; |
349 RSqlDatabase db; |
349 TInt err = db.Create(KTestDbName1); |
350 TInt err = db.Create(KTestDbName1); |
350 TEST2(err, KErrNone); |
351 TEST2(err, KErrNone); |
351 |
352 |
352 //Create test database |
353 //Create test database |
353 RDebug::Print(_L("###Create test database\r\n")); |
354 TheTest.Printf(_L("###Create test database\r\n")); |
354 _LIT(KCreateSql, "CREATE TABLE A(Name VARCHAR(100) COLLATE CompareC0)"); |
355 _LIT(KCreateSql, "CREATE TABLE A(Name VARCHAR(100) COLLATE CompareC0)"); |
355 err = db.Exec(KCreateSql); |
356 err = db.Exec(KCreateSql); |
356 TEST(err >= 0); |
357 TEST(err >= 0); |
357 |
358 |
358 //Insert some records. Some of the inserted names have accented letters. |
359 //Insert some records. Some of the inserted names have accented letters. |
359 //But all names are equal if compared at collation level 0. |
360 //But all names are equal if compared at collation level 0. |
360 RDebug::Print(_L("###Insert some records\r\n")); |
361 TheTest.Printf(_L("###Insert some records\r\n")); |
361 _LIT(KInsertSql, "INSERT INTO A(Name) VALUES("); |
362 _LIT(KInsertSql, "INSERT INTO A(Name) VALUES("); |
362 TBuf<10> name1(_L("Dvorak")); |
363 TBuf<10> name1(_L("Dvorak")); |
363 TBuf<10> name2; |
364 TBuf<10> name2; |
364 name2.SetLength(6); |
365 name2.SetLength(6); |
365 name2[0] = TChar('D'); |
366 name2[0] = TChar('D'); |
393 err = db.Exec(sql); |
394 err = db.Exec(sql); |
394 TEST2(err, 1); |
395 TEST2(err, 1); |
395 } |
396 } |
396 |
397 |
397 //The next "SELECT" statement must return a set, which record count must be matchNameCnt. |
398 //The next "SELECT" statement must return a set, which record count must be matchNameCnt. |
398 RDebug::Print(_L("###Select all records, collated string comparison, level 0\r\n")); |
399 TheTest.Printf(_L("###Select all records, collated string comparison, level 0\r\n")); |
399 _LIT(KSelectSql2, "SELECT * FROM A WHERE NAME = 'dvorak'"); |
400 _LIT(KSelectSql2, "SELECT * FROM A WHERE NAME = 'dvorak'"); |
400 RSqlStatement stmt; |
401 RSqlStatement stmt; |
401 err = stmt.Prepare(db, KSelectSql2); |
402 err = stmt.Prepare(db, KSelectSql2); |
402 TEST2(err, KErrNone); |
403 TEST2(err, KErrNone); |
403 |
404 |
404 TInt recCount = 0; |
405 TInt recCount = 0; |
405 while((err = stmt.Next()) == KSqlAtRow) |
406 while((err = stmt.Next()) == KSqlAtRow) |
406 { |
407 { |
407 TPtrC name = stmt.ColumnTextL(0); |
408 TPtrC name = stmt.ColumnTextL(0); |
408 RDebug::Print(_L("%S\r\n"), &name); |
409 TheTest.Printf(_L("%S\r\n"), &name); |
409 TEST(name == KNames[recCount]); |
410 TEST(name == KNames[recCount]); |
410 ++recCount; |
411 ++recCount; |
411 } |
412 } |
412 stmt.Close(); |
413 stmt.Close(); |
413 TEST(recCount == matchNameCnt); |
414 TEST(recCount == matchNameCnt); |
414 |
415 |
415 //The next "SELECT" statement must return an ordered set containing all table records. |
416 //The next "SELECT" statement must return an ordered set containing all table records. |
416 RDebug::Print(_L("###Select all records, collated string comparison, level 1\r\n")); |
417 TheTest.Printf(_L("###Select all records, collated string comparison, level 1\r\n")); |
417 _LIT(KSelectSql3, "SELECT * FROM A WHERE NAME = 'dvorak' ORDER BY NAME COLLATE CompareC1 DESC"); |
418 _LIT(KSelectSql3, "SELECT * FROM A WHERE NAME = 'dvorak' ORDER BY NAME COLLATE CompareC1 DESC"); |
418 err = stmt.Prepare(db, KSelectSql3); |
419 err = stmt.Prepare(db, KSelectSql3); |
419 TEST2(err, KErrNone); |
420 TEST2(err, KErrNone); |
420 |
421 |
421 for(TInt k=0;k<KInsertSqlStmtCnt;++k) |
422 for(TInt k=0;k<KInsertSqlStmtCnt;++k) |
422 { |
423 { |
423 err = stmt.Next(); |
424 err = stmt.Next(); |
424 TEST2(err, KSqlAtRow); |
425 TEST2(err, KSqlAtRow); |
425 TPtrC name = stmt.ColumnTextL(0); |
426 TPtrC name = stmt.ColumnTextL(0); |
426 RDebug::Print(_L("%S %S\r\n"), &name, &sortedNames[k]); |
427 TheTest.Printf(_L("%S %S\r\n"), &name, &sortedNames[k]); |
427 TEST(name == sortedNames[KInsertSqlStmtCnt - k - 1]);//descending order |
428 TEST(name == sortedNames[KInsertSqlStmtCnt - k - 1]);//descending order |
428 } |
429 } |
429 stmt.Close(); |
430 stmt.Close(); |
430 |
431 |
431 //CompareC2 collation used in the SELECT statement |
432 //CompareC2 collation used in the SELECT statement |
511 TEST2(err, KErrNone); |
512 TEST2(err, KErrNone); |
512 err = stmt.Next(); |
513 err = stmt.Next(); |
513 TEST(err != KErrNone); |
514 TEST(err != KErrNone); |
514 TEST2(::SqlRetCodeClass(err), ESqlDbError); |
515 TEST2(::SqlRetCodeClass(err), ESqlDbError); |
515 TPtrC errMsg = db.LastErrorMessage(); |
516 TPtrC errMsg = db.LastErrorMessage(); |
516 RDebug::Print(_L("!! error=\"%S\"\r\n"), &errMsg); |
517 TheTest.Printf(_L("!! error=\"%S\"\r\n"), &errMsg); |
517 stmt.Close(); |
518 stmt.Close(); |
518 //Test case 6 = wild card character used in the search pattern + LIKE + ESCAPE with more than one escape characters |
519 //Test case 6 = wild card character used in the search pattern + LIKE + ESCAPE with more than one escape characters |
519 err = stmt.Prepare(db, _L("SELECT COUNT(*) FROM A WHERE Name LIKE 't/_sqltest' ESCAPE '1234'")); |
520 err = stmt.Prepare(db, _L("SELECT COUNT(*) FROM A WHERE Name LIKE 't/_sqltest' ESCAPE '1234'")); |
520 TEST2(err, KErrNone); |
521 TEST2(err, KErrNone); |
521 err = stmt.Next(); |
522 err = stmt.Next(); |
522 TEST(err != KErrNone); |
523 TEST(err != KErrNone); |
523 TEST2(::SqlRetCodeClass(err), ESqlDbError); |
524 TEST2(::SqlRetCodeClass(err), ESqlDbError); |
524 errMsg.Set(db.LastErrorMessage()); |
525 errMsg.Set(db.LastErrorMessage()); |
525 RDebug::Print(_L("!! error=\"%S\"\r\n"), &errMsg); |
526 TheTest.Printf(_L("!! error=\"%S\"\r\n"), &errMsg); |
526 stmt.Close(); |
527 stmt.Close(); |
527 //Test case 7 = blank pattern string |
528 //Test case 7 = blank pattern string |
528 err = stmt.Prepare(db, _L("SELECT COUNT(*) FROM A WHERE Name LIKE ''")); |
529 err = stmt.Prepare(db, _L("SELECT COUNT(*) FROM A WHERE Name LIKE ''")); |
529 TEST2(err, KErrNone); |
530 TEST2(err, KErrNone); |
530 err = stmt.Next(); |
531 err = stmt.Next(); |