Android Open Source - ormada S Q Lite Cursor






From Project

Back to project page ormada.

License

The source code is released under:

Copyright (c) 2012 Jesse Rosalia Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Sof...

If you think the Android project ormada listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.andrormeda.dialect;
//from   ww w.  java 2s  . c  om
import java.util.HashMap;
import java.util.Map;

import org.ormada.dialect.QueryCursor;

import android.database.Cursor;

public class SQLiteCursor implements QueryCursor {

  private Cursor cursor;
    private int columnCount;
    private Map<Integer, String> nameCache;

  public SQLiteCursor(Cursor cursor) {
    this.cursor      = cursor;
    this.columnCount = this.cursor != null ? this.cursor.getColumnCount() : 0;
    this.nameCache   = new HashMap<Integer, String>();
  }

  @Override
  public void close() {
    this.cursor.close();
  }

  @Override
  public boolean isEmpty() {
    return this.cursor != null ? this.cursor.getCount() == 0 : true;
  }

  @Override
  public boolean moveToFirst() {
    return this.cursor != null ? this.cursor.moveToFirst() : false;
  }

  @Override
  public boolean isAfterLast() {
    return this.cursor != null ? this.cursor.isAfterLast() : true;
  }

  @Override
  public boolean moveToNext() {
    return this.cursor != null ? this.cursor.moveToNext() : false;
  }

  @Override
  public int getColumnCount() {
    return this.columnCount;
  }

  @Override
  public String getColumnName(int col) {
      if (!this.nameCache.containsKey(col)) {
          String name = this.cursor != null ? this.cursor.getColumnName(col) : null;
          this.nameCache.put(col, name);
      }
      
      return this.nameCache.get(col);
  }

  @Override
  public long getLong(int col) {
    return this.cursor.getLong(col);
  }

  @Override
  public int getInt(int col) {
    return this.cursor.getInt(col);
  }

  @Override
  public short getShort(int col) {
    return this.cursor.getShort(col);
  }

  @Override
  public float getFloat(int col) {
    return this.cursor.getFloat(col);
  }

  @Override
  public double getDouble(int col) {
    return this.cursor.getDouble(col);
  }

  @Override
  public byte[] getBlob(int col) {
    return this.cursor.getBlob(col);
  }

  @Override
  public String getString(int col) {
    return this.cursor.getString(col);
  }
}




Java Source Code List

org.andrormeda.dialect.SQLiteCursor.java
org.andrormeda.dialect.SQLiteDialect.java
org.andrormeda.dialect.SQLiteValueSet.java
org.andrormeda.example.AppDataSource.java
org.andrormeda.example.ExampleActivity.java
org.andrormeda.example.model.Cat.java
org.andrormeda.example.model.Kitten.java
org.ormada.ORMDataSource.java
org.ormada.annotations.OneToMany.java
org.ormada.annotations.Owner.java
org.ormada.annotations.Reference.java
org.ormada.annotations.Text.java
org.ormada.annotations.Transient.java
org.ormada.dialect.AStandardSQLDialect.java
org.ormada.dialect.DefaultValueSet.java
org.ormada.dialect.Dialect.java
org.ormada.dialect.ForwardOnlyResultSetCursor.java
org.ormada.dialect.FullResultSetCursor.java
org.ormada.dialect.QueryCursor.java
org.ormada.dialect.ValueSet.java
org.ormada.entity.EntityBuilder.java
org.ormada.entity.EntityCache.java
org.ormada.entity.EntityMetaData.java
org.ormada.entity.Entity.java
org.ormada.exception.MixedCollectionException.java
org.ormada.exception.UnableToOpenException.java
org.ormada.exception.UnsavedReferenceException.java
org.ormada.hsql.dialect.HSQLDialect.java
org.ormada.hsql.example.AppDataSource.java
org.ormada.hsql.example.ExampleMain.java
org.ormada.hsql.example.model.Cat.java
org.ormada.hsql.example.model.Kitten.java
org.ormada.model.ORMeta.java
org.ormada.reflect.DefaultReflector.java
org.ormada.reflect.Reflector.java
org.ormada.util.Profiler.java