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