Example usage for com.badlogic.gdx.sql SQLiteGdxDatabaseCursor isNull

List of usage examples for com.badlogic.gdx.sql SQLiteGdxDatabaseCursor isNull

Introduction

In this page you can find the example usage for com.badlogic.gdx.sql SQLiteGdxDatabaseCursor isNull.

Prototype

public boolean isNull(int i);

Source Link

Usage

From source file:de.longri.cachebox3.sqlite.dao.CacheDAO.java

License:Open Source License

private boolean readDetailFromCursor(SQLiteGdxDatabaseCursor reader, CacheDetail detail,
        boolean withReaderOffset, boolean withDescription) {
    // Reader includes Compleate Cache or Details only
    int readerOffset = withReaderOffset ? 20 : 0;

    detail.PlacedBy = reader.getString(readerOffset + 0).trim();

    if (reader.isNull(readerOffset + 5))
        detail.ApiStatus = Cache.NOTLIVE;
    else//from w  w  w.  j  a v a2 s  . c  o m
        detail.ApiStatus = (byte) reader.getInt(readerOffset + 5);

    String sDate = reader.getString(readerOffset + 1);
    DateFormat iso8601Format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    try {
        detail.DateHidden = iso8601Format.parse(sDate);
    } catch (ParseException e) {
        e.printStackTrace();
    }

    detail.Url = reader.getString(readerOffset + 2).trim();
    if (reader.getString(readerOffset + 3) != null)
        detail.TourName = reader.getString(readerOffset + 3).trim();
    else
        detail.TourName = "";
    if (reader.getString(readerOffset + 4) != "")
        detail.GPXFilename_ID = reader.getLong(readerOffset + 4);
    else
        detail.GPXFilename_ID = -1;
    detail.setAttributesPositive(new DLong(reader.getLong(readerOffset + 7), reader.getLong(readerOffset + 6)));
    detail.setAttributesNegative(new DLong(reader.getLong(readerOffset + 9), reader.getLong(readerOffset + 8)));

    if (reader.getString(readerOffset + 10) != null)
        detail.setHint(reader.getString(readerOffset + 10).trim());
    else
        detail.setHint("");

    if (withDescription) {
        detail.longDescription = reader.getString(readerOffset + 11);
        detail.tmpSolver = reader.getString(readerOffset + 12);
        detail.tmpNote = reader.getString(readerOffset + 13);
        detail.shortDescription = reader.getString(readerOffset + 14);
    }
    return true;
}

From source file:de.longri.cachebox3.sqlite.dao.GpxFilenameDAO.java

License:Open Source License

public GpxFilename ReadFromCursor(SQLiteGdxDatabaseCursor reader) {
    long id;//from ww w  .j ava2  s.com
    String gpxFileName;
    long categoryId = -1;

    id = reader.getLong(0);
    gpxFileName = reader.getString(1);

    GpxFilename result = new GpxFilename(id, gpxFileName, categoryId);

    if (reader.isNull(2))
        result.Imported = new Date();
    else {
        String sDate = reader.getString(2);
        DateFormat iso8601Format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        try {
            result.Imported = iso8601Format.parse(sDate);
        } catch (ParseException e) {
            result.Imported = new Date();
        }
    }

    if (reader.isNull(3))
        result.CacheCount = 0;
    else
        result.CacheCount = reader.getInt(3);

    return result;
}

From source file:de.longri.cachebox3.sqlite.Import.CacheInfoList.java

License:Open Source License

/**
 * Mit dieser Methode wird die DB indexiert und die Klasse enthlt dann eine Statiche Liste mit den Cache Informationen. Wenn die Liste
 * nicht mehr bentigt wird, sollte sie mit dispose() gelscht werden.
 *//*from   ww w.  ja  v  a  2s . com*/
public static void IndexDB() {
    mCacheInfoList = new HashMap<String, CacheInfo>();

    SQLiteGdxDatabaseCursor reader = Database.Data.rawQuery(
            "select GcCode, Id, ListingCheckSum, ImagesUpdated, DescriptionImagesUpdated, ListingChanged, Found, CorrectedCoordinates, Latitude, Longitude, GpxFilename_Id, Favorit from Caches",
            null);

    reader.moveToFirst();

    while (!reader.isAfterLast()) {
        CacheInfo cacheInfo = new CacheInfo();

        cacheInfo.id = reader.getLong(1);

        if (reader.isNull(2)) {
            cacheInfo.ListingCheckSum = 0;
        } else {
            cacheInfo.ListingCheckSum = reader.getInt(2);
        }

        if (reader.isNull(3)) {
            cacheInfo.ImagesUpdated = false;
        } else {
            cacheInfo.ImagesUpdated = reader.getInt(3) != 0;
        }

        if (reader.isNull(4)) {
            cacheInfo.DescriptionImagesUpdated = false;
        } else {
            cacheInfo.DescriptionImagesUpdated = reader.getInt(4) != 0;
        }

        if (reader.isNull(5)) {
            cacheInfo.ListingChanged = false;
        } else {
            cacheInfo.ListingChanged = reader.getInt(5) != 0;
        }

        if (reader.isNull(6)) {
            cacheInfo.Found = false;
        } else {
            cacheInfo.Found = reader.getInt(6) != 0;
        }

        if (reader.isNull(7)) {
            cacheInfo.CorrectedCoordinates = false;
        } else {
            cacheInfo.CorrectedCoordinates = reader.getInt(7) != 0;
        }

        if (reader.isNull(8)) {
            cacheInfo.Latitude = 361;
        } else {
            cacheInfo.Latitude = reader.getDouble(8);
        }
        if (reader.isNull(9)) {
            cacheInfo.Longitude = 361;
        } else {
            cacheInfo.Longitude = reader.getDouble(9);
        }

        cacheInfo.GpxFilename_Id = reader.getInt(10);

        if (reader.isNull(11)) {
            cacheInfo.favorite = false;
        } else {
            cacheInfo.favorite = reader.getInt(11) != 0;
        }

        mCacheInfoList.put(reader.getString(0), cacheInfo);
        reader.moveToNext();
    }
    reader.close();

}

From source file:de.longri.cachebox3.types.CacheDetail.java

License:Open Source License

public DLong getAttributesNegative(long Id) {
    if (this.attributesNegative == null) {
        SQLiteGdxDatabaseCursor c = Database.Data.rawQuery(
                "select AttributesNegative,AttributesNegativeHigh from Caches where Id=?",
                new String[] { String.valueOf(Id) });
        c.moveToFirst();//  w  ww  .ja v  a  2s . c o m
        while (!c.isAfterLast()) {
            if (!c.isNull(0))
                this.attributesNegative = new DLong(c.getLong(1), c.getLong(0));
            else
                this.attributesNegative = new DLong(0, 0);
            break;
        }
        ;
        c.close();
    }
    return this.attributesNegative;
}

From source file:de.longri.cachebox3.types.CacheDetail.java

License:Open Source License

public DLong getAttributesPositive(long Id) {
    if (this.attributesPositive == null) {
        SQLiteGdxDatabaseCursor c = Database.Data.rawQuery(
                "select AttributesPositive,AttributesPositiveHigh from Caches where Id=?",
                new String[] { String.valueOf(Id) });
        c.moveToFirst();/* w  w  w  .j av  a2  s. c om*/
        while (!c.isAfterLast()) {
            if (!c.isNull(0))
                this.attributesPositive = new DLong(c.getLong(1), c.getLong(0));
            else
                this.attributesPositive = new DLong(0, 0);
            break;
        }
        ;
        c.close();
    }
    return this.attributesPositive;
}