[펌] Sqlite Insert 속도 문제시
Unity3D/Tips / 2020. 8. 5. 18:25
using System;
using Mono.Data.Sqlite;
public class Example
{
static void Main()
{
string cs = "URI=file:test.db";
using (SqliteConnection con = new SqliteConnection(cs))
{
con.Open();
using(SqliteTransaction tr = con.BeginTransaction())
{
using (SqliteCommand cmd = con.CreateCommand())
{
cmd.Transaction = tr;
cmd.CommandText = "DROP TABLE IF EXISTS Friends";
cmd.ExecuteNonQuery();
cmd.CommandText = @"CREATE TABLE Friends(Id INTEGER PRIMARY KEY,
Name TEXT)";
cmd.ExecuteNonQuery();
cmd.CommandText = "INSERT INTO Friends(Name) VALUES ('Tom')";
cmd.ExecuteNonQuery();
cmd.CommandText = "INSERT INTO Friends(Name) VALUES ('Rebecca')";
cmd.ExecuteNonQuery();
cmd.CommandText = "INSERT INTO Friends(Name) VALUES ('Jim')";
cmd.ExecuteNonQuery();
cmd.CommandText = "INSERT INTO Friends(Name) VALUES ('Robert')";
cmd.ExecuteNonQuery();
cmd.CommandText = "INSERT INTO Friends(Name) VALUES ('Julian')";
cmd.ExecuteNonQuery();
cmd.CommandText = "INSERT INTO Friends(Name) VALUES ('Jane')";
cmd.ExecuteNonQuery();
}
tr.Commit();
}
con.Close();
}
}
}
출처: https://unsigned.tistory.com/entry/Sqlite-Insert-속도-문제시 [공부하자 공부공부]
반응형
'Unity3D > Tips' 카테고리의 다른 글
[Tip] Unity2018 -> Unity2019로 갈 때 obsolate 관련 처리 (1) | 2020.10.06 |
---|---|
[펌] Automatically set Hindi language in Unity (0) | 2020.09.15 |
[펌] [Unity] Android keystore 경로 상대경로로 지정하기 (0) | 2020.06.09 |
[링크] 유니티 프로모션용 영상/동영상 촬영 (0) | 2020.04.03 |
[펌] Unity Editor Play 중 소스 수정 시, Recomplie 여부 옵션 (0) | 2020.02.14 |