/**
  * 绑定参数 Author: hyl Time: 2015-8-17上午10:42:43
  *
  * @param statement
  * @param position
  * @param args
  */
 private void bindArgs(SQLiteStatement statement, int position, Object args) {
   int type = FieldTypeManager.getValueType(args);
   switch (type) {
     case FieldTypeManager.VALUE_TYPE_NULL:
       statement.bindNull(position);
       break;
     case FieldTypeManager.BASE_TYPE_BYTE_ARRAY:
       statement.bindBlob(position, (byte[]) args);
       break;
     case FieldTypeManager.BASE_TYPE_CHAR:
     case FieldTypeManager.BASE_TYPE_STRING:
       statement.bindString(position, args.toString());
       break;
     case FieldTypeManager.BASE_TYPE_DATE:
       statement.bindString(position, DateUtil.formatDatetime((Date) args));
       break;
     case FieldTypeManager.BASE_TYPE_DOUBLE:
     case FieldTypeManager.BASE_TYPE_FLOAT:
       statement.bindDouble(position, Double.parseDouble(args.toString()));
       break;
     case FieldTypeManager.BASE_TYPE_INT:
     case FieldTypeManager.BASE_TYPE_LONG:
     case FieldTypeManager.BASE_TYPE_SHORT:
       statement.bindLong(position, Long.parseLong(args.toString()));
       break;
     case FieldTypeManager.NOT_BASE_TYPE:
       throw new IllegalArgumentException("未知参数类型,请检查绑定参数");
   }
 }
Beispiel #2
0
  /** @inheritdoc */
  @Override
  protected void bindValues(SQLiteStatement stmt, DBCover entity) {
    stmt.clearBindings();

    Long id = entity.getId();
    if (id != null) {
      stmt.bindLong(1, id);
    }

    String urlSmall = entity.getUrlSmall();
    if (urlSmall != null) {
      stmt.bindString(2, urlSmall);
    }

    Integer height = entity.getHeight();
    if (height != null) {
      stmt.bindLong(3, height);
    }

    String url = entity.getUrl();
    if (url != null) {
      stmt.bindString(4, url);
    }

    Integer width = entity.getWidth();
    if (width != null) {
      stmt.bindLong(5, width);
    }
  }
Beispiel #3
0
  /** @inheritdoc */
  @Override
  protected void bindValues(SQLiteStatement stmt, Place entity) {
    stmt.clearBindings();

    Long id = entity.getId();
    if (id != null) {
      stmt.bindLong(1, id);
    }

    String label = entity.getLabel();
    if (label != null) {
      stmt.bindString(2, label);
    }

    String name = entity.getName();
    if (name != null) {
      stmt.bindString(3, name);
    }

    String pinyin = entity.getPinyin();
    if (pinyin != null) {
      stmt.bindString(4, pinyin);
    }

    String province = entity.getProvince();
    if (province != null) {
      stmt.bindString(5, province);
    }
  }
  /**
   * Called by the ManageLocations screen to update a location in the database
   *
   * @param id
   * @param locationName
   * @param coordinates
   * @param description
   * @return
   */
  public boolean updateLocationData(
      int id, String locationName, String coordinates, String description) {
    boolean success = false;

    SQLiteDatabase db = getReadableDatabase();

    String sql =
        "UPDATE locations SET locationName = ?, coordinates = ?, description = ? where _id = ?";

    SQLiteStatement sqlStatement = db.compileStatement(sql);
    sqlStatement.bindString(1, locationName);
    sqlStatement.bindString(2, coordinates);
    sqlStatement.bindString(3, description);
    sqlStatement.bindLong(4, id);

    db.beginTransaction();
    try {
      sqlStatement.execute();
      db.setTransactionSuccessful();
      success = true;
    } catch (SQLException ex) {
      ex.printStackTrace();
    } finally {
      db.endTransaction();
      sqlStatement.close();
      db.close();
    }

    return success;
  }
Beispiel #5
0
 /**
  * Adds or updates room.
  *
  * @param account
  * @param room
  * @param nickname
  * @param password
  * @param join
  */
 void write(String account, String room, String nickname, String password, boolean join) {
   synchronized (writeLock) {
     if (writeStatement == null) {
       SQLiteDatabase db = databaseManager.getWritableDatabase();
       writeStatement =
           db.compileStatement(
               "INSERT OR REPLACE INTO "
                   + NAME
                   + " ("
                   + Fields.ACCOUNT
                   + ", "
                   + Fields.ROOM
                   + ", "
                   + Fields.NICKNAME
                   + ", "
                   + Fields.PASSWORD
                   + ", "
                   + Fields.NEED_JOIN
                   + ") VALUES (?, ?, ?, ?, ?);");
     }
     writeStatement.bindString(1, account);
     writeStatement.bindString(2, room);
     writeStatement.bindString(3, nickname);
     writeStatement.bindString(4, password);
     writeStatement.bindLong(5, join ? 1 : 0);
     writeStatement.execute();
   }
 }
  @MediumTest
  public void testSimpleQuery() throws Exception {
    mDatabase.execSQL("CREATE TABLE test (num INTEGER NOT NULL, str TEXT NOT NULL);");
    mDatabase.execSQL("INSERT INTO test VALUES (1234, 'hello');");
    SQLiteStatement statement1 = mDatabase.compileStatement("SELECT num FROM test WHERE str = ?");
    SQLiteStatement statement2 = mDatabase.compileStatement("SELECT str FROM test WHERE num = ?");

    try {
      statement1.bindString(1, "hello");
      long value = statement1.simpleQueryForLong();
      assertEquals(1234, value);

      statement1.bindString(1, "world");
      statement1.simpleQueryForLong();
      fail("shouldn't get here");
    } catch (SQLiteDoneException e) {
      // expected
    }

    try {
      statement2.bindLong(1, 1234);
      String value = statement1.simpleQueryForString();
      assertEquals("hello", value);

      statement2.bindLong(1, 5678);
      statement1.simpleQueryForString();
      fail("shouldn't get here");
    } catch (SQLiteDoneException e) {
      // expected
    }

    statement1.close();
    statement2.close();
  }
Beispiel #7
0
  /** update the level and count for the given flashcard in the database. */
  private void updateFlashcard(Flashcard fc) {
    openDB();

    _curDB.beginTransaction();
    try {
      // Delete old entry if any.
      SQLiteStatement dStmt = getCompiledStatement(SQL_DELETE_FCS);
      dStmt.bindString(1, fc.getLang1Str());
      dStmt.execute();

      // insert new state entry.
      SQLiteStatement iStmt = getCompiledStatement(SQL_INSERT_FCS);
      iStmt.bindString(1, fc.getLang1Str());
      iStmt.bindLong(2, fc.getLevel());
      iStmt.bindLong(3, fc.getRightGuessCount());
      iStmt.execute();
      _curDB.setTransactionSuccessful();
    } catch (SQLException e) {
      MsgDispatcher.sendMessageToUI(
          MsgType.MSG_SHOW_ERROR_MSG, 0, 0, "unable to update id=" + fc.getID());
    } finally {
      _curDB.endTransaction();
    }

    // this flashcard is no longer used by anyone so release it.
    fc.release();
  }
 public void addTerms(ArrayList<Terms> termList, User usr) {
   System.out.println("Terms StartUp : " + System.currentTimeMillis());
   if (!isTermsAvailableForCompany(usr.getCompanyId())) {
     deleteTerms();
     SQLiteDatabase db = this.getWritableDatabase();
     try {
       db.beginTransaction();
       SQLiteStatement statement = db.compileStatement(this.TERMS_QUERY);
       for (Terms terms : termList) {
         statement.bindString(1, terms.description);
         statement.bindLong(2, terms.languageId);
         statement.bindString(3, terms.term);
         statement.bindString(4, usr.getCompanyId());
         statement.execute();
         statement.clearBindings();
       }
       db.setTransactionSuccessful();
     } catch (Exception e) {
       // TODO: handle exception
     } finally {
       db.endTransaction();
       db.close();
     }
   }
   System.out.println("Terms End : " + System.currentTimeMillis());
 }
    @Override
    public void onCreate(SQLiteDatabase db) {
      db.beginTransaction();
      try {
        SQLiteStatement stmt;
        db.execSQL("create table capitals (prefecture text primary key, capital text not null);");
        stmt = db.compileStatement("insert into capitals values (?, ?);");

        for (String[] capital : CAPITALS) {
          stmt.bindString(1, capital[0]);
          stmt.bindString(2, capital[1]);
          stmt.executeInsert();
        }

        db.execSQL(
            "create table local_dishes (prefecture text not null, local_dish text not null);");
        stmt = db.compileStatement("insert into local_dishes values (?, ?);");

        for (String[] localDish : LOCAL_DISHES) {
          stmt.bindString(1, localDish[0]);
          stmt.bindString(2, localDish[1]);
          stmt.executeInsert();
        }
        db.setTransactionSuccessful();
      } finally {
        db.endTransaction();
      }
    }
  /** @inheritdoc */
  @Override
  protected void bindValues(SQLiteStatement stmt, ThirdGameDownInfo entity) {
    stmt.clearBindings();

    Long id = entity.getId();
    if (id != null) {
      stmt.bindLong(1, id);
    }

    String gameURLId = entity.getGameURLId();
    if (gameURLId != null) {
      stmt.bindString(2, gameURLId);
    }

    String url = entity.getUrl();
    if (url != null) {
      stmt.bindString(3, url);
    }

    Integer downToken = entity.getDownToken();
    if (downToken != null) {
      stmt.bindLong(4, downToken);
    }

    String remark = entity.getRemark();
    if (remark != null) {
      stmt.bindString(5, remark);
    }

    String logoUrl = entity.getLogoUrl();
    if (logoUrl != null) {
      stmt.bindString(6, logoUrl);
    }
    stmt.bindString(7, entity.getGameId());
  }
Beispiel #11
0
  /** @inheritdoc */
  @Override
  protected void bindValues(SQLiteStatement stmt, NoticeBean entity) {
    stmt.clearBindings();

    Long id = entity.getId();
    if (id != null) {
      stmt.bindLong(1, id);
    }

    String noticeTitle = entity.getNoticeTitle();
    if (noticeTitle != null) {
      stmt.bindString(2, noticeTitle);
    }

    String noticeContent = entity.getNoticeContent();
    if (noticeContent != null) {
      stmt.bindString(3, noticeContent);
    }

    String noticeTime = entity.getNoticeTime();
    if (noticeTime != null) {
      stmt.bindString(4, noticeTime);
    }

    String noticePublisher = entity.getNoticePublisher();
    if (noticePublisher != null) {
      stmt.bindString(5, noticePublisher);
    }
  }
Beispiel #12
0
  /** @inheritdoc */
  @Override
  protected void bindValues(SQLiteStatement stmt, MunkaKep entity) {
    stmt.clearBindings();

    Long munkaKepID = entity.getMunkaKepID();
    if (munkaKepID != null) {
      stmt.bindLong(1, munkaKepID);
    }

    String munkaKepPath = entity.getMunkaKepPath();
    if (munkaKepPath != null) {
      stmt.bindString(2, munkaKepPath);
    }

    String munkaKepDate = entity.getMunkaKepDate();
    if (munkaKepDate != null) {
      stmt.bindString(3, munkaKepDate);
    }

    Boolean munkaKepIsUploaded = entity.getMunkaKepIsUploaded();
    if (munkaKepIsUploaded != null) {
      stmt.bindLong(4, munkaKepIsUploaded ? 1l : 0l);
    }

    Boolean munkaKepIsActive = entity.getMunkaKepIsActive();
    if (munkaKepIsActive != null) {
      stmt.bindLong(5, munkaKepIsActive ? 1l : 0l);
    }

    Long munkaID = entity.getMunkaID();
    if (munkaID != null) {
      stmt.bindLong(6, munkaID);
    }
  }
 private long getTagId(Tag tag) {
   if (myGetTagIdStatement == null) {
     myGetTagIdStatement =
         myDatabase.compileStatement("SELECT tag_id FROM Tags WHERE parent_id = ? AND name = ?");
     myCreateTagIdStatement =
         myDatabase.compileStatement("INSERT OR IGNORE INTO Tags (parent_id,name) VALUES (?,?)");
   }
   {
     final Long id = myIdByTag.get(tag);
     if (id != null) {
       return id;
     }
   }
   if (tag.Parent != null) {
     myGetTagIdStatement.bindLong(1, getTagId(tag.Parent));
   } else {
     myGetTagIdStatement.bindNull(1);
   }
   myGetTagIdStatement.bindString(2, tag.Name);
   long id;
   try {
     id = myGetTagIdStatement.simpleQueryForLong();
   } catch (SQLException e) {
     if (tag.Parent != null) {
       myCreateTagIdStatement.bindLong(1, getTagId(tag.Parent));
     } else {
       myCreateTagIdStatement.bindNull(1);
     }
     myCreateTagIdStatement.bindString(2, tag.Name);
     id = myCreateTagIdStatement.executeInsert();
   }
   myIdByTag.put(tag, id);
   myTagById.put(id, tag);
   return id;
 }
  protected void saveBookSeriesInfo(long bookId, SeriesInfo seriesInfo) {
    if (myGetSeriesIdStatement == null) {
      myGetSeriesIdStatement =
          myDatabase.compileStatement("SELECT series_id FROM Series WHERE name = ?");
      myInsertSeriesStatement =
          myDatabase.compileStatement("INSERT OR IGNORE INTO Series (name) VALUES (?)");
      myInsertBookSeriesStatement =
          myDatabase.compileStatement(
              "INSERT OR REPLACE INTO BookSeries (book_id,series_id,book_index) VALUES (?,?,?)");
      myDeleteBookSeriesStatement =
          myDatabase.compileStatement("DELETE FROM BookSeries WHERE book_id = ?");
    }

    if (seriesInfo == null) {
      myDeleteBookSeriesStatement.bindLong(1, bookId);
      myDeleteBookSeriesStatement.execute();
    } else {
      long seriesId;
      try {
        myGetSeriesIdStatement.bindString(1, seriesInfo.Name);
        seriesId = myGetSeriesIdStatement.simpleQueryForLong();
      } catch (SQLException e) {
        myInsertSeriesStatement.bindString(1, seriesInfo.Name);
        seriesId = myInsertSeriesStatement.executeInsert();
      }
      myInsertBookSeriesStatement.bindLong(1, bookId);
      myInsertBookSeriesStatement.bindLong(2, seriesId);
      SQLiteUtil.bindString(
          myInsertBookSeriesStatement,
          3,
          seriesInfo.Index != null ? seriesInfo.Index.toString() : null);
      myInsertBookSeriesStatement.execute();
    }
  }
  protected void saveBookAuthorInfo(long bookId, long index, Author author) {
    if (myGetAuthorIdStatement == null) {
      myGetAuthorIdStatement =
          myDatabase.compileStatement(
              "SELECT author_id FROM Authors WHERE name = ? AND sort_key = ?");
      myInsertAuthorStatement =
          myDatabase.compileStatement("INSERT OR IGNORE INTO Authors (name,sort_key) VALUES (?,?)");
      myInsertBookAuthorStatement =
          myDatabase.compileStatement(
              "INSERT OR REPLACE INTO BookAuthor (book_id,author_id,author_index) VALUES (?,?,?)");
    }

    long authorId;
    try {
      myGetAuthorIdStatement.bindString(1, author.DisplayName);
      myGetAuthorIdStatement.bindString(2, author.SortKey);
      authorId = myGetAuthorIdStatement.simpleQueryForLong();
    } catch (SQLException e) {
      myInsertAuthorStatement.bindString(1, author.DisplayName);
      myInsertAuthorStatement.bindString(2, author.SortKey);
      authorId = myInsertAuthorStatement.executeInsert();
    }
    myInsertBookAuthorStatement.bindLong(1, bookId);
    myInsertBookAuthorStatement.bindLong(2, authorId);
    myInsertBookAuthorStatement.bindLong(3, index);
    myInsertBookAuthorStatement.execute();
  }
 protected void bindValues(SQLiteStatement sqlitestatement, FoodLocale foodlocale) {
   long l1 = 1L;
   sqlitestatement.clearBindings();
   Object obj = foodlocale.getId();
   if (obj != null) {
     sqlitestatement.bindLong(1, ((Long) (obj)).longValue());
   }
   obj = foodlocale.getValue();
   if (obj != null) {
     sqlitestatement.bindString(2, ((String) (obj)));
   }
   obj = foodlocale.getLabel();
   if (obj != null) {
     sqlitestatement.bindString(3, ((String) (obj)));
   }
   obj = foodlocale.getSupportsLookupByBarCode();
   long l;
   if (obj != null) {
     if (((Boolean) (obj)).booleanValue()) {
       l = 1L;
     } else {
       l = 0L;
     }
     sqlitestatement.bindLong(4, l);
   }
   foodlocale = foodlocale.getImageUpload();
   if (foodlocale != null) {
     if (foodlocale.booleanValue()) {
       l = l1;
     } else {
       l = 0L;
     }
     sqlitestatement.bindLong(5, l);
   }
 }
 public long save(int id_sesion, int id_moderador) {
   // TODO Auto-generated method stub
   insertStatement.clearBindings();
   insertStatement.bindString(1, String.valueOf(id_sesion));
   insertStatement.bindString(2, String.valueOf(id_moderador));
   return insertStatement.executeInsert();
 }
  /** @inheritdoc */
  @Override
  protected void bindValues(SQLiteStatement stmt, TokensBD entity) {
    stmt.clearBindings();

    Long id = entity.getId();
    if (id != null) {
      stmt.bindLong(1, id);
    }

    Long expiresIn = entity.getExpiresIn();
    if (expiresIn != null) {
      stmt.bindLong(2, expiresIn);
    }

    Long expiresAt = entity.getExpiresAt();
    if (expiresAt != null) {
      stmt.bindLong(3, expiresAt);
    }

    String tokenType = entity.getTokenType();
    if (tokenType != null) {
      stmt.bindString(4, tokenType);
    }

    String refreshToken = entity.getRefreshToken();
    if (refreshToken != null) {
      stmt.bindString(5, refreshToken);
    }

    String accessToken = entity.getAccessToken();
    if (accessToken != null) {
      stmt.bindString(6, accessToken);
    }
  }
  /** @inheritdoc */
  @Override
  protected void bindValues(SQLiteStatement stmt, Person entity) {
    stmt.clearBindings();

    Long id = entity.getId();
    if (id != null) {
      stmt.bindLong(1, id);
    }
    stmt.bindString(2, entity.getName());

    Integer age = entity.getAge();
    if (age != null) {
      stmt.bindLong(3, age);
    }

    Integer height = entity.getHeight();
    if (height != null) {
      stmt.bindLong(4, height);
    }

    String introduction = entity.getIntroduction();
    if (introduction != null) {
      stmt.bindString(5, introduction);
    }
  }
Beispiel #20
0
  /** @inheritdoc */
  @Override
  protected void bindValues(SQLiteStatement stmt, Comment entity) {
    stmt.clearBindings();

    Long id = entity.getId();
    if (id != null) {
      stmt.bindLong(1, id);
    }

    String content = entity.getContent();
    if (content != null) {
      stmt.bindString(2, content);
    }

    String userId = entity.getUserId();
    if (userId != null) {
      stmt.bindString(3, userId);
    }

    String postId = entity.getPostId();
    if (postId != null) {
      stmt.bindString(4, postId);
    }

    Long idCatPost = entity.getIdCatPost();
    if (idCatPost != null) {
      stmt.bindLong(5, idCatPost);
    }
  }
  /**
   * Called by ManageLocations screen to add a location to the database
   *
   * @param locationName
   * @param coordinates
   * @param description
   * @return
   */
  public boolean addLocationData(String locationName, String coordinates, String description) {
    boolean success = false;

    SQLiteDatabase db = getReadableDatabase();

    SQLiteStatement sqlStatement =
        db.compileStatement(
            "INSERT INTO locations (locationName, coordinates, description) VALUES (?, ?, ?)");
    sqlStatement.bindString(1, locationName);
    sqlStatement.bindString(2, coordinates);
    sqlStatement.bindString(3, description);

    db.beginTransaction();
    try {
      sqlStatement.execute();
      db.setTransactionSuccessful();
      success = true;
    } catch (SQLException ex) {
      ex.printStackTrace();
    } finally {
      db.endTransaction();
      sqlStatement.close();
      db.close();
    }

    return success;
  }
Beispiel #22
0
  /** @inheritdoc */
  @Override
  protected void bindValues(SQLiteStatement stmt, Trip entity) {
    stmt.clearBindings();

    String id = entity.getId();
    if (id != null) {
      stmt.bindString(1, id);
    }
    stmt.bindString(2, entity.getRouteId());
  }
Beispiel #23
0
  /** @inheritdoc */
  @Override
  protected void bindValues(SQLiteStatement stmt, Channel entity) {
    stmt.clearBindings();

    Long id = entity.getId();
    if (id != null) {
      stmt.bindLong(1, id);
    }
    stmt.bindString(2, entity.getTitle());
    stmt.bindString(3, entity.getURL());
  }
  /** @inheritdoc */
  @Override
  protected void bindValues(SQLiteStatement stmt, DbGroupUserMappingVo entity) {
    stmt.clearBindings();

    Long id = entity.getId();
    if (id != null) {
      stmt.bindLong(1, id);
    }
    stmt.bindLong(2, entity.getGroupId());
    stmt.bindString(3, entity.getUserId());
    stmt.bindString(4, entity.getAuth());
  }
Beispiel #25
0
  /** @inheritdoc */
  @Override
  protected void bindValues(SQLiteStatement stmt, Category entity) {
    stmt.clearBindings();

    Long id = entity.getId();
    if (id != null) {
      stmt.bindLong(1, id);
    }
    stmt.bindString(2, entity.getTitle());
    stmt.bindString(3, entity.getDescription());
    stmt.bindString(4, entity.getImage());
  }
  private void insertDeletedPerson(Cursor c, SQLiteStatement insert) {
    String account = c.getString(DeletedPeopleQuery._SYNC_ACCOUNT);
    if (account == null) {
      return;
    }

    insert.bindString(DeletedRawContactInsert.ACCOUNT_NAME, account);
    insert.bindString(DeletedRawContactInsert.ACCOUNT_TYPE, DEFAULT_ACCOUNT_TYPE);
    insert.bindString(DeletedRawContactInsert.SOURCE_ID, c.getString(DeletedPeopleQuery._SYNC_ID));
    insert.bindLong(DeletedRawContactInsert.DELETED, 1);
    insert.bindLong(
        DeletedRawContactInsert.AGGREGATION_MODE, RawContacts.AGGREGATION_MODE_DISABLED);
    insert(insert);
  }
Beispiel #27
0
  /** @inheritdoc */
  @Override
  protected void bindValues(SQLiteStatement stmt, Incidente entity) {
    stmt.clearBindings();

    Long id = entity.getId();
    if (id != null) {
      stmt.bindLong(1, id);
    }

    String idServidor = entity.getIdServidor();
    if (idServidor != null) {
      stmt.bindString(2, idServidor);
    }
    stmt.bindString(3, entity.getTitulo());

    String descripcion = entity.getDescripcion();
    if (descripcion != null) {
      stmt.bindString(4, descripcion);
    }

    Integer zona = entity.getZona();
    if (zona != null) {
      stmt.bindLong(5, zona);
    }

    Integer gravedad = entity.getGravedad();
    if (gravedad != null) {
      stmt.bindLong(6, gravedad);
    }

    Double latitud = entity.getLatitud();
    if (latitud != null) {
      stmt.bindDouble(7, latitud);
    }

    Double longitud = entity.getLongitud();
    if (longitud != null) {
      stmt.bindDouble(8, longitud);
    }

    java.util.Date fechaCreacion = entity.getFechaCreacion();
    if (fechaCreacion != null) {
      stmt.bindLong(9, fechaCreacion.getTime());
    }

    String usuarioCreacion = entity.getUsuarioCreacion();
    if (usuarioCreacion != null) {
      stmt.bindString(10, usuarioCreacion);
    }
  }
Beispiel #28
0
  /** @inheritdoc */
  @Override
  protected void bindValues(SQLiteStatement stmt, VedioDownload entity) {
    stmt.clearBindings();

    Long id = entity.getId();
    if (id != null) {
      stmt.bindLong(1, id);
    }

    String vedioid = entity.getVedioid();
    if (vedioid != null) {
      stmt.bindString(2, vedioid);
    }

    String vedioName = entity.getVedioName();
    if (vedioName != null) {
      stmt.bindString(3, vedioName);
    }

    String VUri = entity.getVUri();
    if (VUri != null) {
      stmt.bindString(4, VUri);
    }

    String projId = entity.getProjId();
    if (projId != null) {
      stmt.bindString(5, projId);
    }

    String instruction = entity.getInstruction();
    if (instruction != null) {
      stmt.bindString(6, instruction);
    }

    String author = entity.getAuthor();
    if (author != null) {
      stmt.bindString(7, author);
    }

    String pubDate = entity.getPubDate();
    if (pubDate != null) {
      stmt.bindString(8, pubDate);
    }

    String VPickUri = entity.getVPickUri();
    if (VPickUri != null) {
      stmt.bindString(9, VPickUri);
    }

    String flag = entity.getFlag();
    if (flag != null) {
      stmt.bindString(10, flag);
    }
  }
Beispiel #29
0
  private boolean insertCity(
      long id, @NonNull String name, @NonNull String country, double latitude, double longitude) {
    insertStatement.bindLong(1, id);
    insertStatement.bindString(2, name);
    insertStatement.bindString(3, country);
    insertStatement.bindDouble(4, latitude);
    insertStatement.bindDouble(5, longitude);

    long rowId = insertStatement.executeInsert();
    if (rowId < 0) {
      Log.w(LOG_TAG, "Failed to insert city: id=" + id + " name=" + name);
      return false;
    }
    return true;
  }
 public long save(InstalledRecord entity) {
   insertStatement.clearBindings();
   // nov21
   // Log.i("installedread","save installed");
   insertStatement.bindString(1, entity.getPkgName());
   insertStatement.bindString(2, entity.getAppName());
   insertStatement.bindString(3, entity.getDate());
   insertStatement.bindLong(4, entity.getMiliSeconds());
   insertStatement.bindString(5, String.valueOf(entity.getLogitude()));
   insertStatement.bindString(6, String.valueOf(entity.getLatitude()));
   // insertStatement.bindDouble(5, entity.getLogitude());
   // insertStatement.bindDouble(6, entity.getLatitude());
   insertStatement.bindLong(7, entity.getNumber());
   return insertStatement.executeInsert();
 }