本文整理汇总了C#中CUBRID.Data.CUBRIDClient.CUBRIDConnection.DropElementInSet方法的典型用法代码示例。如果您正苦于以下问题:C# CUBRIDConnection.DropElementInSet方法的具体用法?C# CUBRIDConnection.DropElementInSet怎么用?C# CUBRIDConnection.DropElementInSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUBRID.Data.CUBRIDClient.CUBRIDConnection
的用法示例。
在下文中一共展示了CUBRIDConnection.DropElementInSet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test_SetOperations
/// <summary>
/// Test SET operations
/// </summary>
private static void Test_SetOperations()
{
using (CUBRIDConnection conn = new CUBRIDConnection())
{
conn.ConnectionString = TestCases.connString;
conn.Open();
TestCases.ExecuteSQL("DROP TABLE IF EXISTS t", conn);
//Create a new table with a collection
TestCases.ExecuteSQL("CREATE TABLE t(s SET(int))", conn);
//Insert some data in the sequence column
TestCases.ExecuteSQL("INSERT INTO t(s) VALUES({0,1,2,3,4,5,6})", conn);
CUBRIDOid oid = new CUBRIDOid("@0|0|0");
using (CUBRIDCommand cmd = new CUBRIDCommand("SELECT t FROM t", conn))
{
using (DbDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
oid = (CUBRIDOid)reader[0];
}
}
}
String attributeName = "s";
object value = 7;
int SeqSize = conn.GetCollectionSize(oid, attributeName);
Debug.Assert(SeqSize == 7);
conn.AddElementToSet(oid, attributeName, value);
SeqSize = conn.GetCollectionSize(oid, attributeName);
Debug.Assert(SeqSize == 8);
using (CUBRIDCommand cmd = new CUBRIDCommand("SELECT * FROM t", conn))
{
using (DbDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
int[] expected = { 0, 1, 2, 3, 4, 5, 6, 7 };
object[] o = (object[])reader[0];
for (int i = 0; i < SeqSize; i++)
{
Debug.Assert(Convert.ToInt32(o[i]) == expected[i]);
}
}
}
}
conn.DropElementInSet(oid, attributeName, 5);
SeqSize = conn.GetCollectionSize(oid, attributeName);
Debug.Assert(SeqSize == 7);
using (CUBRIDCommand cmd = new CUBRIDCommand("SELECT * FROM t", conn))
{
using (DbDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
int[] expected = { 0, 1, 2, 3, 4, 6, 7 };
object[] o = (object[])reader[0];
for (int i = 0; i < SeqSize; i++)
{
Debug.Assert(Convert.ToInt32(o[i]) == expected[i]);
}
}
}
}
TestCases.ExecuteSQL("DROP t", conn);
}
}