/duelos_android/src-gen/com/moob/DueloDao.java

https://bitbucket.org/jgorozco/ejemplosandroid · Java · 178 lines · 133 code · 28 blank · 17 comment · 21 complexity · a5399ddbf53839cb891f267d2efcbe4f MD5 · raw file

  1. package com.moob;
  2. import android.database.Cursor;
  3. import android.database.sqlite.SQLiteDatabase;
  4. import android.database.sqlite.SQLiteStatement;
  5. import de.greenrobot.dao.AbstractDao;
  6. import de.greenrobot.dao.DaoConfig;
  7. import de.greenrobot.dao.Property;
  8. import com.moob.Duelo;
  9. // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
  10. /**
  11. * DAO for table DUELO.
  12. */
  13. public class DueloDao extends AbstractDao<Duelo, Long> {
  14. public static final String TABLENAME = "DUELO";
  15. /**
  16. * Properties of entity Duelo.<br/>
  17. * Can be used for QueryBuilder and for referencing column names.
  18. */
  19. public static class Properties {
  20. public final static Property Id = new Property(0, Long.class, "id", true, "_id");
  21. public final static Property ContrincanteId = new Property(1, String.class, "contrincanteId", false, "CONTRINCANTE_ID");
  22. public final static Property Ganador = new Property(2, String.class, "ganador", false, "GANADOR");
  23. public final static Property TimeToShot = new Property(3, String.class, "timeToShot", false, "TIME_TO_SHOT");
  24. public final static Property MaxVelocity = new Property(4, String.class, "maxVelocity", false, "MAX_VELOCITY");
  25. public final static Property MinVelocity = new Property(5, String.class, "minVelocity", false, "MIN_VELOCITY");
  26. public final static Property Shotin = new Property(6, String.class, "shotin", false, "SHOTIN");
  27. public final static Property Puntuacion = new Property(7, String.class, "puntuacion", false, "PUNTUACION");
  28. public final static Property Date = new Property(8, java.util.Date.class, "date", false, "DATE");
  29. };
  30. public DueloDao(DaoConfig config) {
  31. super(config);
  32. }
  33. public DueloDao(DaoConfig config, DaoSession daoSession) {
  34. super(config, daoSession);
  35. }
  36. /** Creates the underlying database table. */
  37. public static void createTable(SQLiteDatabase db, boolean ifNotExists) {
  38. String constraint = ifNotExists? "IF NOT EXISTS ": "";
  39. db.execSQL("CREATE TABLE " + constraint + "'DUELO' (" + //
  40. "'_id' INTEGER PRIMARY KEY ," + // 0: id
  41. "'CONTRINCANTE_ID' TEXT," + // 1: contrincanteId
  42. "'GANADOR' TEXT," + // 2: ganador
  43. "'TIME_TO_SHOT' TEXT," + // 3: timeToShot
  44. "'MAX_VELOCITY' TEXT," + // 4: maxVelocity
  45. "'MIN_VELOCITY' TEXT," + // 5: minVelocity
  46. "'SHOTIN' TEXT," + // 6: shotin
  47. "'PUNTUACION' TEXT," + // 7: puntuacion
  48. "'DATE' INTEGER);"); // 8: date
  49. }
  50. /** Drops the underlying database table. */
  51. public static void dropTable(SQLiteDatabase db, boolean ifExists) {
  52. String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "'DUELO'";
  53. db.execSQL(sql);
  54. }
  55. /** @inheritdoc */
  56. @Override
  57. protected void bindValues(SQLiteStatement stmt, Duelo entity) {
  58. stmt.clearBindings();
  59. Long id = entity.getId();
  60. if (id != null) {
  61. stmt.bindLong(1, id);
  62. }
  63. String contrincanteId = entity.getContrincanteId();
  64. if (contrincanteId != null) {
  65. stmt.bindString(2, contrincanteId);
  66. }
  67. String ganador = entity.getGanador();
  68. if (ganador != null) {
  69. stmt.bindString(3, ganador);
  70. }
  71. String timeToShot = entity.getTimeToShot();
  72. if (timeToShot != null) {
  73. stmt.bindString(4, timeToShot);
  74. }
  75. String maxVelocity = entity.getMaxVelocity();
  76. if (maxVelocity != null) {
  77. stmt.bindString(5, maxVelocity);
  78. }
  79. String minVelocity = entity.getMinVelocity();
  80. if (minVelocity != null) {
  81. stmt.bindString(6, minVelocity);
  82. }
  83. String shotin = entity.getShotin();
  84. if (shotin != null) {
  85. stmt.bindString(7, shotin);
  86. }
  87. String puntuacion = entity.getPuntuacion();
  88. if (puntuacion != null) {
  89. stmt.bindString(8, puntuacion);
  90. }
  91. java.util.Date date = entity.getDate();
  92. if (date != null) {
  93. stmt.bindLong(9, date.getTime());
  94. }
  95. }
  96. /** @inheritdoc */
  97. @Override
  98. public Long readKey(Cursor cursor, int offset) {
  99. return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
  100. }
  101. /** @inheritdoc */
  102. @Override
  103. public Duelo readEntity(Cursor cursor, int offset) {
  104. Duelo entity = new Duelo( //
  105. cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
  106. cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // contrincanteId
  107. cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // ganador
  108. cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // timeToShot
  109. cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // maxVelocity
  110. cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // minVelocity
  111. cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // shotin
  112. cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // puntuacion
  113. cursor.isNull(offset + 8) ? null : new java.util.Date(cursor.getLong(offset + 8)) // date
  114. );
  115. return entity;
  116. }
  117. /** @inheritdoc */
  118. @Override
  119. public void readEntity(Cursor cursor, Duelo entity, int offset) {
  120. entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
  121. entity.setContrincanteId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
  122. entity.setGanador(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
  123. entity.setTimeToShot(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
  124. entity.setMaxVelocity(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
  125. entity.setMinVelocity(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
  126. entity.setShotin(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
  127. entity.setPuntuacion(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
  128. entity.setDate(cursor.isNull(offset + 8) ? null : new java.util.Date(cursor.getLong(offset + 8)));
  129. }
  130. /** @inheritdoc */
  131. @Override
  132. protected Long updateKeyAfterInsert(Duelo entity, long rowId) {
  133. entity.setId(rowId);
  134. return rowId;
  135. }
  136. /** @inheritdoc */
  137. @Override
  138. public Long getKey(Duelo entity) {
  139. if(entity != null) {
  140. return entity.getId();
  141. } else {
  142. return null;
  143. }
  144. }
  145. /** @inheritdoc */
  146. @Override
  147. protected boolean isEntityUpdateable() {
  148. return true;
  149. }
  150. }