| 308 CX_TEST_ASSERT(!cx_strcmp(p1->address->zip, "23456")); |
308 CX_TEST_ASSERT(!cx_strcmp(p1->address->zip, "23456")); |
| 309 CX_TEST_ASSERT(!cx_strcmp(p0->address->city, "city 17")); |
309 CX_TEST_ASSERT(!cx_strcmp(p0->address->city, "city 17")); |
| 310 CX_TEST_ASSERT(!cx_strcmp(p1->address->city, "city 18")); |
310 CX_TEST_ASSERT(!cx_strcmp(p1->address->city, "city 18")); |
| 311 |
311 |
| 312 dbuObjectBuilderDestroy(builder); |
312 dbuObjectBuilderDestroy(builder); |
| 313 |
|
| 314 const char *sql2 = "select p.*, " |
|
| 315 "a.address_id as [__address__address_id], a.street, a.zip, a.city, " |
|
| 316 "c.country_id as [__country__country_id], c.name " |
|
| 317 "from Person p inner join Address a on p.address_id = a.address_id inner join Country c on a.country_id = c.country_id " |
|
| 318 "order by p.person_id;"; |
|
| 319 DBUQuery *query2 = dbuQueryCreate(conn, mp->allocator, sql2); |
|
| 320 DBUObjectBuilder *builder2 = dbuObjectBuilder(person, query2, mp->allocator); |
|
| 321 CxList *persons2 = dbuObjectBuilderGetList(builder2); |
|
| 322 |
|
| 323 CX_TEST_ASSERT(persons2); |
|
| 324 CX_TEST_ASSERT(cxListSize(persons2) == 2); |
|
| 325 |
|
| 326 p0 = cxListAt(persons2, 0); |
|
| 327 p1 = cxListAt(persons2, 1); |
|
| 328 CX_TEST_ASSERT(p0); |
|
| 329 CX_TEST_ASSERT(p1); |
|
| 330 CX_TEST_ASSERT(!cx_strcmp(p0->name, "alice")); |
|
| 331 CX_TEST_ASSERT(!cx_strcmp(p1->name, "bob")); |
|
| 332 CX_TEST_ASSERT(!cx_strcmp(p0->email, "alice@example.com")); |
|
| 333 CX_TEST_ASSERT(!cx_strcmp(p1->email, "bob@example.com")); |
|
| 334 CX_TEST_ASSERT(p0->age == 30); |
|
| 335 CX_TEST_ASSERT(p1->age == 25); |
|
| 336 CX_TEST_ASSERT(p0->iscustomer == 0); |
|
| 337 CX_TEST_ASSERT(p1->iscustomer == 1); |
|
| 338 CX_TEST_ASSERT(p0->hash == 123456789); |
|
| 339 CX_TEST_ASSERT(p1->hash == 987654321); |
|
| 340 |
|
| 341 CX_TEST_ASSERT(p0->address != NULL); |
|
| 342 CX_TEST_ASSERT(p1->address != NULL); |
|
| 343 |
|
| 344 CX_TEST_ASSERT(!cx_strcmp(p0->address->street, "street 1")); |
|
| 345 CX_TEST_ASSERT(!cx_strcmp(p1->address->street, "street 2")); |
|
| 346 CX_TEST_ASSERT(!cx_strcmp(p0->address->zip, "12343")); |
|
| 347 CX_TEST_ASSERT(!cx_strcmp(p1->address->zip, "23456")); |
|
| 348 CX_TEST_ASSERT(!cx_strcmp(p0->address->city, "city 17")); |
|
| 349 CX_TEST_ASSERT(!cx_strcmp(p1->address->city, "city 18")); |
|
| 350 |
|
| 351 dbuObjectBuilderDestroy(builder2); |
|
| 352 } |
313 } |
| 353 |
314 |
| 354 cxMempoolFree(mp); |
315 cxMempoolFree(mp); |
| 355 } |
316 } |
| 356 |
317 |
| 393 CX_TEST_ASSERT(!cx_strcmp(p0->address->zip, "12343")); |
354 CX_TEST_ASSERT(!cx_strcmp(p0->address->zip, "12343")); |
| 394 CX_TEST_ASSERT(!cx_strcmp(p1->address->zip, "23456")); |
355 CX_TEST_ASSERT(!cx_strcmp(p1->address->zip, "23456")); |
| 395 CX_TEST_ASSERT(!cx_strcmp(p0->address->city, "city 17")); |
356 CX_TEST_ASSERT(!cx_strcmp(p0->address->city, "city 17")); |
| 396 CX_TEST_ASSERT(!cx_strcmp(p1->address->city, "city 18")); |
357 CX_TEST_ASSERT(!cx_strcmp(p1->address->city, "city 18")); |
| 397 |
358 |
| |
359 CX_TEST_ASSERT(p0->address->country); |
| |
360 CX_TEST_ASSERT(p1->address->country); |
| |
361 CX_TEST_ASSERT(!cx_strcmp(p0->address->country->name, "Germany")); |
| |
362 CX_TEST_ASSERT(!cx_strcmp(p1->address->country->name, "Germany")); |
| |
363 |
| 398 dbuObjectBuilderDestroy(builder); |
364 dbuObjectBuilderDestroy(builder); |
| 399 } |
365 } |
| 400 |
366 |
| 401 cxMempoolFree(mp); |
367 cxMempoolFree(mp); |
| 402 } |
368 } |