1 package foo.bar; 2 3 import androidx.annotation.NonNull; 4 import androidx.lifecycle.LiveData; 5 import androidx.paging.PagingSource; 6 import androidx.room.RoomDatabase; 7 import androidx.room.RoomRawQuery; 8 import androidx.room.RoomSQLiteQuery; 9 import androidx.room.guava.GuavaRoom; 10 import androidx.room.paging.LimitOffsetPagingSource; 11 import androidx.room.util.DBUtil; 12 import androidx.room.util.SQLiteStatementUtil; 13 import androidx.room.util.StringUtil; 14 import androidx.sqlite.SQLiteStatement; 15 import androidx.sqlite.db.SupportSQLiteQuery; 16 import com.google.common.util.concurrent.ListenableFuture; 17 import java.lang.Class; 18 import java.lang.Integer; 19 import java.lang.Object; 20 import java.lang.Override; 21 import java.lang.String; 22 import java.lang.StringBuilder; 23 import java.lang.SuppressWarnings; 24 import java.util.ArrayList; 25 import java.util.Collections; 26 import java.util.List; 27 import javax.annotation.processing.Generated; 28 import kotlin.coroutines.Continuation; 29 30 @Generated("androidx.room.RoomProcessor") 31 @SuppressWarnings({"unchecked", "deprecation", "removal"}) 32 public final class ComplexDao_Impl extends ComplexDao { 33 private final RoomDatabase __db; 34 ComplexDao_Impl(final ComplexDatabase __db)35 public ComplexDao_Impl(final ComplexDatabase __db) { 36 super(__db); 37 this.__db = __db; 38 } 39 40 @Override transactionMethod(final int i, final String s, final long l)41 public boolean transactionMethod(final int i, final String s, final long l) { 42 return DBUtil.performBlocking(__db, false, true, (_connection) -> { 43 return ComplexDao_Impl.super.transactionMethod(i, s, l); 44 }); 45 } 46 47 @Override fullNames(final int id)48 public List<ComplexDao.FullName> fullNames(final int id) { 49 final String _sql = "SELECT name || lastName as fullName, uid as id FROM user where uid = ?"; 50 return DBUtil.performBlocking(__db, true, false, (_connection) -> { 51 final SQLiteStatement _stmt = _connection.prepare(_sql); 52 try { 53 int _argIndex = 1; 54 _stmt.bindLong(_argIndex, id); 55 final int _columnIndexOfFullName = 0; 56 final int _columnIndexOfId = 1; 57 final List<ComplexDao.FullName> _result = new ArrayList<ComplexDao.FullName>(); 58 while (_stmt.step()) { 59 final ComplexDao.FullName _item; 60 _item = new ComplexDao.FullName(); 61 if (_stmt.isNull(_columnIndexOfFullName)) { 62 _item.fullName = null; 63 } else { 64 _item.fullName = _stmt.getText(_columnIndexOfFullName); 65 } 66 _item.id = (int) (_stmt.getLong(_columnIndexOfId)); 67 _result.add(_item); 68 } 69 return _result; 70 } finally { 71 _stmt.close(); 72 } 73 }); 74 } 75 76 @Override 77 public User getById(final int id) { 78 final String _sql = "SELECT * FROM user where uid = ?"; 79 return DBUtil.performBlocking(__db, true, false, (_connection) -> { 80 final SQLiteStatement _stmt = _connection.prepare(_sql); 81 try { 82 int _argIndex = 1; 83 _stmt.bindLong(_argIndex, id); 84 final int _columnIndexOfUid = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "uid"); 85 final int _columnIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name"); 86 final int _columnIndexOfLastName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "lastName"); 87 final int _columnIndexOfAge = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "ageColumn"); 88 final User _result; 89 if (_stmt.step()) { 90 _result = new User(); 91 _result.uid = (int) (_stmt.getLong(_columnIndexOfUid)); 92 if (_stmt.isNull(_columnIndexOfName)) { 93 _result.name = null; 94 } else { 95 _result.name = _stmt.getText(_columnIndexOfName); 96 } 97 final String _tmpLastName; 98 if (_stmt.isNull(_columnIndexOfLastName)) { 99 _tmpLastName = null; 100 } else { 101 _tmpLastName = _stmt.getText(_columnIndexOfLastName); 102 } 103 _result.setLastName(_tmpLastName); 104 _result.age = (int) (_stmt.getLong(_columnIndexOfAge)); 105 } else { 106 _result = null; 107 } 108 return _result; 109 } finally { 110 _stmt.close(); 111 } 112 }); 113 } 114 115 @Override 116 public User findByName(final String name, final String lastName) { 117 final String _sql = "SELECT * FROM user where name LIKE ? AND lastName LIKE ?"; 118 return DBUtil.performBlocking(__db, true, false, (_connection) -> { 119 final SQLiteStatement _stmt = _connection.prepare(_sql); 120 try { 121 int _argIndex = 1; 122 if (name == null) { 123 _stmt.bindNull(_argIndex); 124 } else { 125 _stmt.bindText(_argIndex, name); 126 } 127 _argIndex = 2; 128 if (lastName == null) { 129 _stmt.bindNull(_argIndex); 130 } else { 131 _stmt.bindText(_argIndex, lastName); 132 } 133 final int _columnIndexOfUid = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "uid"); 134 final int _columnIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name"); 135 final int _columnIndexOfLastName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "lastName"); 136 final int _columnIndexOfAge = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "ageColumn"); 137 final User _result; 138 if (_stmt.step()) { 139 _result = new User(); 140 _result.uid = (int) (_stmt.getLong(_columnIndexOfUid)); 141 if (_stmt.isNull(_columnIndexOfName)) { 142 _result.name = null; 143 } else { 144 _result.name = _stmt.getText(_columnIndexOfName); 145 } 146 final String _tmpLastName; 147 if (_stmt.isNull(_columnIndexOfLastName)) { 148 _tmpLastName = null; 149 } else { 150 _tmpLastName = _stmt.getText(_columnIndexOfLastName); 151 } 152 _result.setLastName(_tmpLastName); 153 _result.age = (int) (_stmt.getLong(_columnIndexOfAge)); 154 } else { 155 _result = null; 156 } 157 return _result; 158 } finally { 159 _stmt.close(); 160 } 161 }); 162 } 163 164 @Override 165 public List<User> loadAllByIds(final int... ids) { 166 final StringBuilder _stringBuilder = new StringBuilder(); 167 _stringBuilder.append("SELECT * FROM user where uid IN ("); 168 final int _inputSize = ids == null ? 1 : ids.length; 169 StringUtil.appendPlaceholders(_stringBuilder, _inputSize); 170 _stringBuilder.append(")"); 171 final String _sql = _stringBuilder.toString(); 172 return DBUtil.performBlocking(__db, true, false, (_connection) -> { 173 final SQLiteStatement _stmt = _connection.prepare(_sql); 174 try { 175 int _argIndex = 1; 176 if (ids == null) { 177 _stmt.bindNull(_argIndex); 178 } else { 179 for (int _item : ids) { 180 _stmt.bindLong(_argIndex, _item); 181 _argIndex++; 182 } 183 } 184 final int _columnIndexOfUid = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "uid"); 185 final int _columnIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name"); 186 final int _columnIndexOfLastName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "lastName"); 187 final int _columnIndexOfAge = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "ageColumn"); 188 final List<User> _result = new ArrayList<User>(); 189 while (_stmt.step()) { 190 final User _item_1; 191 _item_1 = new User(); 192 _item_1.uid = (int) (_stmt.getLong(_columnIndexOfUid)); 193 if (_stmt.isNull(_columnIndexOfName)) { 194 _item_1.name = null; 195 } else { 196 _item_1.name = _stmt.getText(_columnIndexOfName); 197 } 198 final String _tmpLastName; 199 if (_stmt.isNull(_columnIndexOfLastName)) { 200 _tmpLastName = null; 201 } else { 202 _tmpLastName = _stmt.getText(_columnIndexOfLastName); 203 } 204 _item_1.setLastName(_tmpLastName); 205 _item_1.age = (int) (_stmt.getLong(_columnIndexOfAge)); 206 _result.add(_item_1); 207 } 208 return _result; 209 } finally { 210 _stmt.close(); 211 } 212 }); 213 } 214 215 @Override 216 int getAge(final int id) { 217 final String _sql = "SELECT ageColumn FROM user where uid = ?"; 218 return DBUtil.performBlocking(__db, true, false, (_connection) -> { 219 final SQLiteStatement _stmt = _connection.prepare(_sql); 220 try { 221 int _argIndex = 1; 222 _stmt.bindLong(_argIndex, id); 223 final int _result; 224 if (_stmt.step()) { 225 _result = (int) (_stmt.getLong(0)); 226 } else { 227 _result = 0; 228 } 229 return _result; 230 } finally { 231 _stmt.close(); 232 } 233 }); 234 } 235 236 @Override 237 public int[] getAllAges(final int... ids) { 238 final StringBuilder _stringBuilder = new StringBuilder(); 239 _stringBuilder.append("SELECT ageColumn FROM user where uid IN("); 240 final int _inputSize = ids == null ? 1 : ids.length; 241 StringUtil.appendPlaceholders(_stringBuilder, _inputSize); 242 _stringBuilder.append(")"); 243 final String _sql = _stringBuilder.toString(); 244 return DBUtil.performBlocking(__db, true, false, (_connection) -> { 245 final SQLiteStatement _stmt = _connection.prepare(_sql); 246 try { 247 int _argIndex = 1; 248 if (ids == null) { 249 _stmt.bindNull(_argIndex); 250 } else { 251 for (int _item : ids) { 252 _stmt.bindLong(_argIndex, _item); 253 _argIndex++; 254 } 255 } 256 final List<Integer> _listResult = new ArrayList<Integer>(); 257 while (_stmt.step()) { 258 final Integer _item_1; 259 _item_1 = (int) (_stmt.getLong(0)); 260 _listResult.add(_item_1); 261 } 262 final int[] _tmpArrayResult = new int[_listResult.size()]; 263 int _index = 0; 264 for (int _listItem : _listResult) { 265 _tmpArrayResult[_index] = _listItem; 266 _index++; 267 } 268 final int[] _result = _tmpArrayResult; 269 return _result; 270 } finally { 271 _stmt.close(); 272 } 273 }); 274 } 275 276 @Override 277 public List<Integer> getAllAgesAsList(final List<Integer> ids) { 278 final StringBuilder _stringBuilder = new StringBuilder(); 279 _stringBuilder.append("SELECT ageColumn FROM user where uid IN("); 280 final int _inputSize = ids == null ? 1 : ids.size(); 281 StringUtil.appendPlaceholders(_stringBuilder, _inputSize); 282 _stringBuilder.append(")"); 283 final String _sql = _stringBuilder.toString(); 284 return DBUtil.performBlocking(__db, true, false, (_connection) -> { 285 final SQLiteStatement _stmt = _connection.prepare(_sql); 286 try { 287 int _argIndex = 1; 288 if (ids == null) { 289 _stmt.bindNull(_argIndex); 290 } else { 291 for (Integer _item : ids) { 292 if (_item == null) { 293 _stmt.bindNull(_argIndex); 294 } else { 295 _stmt.bindLong(_argIndex, _item); 296 } 297 _argIndex++; 298 } 299 } 300 final List<Integer> _result = new ArrayList<Integer>(); 301 while (_stmt.step()) { 302 final Integer _item_1; 303 if (_stmt.isNull(0)) { 304 _item_1 = null; 305 } else { 306 _item_1 = (int) (_stmt.getLong(0)); 307 } 308 _result.add(_item_1); 309 } 310 return _result; 311 } finally { 312 _stmt.close(); 313 } 314 }); 315 } 316 317 @Override 318 public List<Integer> getAllAgesAsList(final List<Integer> ids1, final int[] ids2, 319 final int... ids3) { 320 final StringBuilder _stringBuilder = new StringBuilder(); 321 _stringBuilder.append("SELECT ageColumn FROM user where uid IN("); 322 final int _inputSize = ids1 == null ? 1 : ids1.size(); 323 StringUtil.appendPlaceholders(_stringBuilder, _inputSize); 324 _stringBuilder.append(") OR uid IN ("); 325 final int _inputSize_1 = ids2 == null ? 1 : ids2.length; 326 StringUtil.appendPlaceholders(_stringBuilder, _inputSize_1); 327 _stringBuilder.append(") OR uid IN ("); 328 final int _inputSize_2 = ids3 == null ? 1 : ids3.length; 329 StringUtil.appendPlaceholders(_stringBuilder, _inputSize_2); 330 _stringBuilder.append(")"); 331 final String _sql = _stringBuilder.toString(); 332 return DBUtil.performBlocking(__db, true, false, (_connection) -> { 333 final SQLiteStatement _stmt = _connection.prepare(_sql); 334 try { 335 int _argIndex = 1; 336 if (ids1 == null) { 337 _stmt.bindNull(_argIndex); 338 } else { 339 for (Integer _item : ids1) { 340 if (_item == null) { 341 _stmt.bindNull(_argIndex); 342 } else { 343 _stmt.bindLong(_argIndex, _item); 344 } 345 _argIndex++; 346 } 347 } 348 _argIndex = 1 + _inputSize; 349 if (ids2 == null) { 350 _stmt.bindNull(_argIndex); 351 } else { 352 for (int _item_1 : ids2) { 353 _stmt.bindLong(_argIndex, _item_1); 354 _argIndex++; 355 } 356 } 357 _argIndex = 1 + _inputSize + _inputSize_1; 358 if (ids3 == null) { 359 _stmt.bindNull(_argIndex); 360 } else { 361 for (int _item_2 : ids3) { 362 _stmt.bindLong(_argIndex, _item_2); 363 _argIndex++; 364 } 365 } 366 final List<Integer> _result = new ArrayList<Integer>(); 367 while (_stmt.step()) { 368 final Integer _item_3; 369 if (_stmt.isNull(0)) { 370 _item_3 = null; 371 } else { 372 _item_3 = (int) (_stmt.getLong(0)); 373 } 374 _result.add(_item_3); 375 } 376 return _result; 377 } finally { 378 _stmt.close(); 379 } 380 }); 381 } 382 383 @Override 384 public LiveData<User> getByIdLive(final int id) { 385 final String _sql = "SELECT * FROM user where uid = ?"; 386 return __db.getInvalidationTracker().createLiveData(new String[] {"user"}, false, (_connection) -> { 387 final SQLiteStatement _stmt = _connection.prepare(_sql); 388 try { 389 int _argIndex = 1; 390 _stmt.bindLong(_argIndex, id); 391 final int _columnIndexOfUid = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "uid"); 392 final int _columnIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name"); 393 final int _columnIndexOfLastName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "lastName"); 394 final int _columnIndexOfAge = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "ageColumn"); 395 final User _result; 396 if (_stmt.step()) { 397 _result = new User(); 398 _result.uid = (int) (_stmt.getLong(_columnIndexOfUid)); 399 if (_stmt.isNull(_columnIndexOfName)) { 400 _result.name = null; 401 } else { 402 _result.name = _stmt.getText(_columnIndexOfName); 403 } 404 final String _tmpLastName; 405 if (_stmt.isNull(_columnIndexOfLastName)) { 406 _tmpLastName = null; 407 } else { 408 _tmpLastName = _stmt.getText(_columnIndexOfLastName); 409 } 410 _result.setLastName(_tmpLastName); 411 _result.age = (int) (_stmt.getLong(_columnIndexOfAge)); 412 } else { 413 _result = null; 414 } 415 return _result; 416 } finally { 417 _stmt.close(); 418 } 419 }); 420 } 421 422 @Override 423 public LiveData<List<User>> loadUsersByIdsLive(final int... ids) { 424 final StringBuilder _stringBuilder = new StringBuilder(); 425 _stringBuilder.append("SELECT * FROM user where uid IN ("); 426 final int _inputSize = ids == null ? 1 : ids.length; 427 StringUtil.appendPlaceholders(_stringBuilder, _inputSize); 428 _stringBuilder.append(")"); 429 final String _sql = _stringBuilder.toString(); 430 return __db.getInvalidationTracker().createLiveData(new String[] {"user"}, false, (_connection) -> { 431 final SQLiteStatement _stmt = _connection.prepare(_sql); 432 try { 433 int _argIndex = 1; 434 if (ids == null) { 435 _stmt.bindNull(_argIndex); 436 } else { 437 for (int _item : ids) { 438 _stmt.bindLong(_argIndex, _item); 439 _argIndex++; 440 } 441 } 442 final int _columnIndexOfUid = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "uid"); 443 final int _columnIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name"); 444 final int _columnIndexOfLastName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "lastName"); 445 final int _columnIndexOfAge = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "ageColumn"); 446 final List<User> _result = new ArrayList<User>(); 447 while (_stmt.step()) { 448 final User _item_1; 449 _item_1 = new User(); 450 _item_1.uid = (int) (_stmt.getLong(_columnIndexOfUid)); 451 if (_stmt.isNull(_columnIndexOfName)) { 452 _item_1.name = null; 453 } else { 454 _item_1.name = _stmt.getText(_columnIndexOfName); 455 } 456 final String _tmpLastName; 457 if (_stmt.isNull(_columnIndexOfLastName)) { 458 _tmpLastName = null; 459 } else { 460 _tmpLastName = _stmt.getText(_columnIndexOfLastName); 461 } 462 _item_1.setLastName(_tmpLastName); 463 _item_1.age = (int) (_stmt.getLong(_columnIndexOfAge)); 464 _result.add(_item_1); 465 } 466 return _result; 467 } finally { 468 _stmt.close(); 469 } 470 }); 471 } 472 473 @Override 474 public List<Child1> getChild1List() { 475 final String _sql = "SELECT * FROM Child1"; 476 return DBUtil.performBlocking(__db, true, false, (_connection) -> { 477 final SQLiteStatement _stmt = _connection.prepare(_sql); 478 try { 479 final int _columnIndexOfId = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "id"); 480 final int _columnIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name"); 481 final int _columnIndexOfSerial = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "serial"); 482 final int _columnIndexOfCode = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "code"); 483 final List<Child1> _result = new ArrayList<Child1>(); 484 while (_stmt.step()) { 485 final Child1 _item; 486 final int _tmpId; 487 _tmpId = (int) (_stmt.getLong(_columnIndexOfId)); 488 final String _tmpName; 489 if (_stmt.isNull(_columnIndexOfName)) { 490 _tmpName = null; 491 } else { 492 _tmpName = _stmt.getText(_columnIndexOfName); 493 } 494 final Info _tmpInfo; 495 if (!(_stmt.isNull(_columnIndexOfSerial) && _stmt.isNull(_columnIndexOfCode))) { 496 _tmpInfo = new Info(); 497 _tmpInfo.serial = (int) (_stmt.getLong(_columnIndexOfSerial)); 498 if (_stmt.isNull(_columnIndexOfCode)) { 499 _tmpInfo.code = null; 500 } else { 501 _tmpInfo.code = _stmt.getText(_columnIndexOfCode); 502 } 503 } else { 504 _tmpInfo = null; 505 } 506 _item = new Child1(_tmpId,_tmpName,_tmpInfo); 507 _result.add(_item); 508 } 509 return _result; 510 } finally { 511 _stmt.close(); 512 } 513 }); 514 } 515 516 @Override 517 public List<Child2> getChild2List() { 518 final String _sql = "SELECT * FROM Child2"; 519 return DBUtil.performBlocking(__db, true, false, (_connection) -> { 520 final SQLiteStatement _stmt = _connection.prepare(_sql); 521 try { 522 final int _columnIndexOfId = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "id"); 523 final int _columnIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name"); 524 final int _columnIndexOfSerial = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "serial"); 525 final int _columnIndexOfCode = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "code"); 526 final List<Child2> _result = new ArrayList<Child2>(); 527 while (_stmt.step()) { 528 final Child2 _item; 529 final int _tmpId; 530 _tmpId = (int) (_stmt.getLong(_columnIndexOfId)); 531 final String _tmpName; 532 if (_stmt.isNull(_columnIndexOfName)) { 533 _tmpName = null; 534 } else { 535 _tmpName = _stmt.getText(_columnIndexOfName); 536 } 537 final Info _tmpInfo; 538 if (!(_stmt.isNull(_columnIndexOfSerial) && _stmt.isNull(_columnIndexOfCode))) { 539 _tmpInfo = new Info(); 540 _tmpInfo.serial = (int) (_stmt.getLong(_columnIndexOfSerial)); 541 if (_stmt.isNull(_columnIndexOfCode)) { 542 _tmpInfo.code = null; 543 } else { 544 _tmpInfo.code = _stmt.getText(_columnIndexOfCode); 545 } 546 } else { 547 _tmpInfo = null; 548 } 549 _item = new Child2(_tmpId,_tmpName,_tmpInfo); 550 _result.add(_item); 551 } 552 return _result; 553 } finally { 554 _stmt.close(); 555 } 556 }); 557 } 558 559 @Override 560 public ListenableFuture<List<Child1>> getChild1ListListenableFuture() { 561 final String _sql = "SELECT * FROM Child1"; 562 return GuavaRoom.createListenableFuture(__db, true, false, (_connection) -> { 563 final SQLiteStatement _stmt = _connection.prepare(_sql); 564 try { 565 final int _columnIndexOfId = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "id"); 566 final int _columnIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name"); 567 final int _columnIndexOfSerial = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "serial"); 568 final int _columnIndexOfCode = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "code"); 569 final List<Child1> _result = new ArrayList<Child1>(); 570 while (_stmt.step()) { 571 final Child1 _item; 572 final int _tmpId; 573 _tmpId = (int) (_stmt.getLong(_columnIndexOfId)); 574 final String _tmpName; 575 if (_stmt.isNull(_columnIndexOfName)) { 576 _tmpName = null; 577 } else { 578 _tmpName = _stmt.getText(_columnIndexOfName); 579 } 580 final Info _tmpInfo; 581 if (!(_stmt.isNull(_columnIndexOfSerial) && _stmt.isNull(_columnIndexOfCode))) { 582 _tmpInfo = new Info(); 583 _tmpInfo.serial = (int) (_stmt.getLong(_columnIndexOfSerial)); 584 if (_stmt.isNull(_columnIndexOfCode)) { 585 _tmpInfo.code = null; 586 } else { 587 _tmpInfo.code = _stmt.getText(_columnIndexOfCode); 588 } 589 } else { 590 _tmpInfo = null; 591 } 592 _item = new Child1(_tmpId,_tmpName,_tmpInfo); 593 _result.add(_item); 594 } 595 return _result; 596 } finally { 597 _stmt.close(); 598 } 599 }); 600 } 601 602 @Override 603 public List<UserSummary> getUserNames() { 604 final String _sql = "SELECT `uid`, `name` FROM (SELECT * FROM User)"; 605 return DBUtil.performBlocking(__db, true, false, (_connection) -> { 606 final SQLiteStatement _stmt = _connection.prepare(_sql); 607 try { 608 final int _columnIndexOfUid = 0; 609 final int _columnIndexOfName = 1; 610 final List<UserSummary> _result = new ArrayList<UserSummary>(); 611 while (_stmt.step()) { 612 final UserSummary _item; 613 _item = new UserSummary(); 614 _item.uid = (int) (_stmt.getLong(_columnIndexOfUid)); 615 if (_stmt.isNull(_columnIndexOfName)) { 616 _item.name = null; 617 } else { 618 _item.name = _stmt.getText(_columnIndexOfName); 619 } 620 _result.add(_item); 621 } 622 return _result; 623 } finally { 624 _stmt.close(); 625 } 626 }); 627 } 628 629 @Override 630 public PagingSource<Integer, Child1> loadItems() { 631 final String _sql = "SELECT * FROM Child1 ORDER BY id ASC"; 632 final RoomRawQuery _rawQuery = new RoomRawQuery(_sql); 633 return new LimitOffsetPagingSource<Child1>(_rawQuery, __db, "Child1") { 634 @Override 635 protected Object convertRows(final RoomRawQuery limitOffsetQuery, final int itemCount, 636 final Continuation<? super List<? extends Child1>> $completion) { 637 return DBUtil.performSuspending(__db, true, false, (_connection) -> { 638 final SQLiteStatement _stmt = _connection.prepare(limitOffsetQuery.getSql()); 639 limitOffsetQuery.getBindingFunction().invoke(_stmt); 640 try { 641 final int _columnIndexOfId = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "id"); 642 final int _columnIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name"); 643 final int _columnIndexOfSerial = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "serial"); 644 final int _columnIndexOfCode = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "code"); 645 final List<Child1> _result = new ArrayList<Child1>(); 646 while (_stmt.step()) { 647 final Child1 _item; 648 final int _tmpId; 649 _tmpId = (int) (_stmt.getLong(_columnIndexOfId)); 650 final String _tmpName; 651 if (_stmt.isNull(_columnIndexOfName)) { 652 _tmpName = null; 653 } else { 654 _tmpName = _stmt.getText(_columnIndexOfName); 655 } 656 final Info _tmpInfo; 657 if (!(_stmt.isNull(_columnIndexOfSerial) && _stmt.isNull(_columnIndexOfCode))) { 658 _tmpInfo = new Info(); 659 _tmpInfo.serial = (int) (_stmt.getLong(_columnIndexOfSerial)); 660 if (_stmt.isNull(_columnIndexOfCode)) { 661 _tmpInfo.code = null; 662 } else { 663 _tmpInfo.code = _stmt.getText(_columnIndexOfCode); 664 } 665 } else { 666 _tmpInfo = null; 667 } 668 _item = new Child1(_tmpId,_tmpName,_tmpInfo); 669 _result.add(_item); 670 } 671 return _result; 672 } finally { 673 _stmt.close(); 674 } 675 }, $completion); 676 } 677 }; 678 } 679 680 @Override 681 public User getUserViaRawQuery(final SupportSQLiteQuery rawQuery) { 682 final RoomRawQuery _rawQuery = RoomSQLiteQuery.copyFrom(rawQuery).toRoomRawQuery(); 683 final String _sql = _rawQuery.getSql(); 684 return DBUtil.performBlocking(__db, true, false, (_connection) -> { 685 final SQLiteStatement _stmt = _connection.prepare(_sql); 686 try { 687 _rawQuery.getBindingFunction().invoke(_stmt); 688 final User _result; 689 if (_stmt.step()) { 690 _result = __entityStatementConverter_fooBarUser(_stmt); 691 } else { 692 _result = null; 693 } 694 return _result; 695 } finally { 696 _stmt.close(); 697 } 698 }); 699 } 700 701 @NonNull 702 public static List<Class<?>> getRequiredConverters() { 703 return Collections.emptyList(); 704 } 705 706 private User __entityStatementConverter_fooBarUser(@NonNull final SQLiteStatement statement) { 707 final User _entity; 708 final int _columnIndexOfUid = SQLiteStatementUtil.getColumnIndex(statement, "uid"); 709 final int _columnIndexOfName = SQLiteStatementUtil.getColumnIndex(statement, "name"); 710 final int _columnIndexOfLastName = SQLiteStatementUtil.getColumnIndex(statement, "lastName"); 711 final int _columnIndexOfAge = SQLiteStatementUtil.getColumnIndex(statement, "ageColumn"); 712 _entity = new User(); 713 if (_columnIndexOfUid != -1) { 714 _entity.uid = (int) (statement.getLong(_columnIndexOfUid)); 715 } 716 if (_columnIndexOfName != -1) { 717 if (statement.isNull(_columnIndexOfName)) { 718 _entity.name = null; 719 } else { 720 _entity.name = statement.getText(_columnIndexOfName); 721 } 722 } 723 if (_columnIndexOfLastName != -1) { 724 final String _tmpLastName; 725 if (statement.isNull(_columnIndexOfLastName)) { 726 _tmpLastName = null; 727 } else { 728 _tmpLastName = statement.getText(_columnIndexOfLastName); 729 } 730 _entity.setLastName(_tmpLastName); 731 } 732 if (_columnIndexOfAge != -1) { 733 _entity.age = (int) (statement.getLong(_columnIndexOfAge)); 734 } 735 return _entity; 736 } 737 } 738