【发布时间】:2010-07-15 13:36:03
【问题描述】:
我想在 Oracle 数据库中存储一个 64 字节的短数组(密码哈希)。我认为char(64 byte) 是我需要的,但它似乎不起作用。在 Microsoft SQL 中,我使用 binary 和 varbinary 类型。我需要在 Oracle 中使用什么类型?
我发现的每个示例都使用blob 来存储二进制数据,但我认为blob 仅适用于大型对象,而不适用于固定大小的短数组。
更新数据时,这样的代码是否合适:
byte[] passwordHash = GenerateHash();
using (OracleCommand updateHash = new OracleCommand("update A set passwordHash = :hash where EntryId = :id", oracleConnection))
{
updateHash.Parameters.Add(":hash", passwordHash);
updateHash.Parameters.Add(":id", entryId);
if (updateHash.ExecuteNonQuery() != 1)
{
// ...
}
}
还是我遗漏了什么,不能像这样添加字节数组参数?
【问题讨论】: