コード例 #1
0
	public void InsertHistoryData (HistoryData historyData) {
		SQLiteDB sqliteDB = OpenDB ();
		string sql = CreateInsertSQL (historyData);
		SQLiteQuery sqliteQuery = new SQLiteQuery (sqliteDB, sql);
		sqliteQuery.Step ();
		sqliteDB.Close ();
	}
コード例 #2
0
ファイル: optionDB.cs プロジェクト: CoderBear/AAUnity
    public bool getStatus(int id)
    {
        bool result = false;
        int num;

        string dbFile = Application.persistentDataPath + "/optionDB_playmaker.db";
        SQLiteDB db = new SQLiteDB();

        db.Open(dbFile);
        SQLiteQuery qr = new SQLiteQuery(db, "SELECT result FROM option_table WHERE id=?");
        qr.Bind(id);
        qr.Step();
        num = qr.GetInteger("result");
        switch (num)
        {
            case 0:
                result = false;
                break;
            case 1:
                result = true;
                break;
        }

        qr.Release();
        db.Close();

        return result;
    }
コード例 #3
0
	public void Reset(){
		OpenDatabase();
		mSqliteQuery = new SQLiteQuery (mSqliteDB, "update charactor_list set flag_tweet = 0;");
		mSqliteQuery.Step ();
		mSqliteQuery.Release ();
		CloseDatabase();
	}
コード例 #4
0
	public void UpdateFlagTweet (int id,int flag){
		OpenDatabase();
		mSqliteQuery = new SQLiteQuery (mSqliteDB, "update charactor_list set flag_tweet = " + flag + " where id = " +id+";");
		mSqliteQuery.Step ();
		mSqliteQuery.Release ();
		CloseDatabase();
	}
コード例 #5
0
ファイル: QuizListDao.cs プロジェクト: hanahanaside/QuizBox
	public List<Quiz> GetQuizList () {
		SQLiteDB sqliteDB = OpenDatabase ();
		SQLiteQuery sqliteQuery = new SQLiteQuery (sqliteDB, "select * from quiz_list;");
		List<Quiz> quizList = new List<Quiz> ();
		while (sqliteQuery.Step ()) {
			Quiz quiz = new Quiz ();
			//カラムがない場合アリ
			try {
				quiz.Id = sqliteQuery.GetInteger (ID_FIELD);
				quiz.Title = sqliteQuery.GetString (TITLE_FIELD);
				quiz.QuizUrl = sqliteQuery.GetString (QUIZ_URL_FIELD);
				quiz.BoughtDate = sqliteQuery.GetString (BOUGHT_DATE_FIELD);
				quiz.QuizId = sqliteQuery.GetInteger (QUIZ_ID_FIELD);
				quiz.ChallengeQuizCorrect = sqliteQuery.GetInteger (CHALLENGE_QUIZ_CORRECT);
				quiz.ChallengeQuizCount = sqliteQuery.GetInteger (CHALLENGE_QUIZ_COUNT);
				quiz.ChallengeQuizData = sqliteQuery.GetString (CHALLENGE_QUIZ_DATA_FIELD);
				quiz.OrderNumber = sqliteQuery.GetInteger (ORDER_NUMBER_FIELD);
			} catch (Exception e) {
				Debug.LogError (e.Message);
			} finally {
				quizList.Add (quiz);
			}
		}
		sqliteDB.Close ();
		return quizList;
	}
コード例 #6
0
	public void UpdateExpPoint (int expPoint)
	{
		OpenDatabase ();
		mSqliteQuery = new SQLiteQuery (mSqliteDB, "update player_data set exp_point = " + expPoint + ";");
		mSqliteQuery.Step ();
		mSqliteQuery.Release ();
		CloseDatabase ();
	}
コード例 #7
0
    protected override void LoadData(SQLiteQuery query, Dictionary <int, DBAdventure> dict)
    {
        DBAdventure db = new DBAdventure();

        db.Id    = query.GetInt("Id");
        db.Name  = query.GetString("Name");
        db.Icon  = query.GetString("Icon");
        db.Times = query.GetInt("Times");
        dict.Add(db.Id, db);
    }
コード例 #8
0
ファイル: SQLiteDB.cs プロジェクト: winpro-ovencode/study
    public List <float> ToListSingle(SQLiteQuery reader, String name)
    {
        String value = reader.GetString(name);

        if (value == "NONE")
        {
            value = "";
        }
        return(ArrayFloatConverter(value));
    }
コード例 #9
0
ファイル: SQLiteDB.cs プロジェクト: winpro-ovencode/study
    public List <int> ToListInt32(SQLiteQuery reader, String name)
    {
        String value = reader.GetString(name);

        if (value == "NONE")
        {
            value = "";
        }
        return(ArrayUInt32Converter(value));
    }
コード例 #10
0
ファイル: SQLiteDB.cs プロジェクト: winpro-ovencode/study
    public List <String> ToListString(SQLiteQuery reader, String name)
    {
        String value = reader.GetString(name);

        if (value == "NONE")
        {
            value = "";
        }
        return(ArrayStringConverter(value));
    }
コード例 #11
0
ファイル: QuizListDao.cs プロジェクト: hanahanaside/QuizBox
	public void UpdateTitle (Quiz quiz) {
		SQLiteDB sqliteDB = OpenDatabase ();
		StringBuilder sb = new StringBuilder ();
		sb.Append ("update quiz_list set ");
		sb.Append (TITLE_FIELD + " = '" + quiz.Title + "' ");
		sb.Append ("where " + ID_FIELD + " = " + quiz.Id + ";");
		SQLiteQuery sqliteQuery = new SQLiteQuery (sqliteDB, sb.ToString ());
		sqliteQuery.Step ();
		sqliteDB.Close ();
	}
コード例 #12
0
ファイル: QuizListDao.cs プロジェクト: hanahanaside/QuizBox
	public void UpdateOrderNumber (Quiz quiz) {
		SQLiteDB sqliteDB = OpenDatabase ();
		StringBuilder sb = new StringBuilder ();
		sb.Append ("update quiz_list set ");
		sb.Append (ORDER_NUMBER_FIELD + " = " + quiz.OrderNumber + " ");
		sb.Append ("where " + ID_FIELD + " = " + quiz.Id + ";");
		SQLiteQuery sqliteQuery = new SQLiteQuery (sqliteDB, sb.ToString ());
		sqliteQuery.Step ();
		sqliteDB.Close ();
	}
コード例 #13
0
    //
    //   INSERT CALLBACKS
    //
    //

    void InsertQueryCreated(SQLiteQuery qr, object state)
    {
        //
        // insert string and blob
        //
        qr.Bind(testString);
        qr.Bind(testBlob);

        // call step asynchronously
        asyncDB.Step(qr, InsertStepInvoked, state);
    }
コード例 #14
0
    protected override void LoadData(SQLiteQuery query, Dictionary <int, DBEffect> dict)
    {
        DBEffect db = new DBEffect();

        db.Id   = query.GetInt("Id");
        db.Path = query.GetString("Path");
        if (!dict.ContainsKey(db.Id))
        {
            dict.Add(db.Id, db);
        }
    }
コード例 #15
0
ファイル: SHBaseTable.cs プロジェクト: shmhlove/LambKebab
    // 유틸 : 로드함수가 종료될때 Reader객체를 초기화하고, 리턴될 수 있도록
    bool?Return(bool?bReturnValue)
    {
        if (null != m_pSQLiteReader)
        {
            m_pSQLiteReader.Release();
        }

        m_pSQLiteReader = null;

        return(bReturnValue);
    }
コード例 #16
0
ファイル: StageDbDao.cs プロジェクト: hanahanaside/JPN
	//全てのレコードのアップデートデートを統一する
	public void UpdateAllUpdateDate (string updateDate) {
		SQLiteDB sqliteDB = OpenDatabase ();
		StringBuilder sb = new StringBuilder ();
		sb.Append ("update " + TABLE_NAME + " set ");
		sb.Append (FIELD_UPDATED_DATE + " = '" + updateDate + "' ");
		MyLog.LogDebug ("sql " + sb.ToString ());
		SQLiteQuery sqliteQuery = new SQLiteQuery (sqliteDB, sb.ToString ());
		sqliteQuery.Step ();
		sqliteQuery.Release ();
		sqliteDB.Close ();
	}
コード例 #17
0
ファイル: RoomDataDao.cs プロジェクト: hanahanaside/Mansion
	public void UpdateItemCount (RoomData roomData) {
		SQLiteDB sqliteDB = OpenDatabase ();
		StringBuilder sb = new StringBuilder ();
		sb.Append ("update " + ROOM_DATA_LIST_TABLE + " ");
		sb.Append ("set " + RoomDataField.ITEM_COUNT + " = " + roomData.ItemCount + " ");
		sb.Append ("where " + RoomDataField.ID + " = " + roomData.Id + ";");
		Debug.Log("sql = "+sb.ToString());
		SQLiteQuery sqliteQuery = new SQLiteQuery (sqliteDB, sb.ToString ());
		sqliteQuery.Step ();
		CloseDatabase (sqliteDB, sqliteQuery);
	}
コード例 #18
0
 // カスタム処理(お好み・必要に合わせて実装しなおしてください) --------------
 virtual public void SelectStepCallback(SQLiteQuery _qr, bool _bStep, object _state)
 {
     if (_bStep)
     {
         pickup_data(_qr);
         m_sqlAsync.Step(_qr, SelectStepCallback, _state);
     }
     else
     {
         m_sqlAsync.Release(_qr, SelectQueryReleased, null);
     }
 }
コード例 #19
0
    public ST_S_PlayerWeaponRec[] GetList_weapon_all_where_idx(int a_idx)
    {
        if (_db == null)
        {
            _db = new SQLiteDB();
        }

        // ST_S_PlayerWeaponRec rec;
        List <ST_S_PlayerWeaponRec> rtnlist = new List <ST_S_PlayerWeaponRec>();

        string filename = GetFileName_DB();

        try
        {
            _db.Open(filename);

            SQLiteQuery qr;
            string      strsql = string.Format(_querySelect_all_where_idx, a_idx); //
            qr = new SQLiteQuery(_db, strsql);
            while (qr.Step())
            {
                ST_S_PlayerWeaponRec rec = new ST_S_PlayerWeaponRec();
                // idx, hero_ix, slot_no, weapon_datacode, up_level, up_dur, up_attack, up_critical_ratio

                rec.idx               = qr.GetInteger("idx");
                rec.hero_ix           = qr.GetInteger("hero_ix");
                rec.slot_no           = qr.GetInteger("slot_no");
                rec.weapon_datacode   = qr.GetString("weapon_datacode");
                rec.up_level          = qr.GetInteger("up_level");
                rec.up_dur            = qr.GetInteger("up_dur");
                rec.up_attack         = qr.GetInteger("up_attack");
                rec.up_critical_ratio = (float)qr.GetDouble("up_critical_ratio");
                rec.upgrade_limit     = qr.GetInteger("upgrade_limit");
                rec.up_attack_speed   = (float)qr.GetDouble("up_attack_speed");
                rec.class_no          = qr.GetInteger("class_no");
                rec.count             = qr.GetInteger("count");

                rtnlist.Add(rec);
            }
            qr.Release();
            _db.Close();
        }
        catch (Exception e)
        {
            if (_db != null)
            {
                _db.Close();
            }
            UnityEngine.Debug.LogError(e.ToString());
        }

        return(rtnlist.ToArray());
    }
コード例 #20
0
ファイル: SQLite.cs プロジェクト: romgerman/Oxide
 public void ExecuteNonQuery(Sql sql, Connection db, Action<int> callback = null)
 {
     var query = new SQLiteQuery
     {
         Sql = sql,
         Connection = db,
         CallbackNonQuery = callback,
         NonQuery = true
     };
     lock (_syncroot) _queue.Enqueue(query);
     _workevent.Set();
 }
コード例 #21
0
ファイル: DBRace.cs プロジェクト: mengtest/skilldemo
    protected override void LoadData(SQLiteQuery query, Dictionary <int, DBRace> dict)
    {
        DBRace db = new DBRace();

        db.Id   = query.GetInt("Id");
        db.Race = (EActorRace)db.Id;
        db.Name = query.GetString("Name");
        if (!dict.ContainsKey(db.Id))
        {
            dict[db.Id] = db;
        }
    }
コード例 #22
0
ファイル: SQLite.cs プロジェクト: thematkon/Oxide
        public void Query(Sql sql, Connection db, Action <List <Dictionary <string, object> > > callback)
        {
            var query = new SQLiteQuery
            {
                Sql        = sql,
                Connection = db,
                Callback   = callback
            };

            lock (_syncroot) _queue.Enqueue(query);
            _workevent.Set();
        }
コード例 #23
0
    //DBへ保存
    public void ReplaceStatus(int _status, int _id)
    {
        //ステータスの上書きのコマンドを設定する 
        string strQuery = "UPDATE " + TABLE_NAME + " SET status = " + _status.ToString() + " WHERE id = " + _id;

        Debug.Log("PurchaseReplaceStatusQuery : " + strQuery);

        //m_sqlDBはDBDataBaseのプロテクト変数
        SQLiteQuery query = new SQLiteQuery(m_sqlDB, strQuery);

        query.Step();       //
        query.Release();    //解放
    }
コード例 #24
0
    //データを取得・格納する関数
    protected override void pickup_data(SQLiteQuery _query)
    {
        Data data = new Data();

        data.id          = _query.GetInteger("id");
        data.spid        = _query.GetString("spid");
        data.receipt     = _query.GetString("receipt");
        data.status      = _query.GetInteger("status");
        data.create_time = _query.GetString("create_time");
        data.update_time = _query.GetString("update_time");
        data_list.Add(data);
        return;
    }
コード例 #25
0
    private Data SetData(SQLiteQuery _query)
    {
        Data data = new Data();

        data.id          = _query.GetInteger("id");
        data.spid        = _query.GetString("spid");
        data.receipt     = _query.GetString("receipt");
        data.status      = _query.GetInteger("status");
        data.create_time = _query.GetString("create_time");
        data.update_time = _query.GetString("update_time");

        return(data);
    }
コード例 #26
0
    private void CreateQueryComplete(object state)
    {
        //Debug.Log( "CreateQueryComplete state=" + state );
        QueryState qrState = state as QueryState;

        // ここで上書きすればいいのか?
        lastSqliteQuery = qrState.Query;

        if (qrState.Callback != null)
        {
            qrState.Callback(qrState.Query, qrState.State);
        }
    }
コード例 #27
0
    protected override void LoadData(SQLiteQuery query, Dictionary <int, DBScene> dict)
    {
        DBScene db = new DBScene();

        db.Id         = query.GetInt("Id");
        db.SceneName  = query.GetString("SceneName");
        db.SceneType  = (ESceneType)query.GetInt("SceneType");
        db.SceneMusic = query.GetString("SceneMusic");
        if (!dict.ContainsKey(db.Id))
        {
            dict.Add(db.Id, db);
        }
    }
コード例 #28
0
ファイル: SQLite.cs プロジェクト: thematkon/Oxide
        public void ExecuteNonQuery(Sql sql, Connection db, Action <int> callback = null)
        {
            var query = new SQLiteQuery
            {
                Sql              = sql,
                Connection       = db,
                CallbackNonQuery = callback,
                NonQuery         = true
            };

            lock (_syncroot) _queue.Enqueue(query);
            _workevent.Set();
        }
コード例 #29
0
ファイル: optionDB.cs プロジェクト: CoderBear/AAUnity
    public void setStatus(int id, int choice)
    {
        string dbFile = Application.persistentDataPath + "/optionDB_playmaker.db";
        SQLiteDB db = new SQLiteDB();

        string query = "UPDATE option_table SET Unlocked = " + choice.ToString() + " WHERE id =" + id.ToString();
        db.Open(dbFile);

        SQLiteQuery qr = new SQLiteQuery(db, query);
        qr.Step();
        qr.Release();
        db.Close();
    }
コード例 #30
0
ファイル: DBPartnerWake.cs プロジェクト: mengtest/skilldemo
    protected override void LoadData(SQLiteQuery query, Dictionary <int, DBPartnerWake> dict)
    {
        DBPartnerWake db = new DBPartnerWake();

        db.Id          = query.GetInt("Id");
        db.Level       = query.GetInt("Level");
        db.CostSoulNum = query.GetInt("CostSoulNum");
        db.Desc        = query.GetString("Desc");
        if (dict.ContainsKey(db.Id))
        {
            dict.Add(db.Id, db);
        }
    }
コード例 #31
0
        public bool ContainKey(string tableName, string key)
        {
            CreateTable(tableName);
            string      sql = @"SELECT COUNT(id) as c FROM " + tableName + " WHERE key = ?";
            SQLiteQuery qr  = new SQLiteQuery(_db, sql);

            qr.Bind(key);
            qr.Step();
            int c = qr.GetInteger("c");

            qr.Release();
            return(c > 0);
        }
コード例 #32
0
    protected override void LoadData(SQLiteQuery query, Dictionary <int, DBActorGroup> dict)
    {
        DBActorGroup db = new DBActorGroup();

        db.Id             = query.GetInt("Id");
        db.ChiefID        = query.GetInt("ChiefID");
        db.Name           = query.GetString("Name");
        db.ChiefActorType = (EActorType)query.GetInt("ChiefActorType");
        if (!dict.ContainsKey(db.Id))
        {
            dict[db.Id] = db;
        }
    }
コード例 #33
0
        /// <summary>
        /// Gets the column maximum value.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="tableName">Name of the table.</param>
        /// <param name="columnName">Name of the column.</param>
        /// <returns></returns>
        public object GetColumnMaxValue <T>(string columnName)
        {
            object           returnValue = null;
            SQLiteDataReader reader      = null;

            try
            {
                Type   type         = typeof(T);
                var    propertyList = type.GetProperties(BindingFlags.Public | BindingFlags.Instance);
                string sqlQuery     = SQLiteQuery.MaxFromTable(type.Name, columnName);
                reader = SQLiteQuery.ExecuteReader(sqlQuery, this.Connection);

                while (reader.Read())
                {
                    returnValue = reader[Constant.MaxValue].ToString();
                }

                var property = propertyList.FirstOrDefault(x => x.Name == columnName);

                if (property != null)
                {
                    if (string.IsNullOrWhiteSpace(returnValue.ToString()))
                    {
                        if (property.PropertyType.IsNumber())
                        {
                            returnValue = 0;
                        }
                        else if (property.PropertyType.IsDateTime())
                        {
                            returnValue = DateTime.MinValue;
                        }
                    }

                    returnValue = Convert.ChangeType(returnValue, property.PropertyType);
                }
            }
            catch (Exception exception)
            {
                APILog.Error(this, "GetColumnMaxValue", exception);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                    reader = null;
                }
            }

            return(returnValue);
        }
コード例 #34
0
    public object   SQLite_TableContentColumnValue(string tableName, string columnName, ELG.SQLITE3_TYPE eColumnType, string excepStr = "")
    {
        if (db == null)
        {
            InitDB();
        }

        db.Close();
        db.Open(db_filenameWithPath);
        SQLiteQuery qr;

        string sStr = "select " + "\"" + columnName + "\"" + " from " + tableName + " " + excepStr + " order by id asc ";

        //Debug.Log("SQLite_TableContent:"+sStr );

        qr = new SQLiteQuery(db, sStr);           // tableName
        //qr.sDebugString

        object Count;

        qr.Step();

        if (eColumnType == ELG.SQLITE3_TYPE.SQLITE_INTEGER)
        {
            Count = (object)qr.GetInteger(columnName);
        }
        else
        if (eColumnType == ELG.SQLITE3_TYPE.SQLITE_TEXT)
        {
            Count = (object)qr.GetString(columnName);
        }
        else
        if (eColumnType == ELG.SQLITE3_TYPE.SQLITE_FLOAT)
        {
            Count = (object)qr.GetDouble(columnName);
        }
        else
        if (eColumnType == ELG.SQLITE3_TYPE.SQLITE_BLOB)
        {
            Count = (object)qr.GetBlob(columnName);
        }
        else
        {
            Count = null;
        }

        qr.Release();
        db.Close();

        return(Count);
    }
コード例 #35
0
ファイル: SHBaseTable.cs プロジェクト: shmhlove/LambKebab
    // 인터페이스 : SQLite파일 로드
    public bool?LoadDB(string strFileName)
    {
        // 예외처리 : 오버라이드 체크
        if (null == LoadDBTable(null, null))
        {
            return(Return(null));
        }

        // 예외처리 : 로드체크
        SHSQLite pSQLite = new SHSQLite(strFileName);

        if (false == pSQLite.CheckDBFile())
        {
            return(Return(false));
        }

        // 예외처리 : 테이블체크
        SQLiteQuery pTableList = pSQLite.GetTable("TableList");

        if (null == pTableList)
        {
            return(Return(false));
        }

        Initialize();

        while (true == pTableList.Step())
        {
            string strTableName = pTableList.GetString("s_Table");
            m_pSQLiteReader = pSQLite.GetTable(strTableName);
            bool?bResult = LoadDBTable(m_pSQLiteReader, strTableName);
            if (null != m_pSQLiteReader)
            {
                m_pSQLiteReader.Release();
                m_pSQLiteReader = null;
            }
            if (null == bResult)
            {
                return(Return(null));
            }
            if (false == bResult.Value)
            {
                return(Return(false));
            }
        }

        pTableList.Release();
        pSQLite.Clear();

        return(Return(true));
    }
コード例 #36
0
        /// <summary>
        /// Selects all rows.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="whereClause">The where clause.</param>
        /// <returns></returns>
        public List <T> SelectAllRows <T>(string whereClause = "") where T : new()
        {
            var objectList          = new List <T>();
            SQLiteDataReader reader = null;

            try
            {
                var objectType = typeof(T);
                var properties = objectType.GetProperties(BindingFlags.Public | BindingFlags.Instance);

                string sqlQuery = SQLiteQuery.SelectAllFrom(objectType.Name, whereClause);
                reader = SQLiteQuery.ExecuteReader(sqlQuery, this.Connection);

                while (reader.Read())
                {
                    var newObject = new T();

                    foreach (var property in properties)
                    {
                        if (property.IsDataMember())
                        {
                            if (reader[property.Name].HaveContent() || property.PropertyType.IsString())
                            {
                                Type type = property.PropertyType;
                                TypeExtension.GetDataType(type, out type);

                                object  propertyValue = reader[property.Name];
                                dynamic changedObject = Convert.ChangeType(propertyValue, type);
                                property.SetValue(newObject, changedObject, null);
                            }
                        }
                    }

                    objectList.Add(newObject);
                }
            }
            catch (Exception exception)
            {
                APILog.Error(this, "SelectAllRows", exception);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                    reader = null;
                }
            }

            return(objectList);
        }
コード例 #37
0
ファイル: DBQuality.cs プロジェクト: mengtest/skilldemo
    protected override void LoadData(SQLiteQuery query, Dictionary <int, DBQuality> dict)
    {
        DBQuality db = new DBQuality();

        db.Quality = query.GetInt("Quality");
        db.Name    = query.GetString("Name");
        db.Icon    = query.GetString("Icon");
        db.Encode  = query.GetString("Encode");
        db.Desc    = query.GetString("Desc");
        if (!dict.ContainsKey(db.Quality))
        {
            dict.Add(db.Quality, db);
        }
    }
コード例 #38
0
    protected override void LoadData(SQLiteQuery query, Dictionary <int, DBCamera> dict)
    {
        DBCamera db = new DBCamera();

        db.Type      = (ECameraType)query.GetInt("Type");
        db.Params    = query.GetString("Params");
        db.LastTime  = query.GetFloat("LastTime");
        db.DelayTime = query.GetFloat("DelayTime");
        db.Name      = query.GetString("Name");
        if (!dict.ContainsKey(db.Id))
        {
            dict.Add(db.Id, db);
        }
    }
コード例 #39
0
ファイル: StatsDB.cs プロジェクト: CoderBear/AAUnity
	public void StoreValue (int id, int a_value)
	{	
		SQLiteQuery qr;
		string query = "UPDATE stats_table SET value = " + a_value.ToString() + " WHERE id =" + id.ToString();
		
		SQLiteDB db = new SQLiteDB ();
		string filename = Application.persistentDataPath + "/statsDB_playmaker.db";
					
		db.Open (filename);
		qr = new SQLiteQuery (db, query);
		qr.Step ();
		qr.Release();
		db.Close ();
	}
コード例 #40
0
    protected override void LoadData(SQLiteQuery query, Dictionary <EProperty, DBProperty> dict)
    {
        DBProperty db = new DBProperty();

        db.Property  = (EProperty)query.GetInt("Id");
        db.Name      = query.GetString("Name");
        db.Factor    = query.GetInt("Factor");
        db.Desc      = query.GetString("Desc");
        db.IsPercent = query.GetBool("IsPercent");
        if (!dict.ContainsKey(db.Property))
        {
            dict.Add(db.Property, db);
        }
    }
コード例 #41
0
	public void Reset ()
	{
		OpenDatabase ();
		mSqliteQuery = new SQLiteQuery (mSqliteDB, "update player_data set "
			+ EVOLUTION_POINT_FIELD + " = 1,"
			+ EXP_POINT_FIELD + " = 0,"
			+ MAIN_GAL_SIZE + " = 0,"
			+ HARAJUKU_GAL_SIZE + " = 0,"
			+ EXIT_TIME + " = 0;"
		);
		mSqliteQuery.Step ();
		mSqliteQuery.Release ();
		CloseDatabase ();
	}
コード例 #42
0
ファイル: StageDbDao.cs プロジェクト: hanahanaside/JPN
	//レコード1行アップデート
	public void UpdateRecord (StageData stage) {
		SQLiteDB sqliteDB = OpenDatabase ();
		StringBuilder sb = new StringBuilder ();
		sb.Append ("update " + TABLE_NAME + " set ");
		sb.Append (FIELD_IDLE_COUNT + " = " + stage.IdolCount + ", ");
		sb.Append (FIELD_FLAG_CONSTRUCTION + " = " + stage.FlagConstruction + ", ");
		sb.Append (FIELD_UPDATED_DATE + " = '" + stage.UpdatedDate + "' ");
		sb.Append ("where " + FIELD_ID + " = " + stage.Id + ";");
		MyLog.LogDebug ("sql " + sb.ToString ());
		SQLiteQuery sqliteQuery = new SQLiteQuery (sqliteDB, sb.ToString ());
		sqliteQuery.Step ();
		sqliteQuery.Release ();
		sqliteDB.Close ();
	}
コード例 #43
0
ファイル: StageDbDao.cs プロジェクト: hanahanaside/JPN
	//IDでステージデータを取得
	public StageData SelectById (int id) {
		SQLiteDB sqliteDB = OpenDatabase ();
		StageData stage = new StageData ();
		StringBuilder sb = new StringBuilder ();
		sb.Append ("select * from " + TABLE_NAME + " ");
		sb.Append ("where " + FIELD_ID + " = " + id + ";");
		SQLiteQuery sqliteQuery = new SQLiteQuery (sqliteDB, sb.ToString ());
		while (sqliteQuery.Step ()) {
			stage = GetStage (sqliteQuery);
		}
		sqliteQuery.Release ();
		sqliteDB.Close ();
		return stage;
	}
コード例 #44
0
    public void StoreValue(int id, int a_value)
    {
        SQLiteQuery qr;
        string      query = "UPDATE stats_table SET value = " + a_value.ToString() + " WHERE id =" + id.ToString();

        SQLiteDB db       = new SQLiteDB();
        string   filename = Application.persistentDataPath + "/statsDB_playmaker.db";

        db.Open(filename);
        qr = new SQLiteQuery(db, query);
        qr.Step();
        qr.Release();
        db.Close();
    }
コード例 #45
0
ファイル: PlayerDB.cs プロジェクト: CoderBear/ARG-Zombies
	public int getDefense() {
		int num = 0;
		string dbFile = Application.persistentDataPath + "/playerDB.db";
		SQLiteDB db = new SQLiteDB ();
		
		db.Open (dbFile);
		SQLiteQuery qr = new SQLiteQuery (db, "SELECT defense FROM player_info WHERE id=1");
		qr.Step ();
		num = qr.GetInteger ("defense");
		qr.Release ();
		db.Close ();
		
		return num;
	}
コード例 #46
0
ファイル: AchieveDB.cs プロジェクト: CoderBear/AAUnity
    public void StoreProgress(int id, int progress)
    {
        string   dbFile = Application.persistentDataPath + "/achieveDB_playmaker.db";
        SQLiteDB db     = new SQLiteDB();

        string query = "UPDATE achieve_table SET Progress = " + progress.ToString() + " WHERE id =" + id.ToString();

        db.Open(dbFile);
        SQLiteQuery qr = new SQLiteQuery(db, query);

        qr.Step();
        qr.Release();
        db.Close();
    }
コード例 #47
0
ファイル: MobDB.cs プロジェクト: CoderBear/ARG-Zombies
	public int getMoney(int id) {
		int num = 0;
		string dbFile = Application.persistentDataPath + "/mobDB.db";
		SQLiteDB db = new SQLiteDB ();
		
		db.Open (dbFile);
		SQLiteQuery qr = new SQLiteQuery (db, "SELECT money FROM mob_info WHERE id=?");
		qr.Bind (id);
		qr.Step ();
		num = qr.GetInteger ("money");
		qr.Release ();
		db.Close ();
		
		return num;
	}
コード例 #48
0
ファイル: StageDbDao.cs プロジェクト: hanahanaside/JPN
	//存在する全てのステージデータを取得
	public List<StageData> SelectAll () {
		List<StageData> stageDataList = new List<StageData> ();
		SQLiteDB sqliteDB = OpenDatabase ();
		StringBuilder sb = new StringBuilder ();
		sb.Append ("select * from " + TABLE_NAME + " ");
		sb.Append ("where " + FIELD_IDLE_COUNT + " != 0;");
		SQLiteQuery sqliteQuery = new SQLiteQuery (sqliteDB, sb.ToString ());
		while (sqliteQuery.Step ()) {
			StageData stage = GetStage (sqliteQuery);
			stageDataList.Add (stage);
		}
		sqliteQuery.Release ();
		sqliteDB.Close ();
		return stageDataList;
	}
コード例 #49
0
ファイル: AchieveDB.cs プロジェクト: CoderBear/AAUnity
	public string getName(int id) {
		string name = "";
		string dbFile = Application.persistentDataPath + "/achieveDB_playmaker.db";
		SQLiteDB db = new SQLiteDB();
		
		db.Open(dbFile);
		SQLiteQuery qr = new SQLiteQuery(db, "SELECT Name FROM achieve_table WHERE id=?");
		qr.Bind(id);
		while (qr.Step()) {
			name = qr.GetString("Name");
		}
		qr.Release();
		db.Close();
		return name;
	}
コード例 #50
0
ファイル: DBSkillTalent.cs プロジェクト: mengtest/skilldemo
    protected override void LoadData(SQLiteQuery query, Dictionary <int, DBSkillTalent> dict)
    {
        DBSkillTalent db = new DBSkillTalent();

        db.Id            = query.GetInt("Id");
        db.Name          = query.GetString("Name");
        db.Pos           = query.GetInt("Pos");
        db.Icon          = query.GetString("Icon");
        db.Layer         = query.GetInt("Layer");
        db.Carrer        = (ECarrer)query.GetInt("Carrer");
        db.Type          = (ESkillTalentType)query.GetInt("TalentSkillType");
        db.TargetSkillId = query.GetInt("TargetSkillId");
        db.Desc          = query.GetString("Desc");
        dict.Add(db.Id, db);
    }
コード例 #51
0
ファイル: RoomDataDao.cs プロジェクト: hanahanaside/Mansion
	public float GetTotalGenerateSpeed () {
		float totalGenerateSpeed = 0.0f;
		SQLiteDB sqliteDB = OpenDatabase ();
		StringBuilder sb = new StringBuilder ();
		sb.Append ("select " + RoomDataField.ITEM_COUNT + ", " + RoomDataField.GENERATE_SPEED + " ");
		sb.Append ("from " + ROOM_DATA_LIST_TABLE + ";");
		Debug.Log("sql = "+sb.ToString());
		SQLiteQuery sqliteQuery = new SQLiteQuery (sqliteDB, sb.ToString ());
		while (sqliteQuery.Step()) {
			int itemCount = sqliteQuery.GetInteger (RoomDataField.ITEM_COUNT);
			float generateSpeed = (float)sqliteQuery.GetDouble (RoomDataField.GENERATE_SPEED);
			totalGenerateSpeed += generateSpeed * itemCount;
		}
		CloseDatabase (sqliteDB, sqliteQuery);
		return totalGenerateSpeed;
	}
コード例 #52
0
ファイル: AchieveDB.cs プロジェクト: CoderBear/AAUnity
	public int getTarget(int id) {
		int num = 0;
		
		string dbFile = Application.persistentDataPath + "/achieveDB_playmaker.db";
		SQLiteDB db = new SQLiteDB();
		
		db.Open(dbFile);
		SQLiteQuery qr = new SQLiteQuery(db, "SELECT Target FROM achieve_table WHERE id=?");
		qr.Bind(id);
		qr.Step();
		num = qr.GetInteger("Target");
		qr.Release();
		db.Close();
		
		return num;
	}
コード例 #53
0
	public IList<HistoryData> QueryHistoryDataList () {
		IList<HistoryData> historyDataList = new List<HistoryData> ();
		SQLiteDB sqliteDB = OpenDB ();
		string sql = "select * from " + TABLE_NAME + ";";
		SQLiteQuery sqliteQuery = new SQLiteQuery (sqliteDB, sql);
		while (sqliteQuery.Step ()) {
			HistoryData historyData = new HistoryData ();
			historyData.id = sqliteQuery.GetInteger (ID_FIELD);
			historyData.Average = sqliteQuery.GetDouble (AVERAGE_FIELD);
			historyData.title = sqliteQuery.GetString (TITLE_FIELD);
			historyData.mode = sqliteQuery.GetString (MODE_FIELD);
			historyData.result = sqliteQuery.GetString (RESULT_FIELD);
			historyData.date = sqliteQuery.GetString (DATE_FIELD);
			historyDataList.Add (historyData);
		}
		return historyDataList;
	}
コード例 #54
0
ファイル: QuizListDao.cs プロジェクト: hanahanaside/QuizBox
	public void UpdateRecord(Quiz quiz){
		SQLiteDB sqliteDB = OpenDatabase ();
		StringBuilder sb = new StringBuilder ();
		sb.Append ("update quiz_list set ");
		sb.Append (TITLE_FIELD + " = '" + quiz.Title + "', ");
		sb.Append (QUIZ_URL_FIELD + " = '" + quiz.QuizUrl + "', ");
		sb.Append (CHALLENGE_QUIZ_DATA_FIELD + " = '" + quiz.ChallengeQuizData + "', ");
		sb.Append (CHALLENGE_QUIZ_COUNT + " = " + quiz.ChallengeQuizCount + ", ");
		sb.Append (CHALLENGE_QUIZ_CORRECT + " = " + quiz.ChallengeQuizCount + ", ");
		sb.Append (BOUGHT_DATE_FIELD + " = '" + quiz.BoughtDate + "', ");
		sb.Append (QUIZ_ID_FIELD + " = " + quiz.QuizId+ ", ");
		sb.Append (ORDER_NUMBER_FIELD + " = " + quiz.OrderNumber + " ");
		sb.Append ("where " + ID_FIELD + " = " + quiz.Id + ";");
		SQLiteQuery sqliteQuery = new SQLiteQuery (sqliteDB, sb.ToString ());
		sqliteQuery.Step ();
		sqliteDB.Close ();
	}
コード例 #55
0
ファイル: EnemyDataDao.cs プロジェクト: hanahanaside/Mansion
	public List<EnemyData> QueryEnemyDataList(){
		SQLiteDB sqliteDB = OpenDatabase ();
		string sql = "select * from " + ENEMY_DATA_LIST_TABLE +  ";";
		Debug.Log("sql = "+ sql);
		SQLiteQuery sqliteQuery = new SQLiteQuery (sqliteDB, sql);
		List<EnemyData> enemyDataList = new List<EnemyData>();
		while(sqliteQuery.Step()){
			EnemyData enemyData = new EnemyData ();
			enemyData.Id = sqliteQuery.GetInteger (EnemyDataField.ID);
			enemyData.Name = sqliteQuery.GetString (EnemyDataField.NAME);
			enemyData.Description = sqliteQuery.GetString (EnemyDataField.DESCRIPTION);
			enemyData.Atack = sqliteQuery.GetInteger (EnemyDataField.ATACK);
			enemyDataList.Add(enemyData);
		}
		CloseDatabase(sqliteDB,sqliteQuery);
		return enemyDataList;
	}
コード例 #56
0
ファイル: AchieveDB.cs プロジェクト: CoderBear/AAUnity
	public string getDesc(int id) {
		string description = "";
		
		string dbFile = Application.persistentDataPath + "/achieveDB_playmaker.db";
		SQLiteDB db = new SQLiteDB();
		
		db.Open(dbFile);
		SQLiteQuery qr = new SQLiteQuery(db, "SELECT Description FROM achieve_table WHERE id=?");
		qr.Bind(id);
		while (qr.Step()) {
			description = qr.GetString("Description");
		}
		qr.Release();
		db.Close();
		
		return description;
	}
コード例 #57
0
ファイル: StatsDB.cs プロジェクト: CoderBear/AAUnity
	public int getValue (string name)
	{
		int num = 0;
		string filename = Application.persistentDataPath + "/statsDB_playmaker.db";
					
		SQLiteDB db = new SQLiteDB ();
		SQLiteQuery qr;
		string query = "SELECT value FROM stats_table WHERE name =?";
		db.Open (filename);
		qr = new SQLiteQuery (db, query);
		qr.Bind (name);
		qr.Step ();
		num = qr.GetInteger ("value");
		qr.Release ();
		db.Close ();
		
		return num;
	}
コード例 #58
0
	public Hashtable getBandmanData(int evolutionPoint){
		OpenDatabase();
		mSqliteQuery  = new SQLiteQuery (mSqliteDB, "select * from charactor_list where id = "+evolutionPoint + ";");
		Hashtable bandmanData = new Hashtable();
		while(mSqliteQuery.Step()){
			string name = mSqliteQuery.GetString(NAME_FIELD);
			int expPoint = mSqliteQuery.GetInteger(EXP_POINT_FIELD);
			string description = mSqliteQuery.GetString(DESCRIPTION_FIELD);
			int flagTweet = mSqliteQuery.GetInteger(FLAG_TWEET_FIELD);
			bandmanData.Add(NAME_FIELD,name);
			bandmanData.Add(EXP_POINT_FIELD,expPoint);
			bandmanData.Add(DESCRIPTION_FIELD,description);
			bandmanData.Add(FLAG_TWEET_FIELD,flagTweet);
		}
		mSqliteQuery.Release ();
		CloseDatabase();
		return bandmanData;
	}
コード例 #59
0
ファイル: RoomDataDao.cs プロジェクト: hanahanaside/Mansion
	public List<RoomData> GetRoomDataList () {
		SQLiteDB sqliteDB = OpenDatabase ();
		string sql = "select * from " + ROOM_DATA_LIST_TABLE + ";";
		Debug.Log("sql = "+ sql);
		SQLiteQuery sqliteQuery = new SQLiteQuery (sqliteDB, sql);
		List<RoomData> roomDataList = new List<RoomData> ();
		while (sqliteQuery.Step()) {
			RoomData roomData = new RoomData ();
			roomData.Id = sqliteQuery.GetInteger (RoomDataField.ID);
			roomData.ItemCount = sqliteQuery.GetInteger (RoomDataField.ITEM_COUNT);
			roomData.ItemPrice = sqliteQuery.GetInteger (RoomDataField.PRICE);
			roomData.GenerateSpeed = (float)sqliteQuery.GetDouble (RoomDataField.GENERATE_SPEED);
			roomData.ItemName = sqliteQuery.GetString (RoomDataField.NAME);
			roomData.ItemDescription = sqliteQuery.GetString (RoomDataField.DESCRIPTION);
			roomDataList.Add (roomData);
		}
		CloseDatabase (sqliteDB, sqliteQuery);
		return roomDataList;
	}
コード例 #60
0
		void QueryComplete(SQLiteQuery qr, object state)
		{
			query = qr;
			if(qr == null)
			{
				Fsm.Event(onFail);
			}
			else
			{
				foreach( FsmStateAction action in State.Actions )
				{
					SQLiteBindInteger bindInt = action as SQLiteBindInteger;
					if(bindInt != null)
					{
						query.Bind(bindInt.integerValue.Value);
					}
					
					SQLiteBindBool bindBool = action as SQLiteBindBool;
					if(bindBool != null)
					{
						query.Bind(bindBool.boolValue.Value ? 1:0);
					}
					
					SQLiteBindFloat bindFloat = action as SQLiteBindFloat;
					if(bindFloat != null)
					{
						query.Bind((double)bindFloat.floatValue.Value);
					}
					
					SQLiteBindString bindStr = action as SQLiteBindString;
					if(bindStr != null)
					{
						query.Bind(bindStr.stringValue.Value);
					}
				}
				
				taskCtrl = SQLiteManager.Instance.GetSQLiteAsync(shortcutName.Value).Step(query,StepComplete,null);
			}
		}