Example #1
0
        public SQLiteTester()
        {
            //SQLiteClient.CreateDB(TestFilename);
            dbClient = new SQLiteClient();
            dbClient.Open(TestFilename);

            if (!dbClient.ExistTable("Member"))
            {
                GDebug.Log(dbClient.CreateTable("Member",
                                                new SQLiteFieldAffinity(TypeAffinity.Text, "ID"),
                                                new SQLiteFieldAffinity(TypeAffinity.Text, "PW")));
            }

            var resultDataSet = dbClient.ExecuteDataset("SELECT * FROM Member WHERE PW LIKE '%345%'");

            GDebug.Log("Result " + resultDataSet.Tables[0].Rows[1][0]);
            object result = dbClient.ExecuteScalar("SELECT PW FROM Member WHERE ID='isg1153'");

            if (result != null)
            {
                string foundPw = result as string;
                GDebug.Log(foundPw);
            }
            else
            {
                GDebug.Log(dbClient.InsertRow("Member",
                                              new SQLiteField("ID", DbType.String, "isg1153"),
                                              new SQLiteField("PW", DbType.String, "123456")));
            }

            dbClient.Close();
        }