Пример #1
0
        void Start()
        {
            SqliteCore db = new SqliteCore("data source=" + Application.streamingAssetsPath + "/" + "trafficsystem.db");

            //		db.ExecuteQuery ("DELETE FROM NODE_INFO");

            //		db.ExecuteQuery (string.Format ("INSERT INTO NODE_INFO VALUES ({0},{1},{2})",
            //			2, "'(xfdsfds)'", 24));

            //		SqliteDataReader sqReader = db.ExecuteQuery ("SELECT * FROM NODE_INFO");
            //		while (sqReader.Read ()) {
            //			Debug.Log (sqReader.GetInt32 (sqReader.GetOrdinal ("node_id")).ToString () + sqReader.GetString (sqReader.GetOrdinal ("node_pos"))
            //			+ sqReader.GetInt32 (sqReader.GetOrdinal ("parent_lane_id")));
            //		}

            ////		db.CreateTable ("momo", new string[]{ "name", "qq", "email", "blog" }, new string[]{ "text", "text", "text", "text" });
            ////		db.InsertInfo ("momo", new string[]{ "'宣雨松'", "'289187120'", "'*****@*****.**'", "'www.xuanyusong.com'"   });
            //		db.UpdateInfo ("momo", new string[]{ "name", "qq" }, new string[]{ "'xuanyusong'", "'11111111'" }, "email", "'*****@*****.**'");
            //		db.Delete ("momo", new string[]{ "email", "email" }, new string[]{ "'*****@*****.**'", "'*****@*****.**'" });
            //
            ////		db.InsertInfo("momo", new string[]{ "'宣雨松'","'289187120'","'*****@*****.**'","'www.xuanyusong.com'"   });
            //		db.InsertInfo ("momo", new string[]{ "'雨松MOMO'", "'289187120'", "'*****@*****.**'", "'www.xuanyusong.com'"   });
            //		db.InsertInfo ("momo", new string[]{ "'哇咔咔'", "'289187120'", "'*****@*****.**'", "'www.xuanyusong.com'"   });
            //
            //		db.Delete ("momo", new string[]{ "email", "email" }, new string[]{ "'*****@*****.**'", "'*****@*****.**'" });
            //
            //		SqliteDataReader sqReader = db.SelectWhere ("momo", new string[]{ "name", "email" }, new string[]{ "qq" }, new string[]{ "=" }, new string[]{ "289187120" });
            //
            //		while (sqReader.Read ()) {
            //			Debug.Log (sqReader.GetString (sqReader.GetOrdinal ("name")) + sqReader.GetString (sqReader.GetOrdinal ("email")));
            //		}

            db.CloseSqlConnection();
        }
Пример #2
0
        public void Save(string path)
        {
            SqliteCore db = new SqliteCore("data source=" + path);

            db.ExecuteQuery("DELETE FROM LINK_INFO");

            foreach (LinkInfoRecord record in linkInfoRecords)
            {
                db.ExecuteQuery(string.Format("INSERT INTO LINK_INFO VALUES ({0},{1},{2})",
                                              record.fromId, record.toId, record.distance));
            }

            db.CloseSqlConnection();
        }
Пример #3
0
        public void Save(string path)
        {
            SqliteCore db = new SqliteCore("data source=" + path);

            db.ExecuteQuery("DELETE FROM BUILDER_NODE");

            foreach (BuilderNodeRecord record in builderNodeRecords)
            {
                db.ExecuteQuery(string.Format("INSERT INTO BUILDER_NODE VALUES ({0},{1},{2},{3})",
                                              record.id, "'" + record.position + "'", "'" + record.rotation + "'", record.type));
                Debug.Log(record.id + record.position + record.rotation);
            }

            db.CloseSqlConnection();
        }
Пример #4
0
        public void Load(string path)
        {
            SqliteCore db = new SqliteCore("data source=" + path);

            linkInfoRecords.Clear();

            SqliteDataReader sqReader = db.ExecuteQuery("SELECT * FROM LINK_INFO");

            while (sqReader.Read())
            {
                int            _from     = sqReader.GetInt32(sqReader.GetOrdinal("from_id"));
                int            _to       = sqReader.GetInt32(sqReader.GetOrdinal("to_id"));
                int            _distance = sqReader.GetInt32(sqReader.GetOrdinal("distance"));
                LinkInfoRecord newRecord = new LinkInfoRecord(_from, _to, _distance);
                linkInfoRecords.Add(newRecord);
            }

            db.CloseSqlConnection();
        }
Пример #5
0
        public void Load(string path)
        {
            SqliteCore db = new SqliteCore("data source=" + path);

            builderNodeRecords.Clear();

            SqliteDataReader sqReader = db.ExecuteQuery("SELECT * FROM BUILDER_NODE");

            while (sqReader.Read())
            {
                int               _id       = sqReader.GetInt32(sqReader.GetOrdinal("id"));
                string            _position = sqReader.GetString(sqReader.GetOrdinal("position"));
                string            _rotation = sqReader.GetString(sqReader.GetOrdinal("rotation"));
                int               _type     = sqReader.GetInt32(sqReader.GetOrdinal("type"));
                BuilderNodeRecord newRecord = new BuilderNodeRecord(_id, _position, _rotation, _type);
                builderNodeRecords.Add(newRecord);
            }

            db.CloseSqlConnection();
        }