本文整理汇总了C#中Table.Update方法的典型用法代码示例。如果您正苦于以下问题:C# Table.Update方法的具体用法?C# Table.Update怎么用?C# Table.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table
的用法示例。
在下文中一共展示了Table.Update方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update_Sem_Where
public void Update_Sem_Where()
{
ITable users = new Table("users");
users.Update(new
{
ativo=true
});
string sql_expected = "UPDATE users SET [email protected]_ativo_1";
Assert.AreEqual(sql_expected, users.ToSql());
}
示例2: Update_Com_Where
public void Update_Com_Where()
{
var users = new Table("users");
users.Update(new
{
ativo=true,
salario=500
})
.Where(users["idade"] > 20);
string sql_expected = "UPDATE users SET [email protected]_ativo_1, [email protected]_salario_1 WHERE users.idade > @users_idade_1";
Assert.AreEqual(sql_expected, users.ToSql());
}
示例3: UpdateFields
private static void UpdateFields(Table table)
{
foreach (var r in table.Search("*", "", RowInstance.Unique))
{
if (!r.IsNull(OldCoda1))
{
r.SetInteger(NewCoda2, GetCoda2Value(r.GetInteger(OldCoda1)));
table.Update(r);
}
if (!r.IsNull(OldCoda3))
{
try
{
r.SetString(NewCoda4, GetCoda4Value(r.GetString(OldCoda3)));
}
catch (Exception ex)
{
_log($"Error retrieving {OldCoda3}: {ex.Message}");
}
}
}
}
示例4: WriteTable
private static void WriteTable(BinaryWriter Writer, Table Data)
{
/*
* Write:
* Header
* Schema
* SortKey
* Record Collection
*/
// Update //
Data.Update();
// Write header //
BinarySerializer.WriteRecord(Writer, Data.Header);
// Write columns //
BinarySerializer.WriteRecords(Writer, Data.Columns._Cache);
// Write sort key //
BinarySerializer.WriteRecord(Writer, Data.SortBy.ToRecord());
// Write cache //
BinarySerializer.WriteRecords(Writer, Data.ReferenceTable._Cache);
}
示例5: FlushTable
public static void FlushTable(Table Data)
{
// Update the header //
Data.Update();
// Get the size //
int size = EstimateSize(Data);
// Memory //
byte[] memory = new byte[size];
// Create a file stream //
using (FileStream fs = File.Create(Data.Header.Path))
{
int location = BinarySerializer.WriteTableSafe4(memory, 0, Data);
fs.Write(memory, 0, location);
}
// Increment writes //
_DISK_WRITES++;
}
示例6: WriteTableSafe4
private static int WriteTableSafe4(byte[] Mem, int Location, Table Data)
{
/*
* Write:
* Header
* Schema
* SortKey
* Record Collection
*/
// Update the data //
Data.Update();
// Write header //
Location = BinarySerializer.WriteRecordSafe4(Mem, Location, Data.Header);
//Console.WriteLine("Header Terminator: {0}", Location);
// Write columns //
Location = BinarySerializer.WriteRecordsSafe4(Mem, Location, Data.Columns._Cache);
//Console.WriteLine("Schema Terminator: {0}", Location);
// Write sort key //
Location = BinarySerializer.WriteRecordSafe4(Mem, Location, Data.SortBy.ToRecord());
//Console.WriteLine("Keys Terminator: {0}", Location);
// Write cache //
Location = BinarySerializer.WriteRecordsSafe4(Mem, Location, Data.ReferenceTable._Cache);
//Console.WriteLine("Data Terminator: {0}", Location);
return Location;
}
示例7: UpdateTable
public void UpdateTable(Table t)
{
t.Update();
this.SetHashtableValue(t);
}