为什么 SQLite 命令在 Unity 中不起作用?
Why that SQLite command does not work in Unity?
如果此命令在 Sqlite 中为 运行,则可以正常工作。但是,如果您从 Unity 尝试,则会发生错误。
'''
IDbCommand command = dbConnection.CreateCommand();
command.CommandText = @"
UPDATE AnotherTable SET V1 = (SELECT Intelligence from Table1
where AnotherTable.id in (
select AnotherTable.id from AnotherTable
inner join Table1 on AnotherTable.id = Table1.Id
WHERE AnotherTable.V2 = 0 and AnotherTable.V1 = "") and
Table1.Id = AnotherTable.Id) where id in(
select AnotherTable.id from AnotherTable
inner join Table1 on AnotherTable.id = Table1.Id
WHERE AnotherTable.V2 = 0 and AnotherTable.V1 = "");
";
command.ExecuteNonQuery();
command.Dispose();
base.SetCubicsGreenField();
'''
错误文本:
'''
SQL logic error
near ";": syntax error; at System.Data.SQLite.SQLite3.Prepare (System.Data.SQLite.SQLiteConnection cnn, System.String strSql, System.Data.SQLite.SQLiteStatement previous, System.UInt32 timeoutMS, System.String& strRemain) [0x003d4] in ..
'''
而不是空引号,使用:
length(let) = 0
如果此命令在 Sqlite 中为 运行,则可以正常工作。但是,如果您从 Unity 尝试,则会发生错误。
'''
IDbCommand command = dbConnection.CreateCommand();
command.CommandText = @"
UPDATE AnotherTable SET V1 = (SELECT Intelligence from Table1
where AnotherTable.id in (
select AnotherTable.id from AnotherTable
inner join Table1 on AnotherTable.id = Table1.Id
WHERE AnotherTable.V2 = 0 and AnotherTable.V1 = "") and
Table1.Id = AnotherTable.Id) where id in(
select AnotherTable.id from AnotherTable
inner join Table1 on AnotherTable.id = Table1.Id
WHERE AnotherTable.V2 = 0 and AnotherTable.V1 = "");
";
command.ExecuteNonQuery();
command.Dispose();
base.SetCubicsGreenField();
'''
错误文本:
'''
SQL logic error
near ";": syntax error; at System.Data.SQLite.SQLite3.Prepare (System.Data.SQLite.SQLiteConnection cnn, System.String strSql, System.Data.SQLite.SQLiteStatement previous, System.UInt32 timeoutMS, System.String& strRemain) [0x003d4] in ..
'''
而不是空引号,使用:
length(let) = 0