コード例 #1
0
    // Use this for initialization
    void Start()
    {
        LocationDb mLocationDb = new LocationDb();

        //Add Data
        mLocationDb.addData(new LocationEntity("0", "AR", "0.001", "0.007"));
        mLocationDb.addData(new LocationEntity("1", "AR", "0.002", "0.006"));
        mLocationDb.addData(new LocationEntity("2", "AR", "0.003", "0.005"));
        mLocationDb.addData(new LocationEntity("3", "AR", "0.004", "0.004"));
        mLocationDb.addData(new LocationEntity("4", "AR", "0.005", "0.003"));
        mLocationDb.addData(new LocationEntity("5", "AR", "0.006", "0.002"));
        mLocationDb.addData(new LocationEntity("6", "AR", "0.007", "0.001"));
        mLocationDb.close();


        //Fetch All Data
        LocationDb mLocationDb2 = new LocationDb();

        System.Data.IDataReader reader = mLocationDb2.getAllData();

        int fieldCount = reader.FieldCount;
        List <LocationEntity> myList = new List <LocationEntity>();

        while (reader.Read())
        {
            LocationEntity entity = new LocationEntity(reader[0].ToString(),
                                                       reader[1].ToString(),
                                                       reader[2].ToString(),
                                                       reader[3].ToString(),
                                                       reader[4].ToString());

            Debug.Log("id: " + entity._id);
            myList.Add(entity);
        }
    }
コード例 #2
0
    private void Start()
    {
        LocationDb mLocationDb = new LocationDb();

        //Add Data
        mLocationDb.addData(new LocationEntity("SPHERE 1", "5.000", "5.000"));
        mLocationDb.addData(new LocationEntity("SPHERE 2", "4.000", "4.000"));
        mLocationDb.addData(new LocationEntity("SPHERE 3", "3.000", "3.000"));
        mLocationDb.addData(new LocationEntity("SPHERE 4", "2.000", "2.000"));
        mLocationDb.addData(new LocationEntity("SPHERE 5", "1.000", "1.000"));
        mLocationDb.addData(new LocationEntity("SPHERE 6", "0.000", "0.000"));
        mLocationDb.Close();


        //Fetch All Data
        LocationDb  mLocationDb2 = new LocationDb();
        IDataReader reader       = mLocationDb2.GetAllData();

        int fieldCount = reader.FieldCount;
        List <LocationEntity> myList = new List <LocationEntity>();

        while (reader.Read())
        {
            LocationEntity entity = new LocationEntity(Convert.ToInt32(reader[0]),
                                                       reader[1].ToString(),
                                                       reader[2].ToString(),
                                                       reader[3].ToString(),
                                                       reader[4].ToString());

            Debug.Log("id: " + entity.Id);
            myList.Add(entity);
            Instantiate(GameObject.CreatePrimitive(PrimitiveType.Sphere), new Vector3((float)Convert.ToDouble(entity.Lat), (float)Convert.ToDouble(entity.Lon), 0), Quaternion.identity);
        }
    }