本文整理汇总了C#中SQLite.Net.Tests.TestDb.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# TestDb.Execute方法的具体用法?C# TestDb.Execute怎么用?C# TestDb.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLite.Net.Tests.TestDb
的用法示例。
在下文中一共展示了TestDb.Execute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateQueryWithNullThrowsException
public void UpdateQueryWithNullThrowsException()
{
// Skip this test if the Dll doesn't support the extended SQLITE_CONSTRAINT codes
using (TestDb db = new TestDb())
{
db.CreateTable<NotNullNoPK>();
try
{
db.Execute("insert into \"NotNullNoPK\" (AnotherRequiredStringProp, RequiredIntProp, RequiredStringProp) values(?, ?, ?)",
new object[] { "Another required string", 123, "Required string" });
db.Execute("update \"NotNullNoPK\" set AnotherRequiredStringProp=?, RequiredIntProp=?, RequiredStringProp=? where ObjectId=?",
new object[] { "Another required string", 123, null, 1 });
}
catch (NotNullConstraintViolationException)
{
return;
}
catch (SQLiteException ex)
{
if (db.Platform.SQLiteApi.LibVersionNumber() < 3007017 && ex.Result == Result.Constraint)
{
Assert.Inconclusive("Detailed constraint information is only available in SQLite3 version 3.7.17 and above.");
}
}
catch (Exception ex)
{
Assert.Fail("Expected an exception of type NotNullConstraintViolationException to be thrown. An exception of type {0} was thrown instead.", ex.GetType().Name);
}
Assert.Fail("Expected an exception of type NotNullConstraintViolationException to be thrown. No exception was thrown.");
}
}