示例#1
0
 public int Update(
     Context context,
     String where,
     String[] selectionArgs,
     Long race_ID,
     Long raceLocation_ID,
     Date raceDate,
     Long raceStartTime,
     Long raceTypeID,
     Long startTimeOffset,
     Long numLaps) {
   ContentValues content = new ContentValues();
   if (raceLocation_ID != null) {
     content.put(Race.RaceLocation_ID, raceLocation_ID);
   }
   if (raceDate != null) {
     content.put(Race.RaceDate, raceDate.getTime());
   }
   if (raceStartTime != null) {
     content.put(Race.RaceStartTime, raceStartTime);
   }
   if (raceTypeID != null) {
     content.put(Race.RaceType, raceTypeID);
   }
   if (startTimeOffset != null) {
     content.put(Race.StartInterval, startTimeOffset);
   }
   if (numLaps != null) {
     content.put(Race.NumLaps, numLaps);
   }
   return context
       .getContentResolver()
       .update(Race.Instance().CONTENT_URI, content, where, selectionArgs);
 }
示例#2
0
  public Hashtable<String, Long> getValues(Context context, Long race_ID) {
    Hashtable<String, Long> raceValues = new Hashtable<String, Long>();

    Cursor raceCursor =
        Race.Instance()
            .Read(context, null, Race._ID + "=?", new String[] {Long.toString(race_ID)}, null);
    if (raceCursor != null && raceCursor.getCount() > 0) {
      raceCursor.moveToFirst();
      raceValues.put(Race._ID, race_ID);
      raceValues.put(Race.RaceDate, raceCursor.getLong(raceCursor.getColumnIndex(Race.RaceDate)));
      raceValues.put(
          Race.RaceLocation_ID,
          raceCursor.getLong(raceCursor.getColumnIndex(Race.RaceLocation_ID)));
      raceValues.put(Race.RaceType, raceCursor.getLong(raceCursor.getColumnIndex(Race.RaceType)));
      raceValues.put(
          Race.RaceStartTime, raceCursor.getLong(raceCursor.getColumnIndex(Race.RaceStartTime)));
      raceValues.put(Race.NumLaps, raceCursor.getLong(raceCursor.getColumnIndex(Race.NumLaps)));
      raceValues.put(
          Race.StartInterval, raceCursor.getLong(raceCursor.getColumnIndex(Race.StartInterval)));
    }
    if (raceCursor != null) {
      raceCursor.close();
      raceCursor = null;
    }

    return raceValues;
  }
示例#3
0
  public ArrayList<Uri> getAllUrisToNotifyOnChange() {
    ArrayList<Uri> urisToNotify = super.getAllUrisToNotifyOnChange();

    urisToNotify.add(Race.Instance().CONTENT_URI);
    urisToNotify.add(CheckInViewInclusive.Instance().CONTENT_URI);
    urisToNotify.add(CheckInViewExclusive.Instance().CONTENT_URI);
    urisToNotify.add(RaceInfoView.Instance().CONTENT_URI);
    urisToNotify.add(RaceLocation.Instance().CONTENT_URI);

    return urisToNotify;
  }
 public String getCreate() {
   return "create table "
       + getTableName()
       + " ("
       + _ID
       + " integer primary key autoincrement, "
       + RacerClubInfo_ID
       + " integer references "
       + RacerClubInfo.Instance().getTableName()
       + "("
       + RacerClubInfo._ID
       + ") null, "
       + TeamInfo_ID
       + " integer references "
       + TeamInfo.Instance().getTableName()
       + "("
       + TeamInfo._ID
       + ") null, "
       + Race_ID
       + " integer references "
       + Race.Instance().getTableName()
       + "("
       + Race._ID
       + ") not null, "
       + StartOrder
       + " integer not null,"
       + StartTimeOffset
       + " integer not null,"
       + StartTime
       + " integer null,"
       + EndTime
       + " integer null,"
       + ElapsedTime
       + " integer null,"
       + OverallPlacing
       + " integer null,"
       + CategoryPlacing
       + " integer null,"
       + Points
       + " integer not null,"
       + PrimePoints
       + " integer not null,"
       + IsSynced
       + " integer not null"
       + ");";
 }
示例#5
0
  public Uri Create(
      Context context,
      long raceLocation,
      Date raceDate,
      Long raceStartTime,
      long raceTypeID,
      Long startTimeOffset,
      long numLaps) {
    ContentValues content = new ContentValues();
    content.put(Race.RaceLocation_ID, raceLocation);
    content.put(Race.RaceDate, raceDate.getTime());
    content.put(Race.RaceStartTime, raceStartTime);
    content.put(Race.RaceType, raceTypeID);
    content.put(Race.NumLaps, numLaps);
    content.put(Race.StartInterval, startTimeOffset);

    return context.getContentResolver().insert(Race.Instance().CONTENT_URI, content);
  }