本文整理汇总了C#中Mono.Data.Sqlite.SqliteDataReader.IsDBNull方法的典型用法代码示例。如果您正苦于以下问题:C# SqliteDataReader.IsDBNull方法的具体用法?C# SqliteDataReader.IsDBNull怎么用?C# SqliteDataReader.IsDBNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Data.Sqlite.SqliteDataReader
的用法示例。
在下文中一共展示了SqliteDataReader.IsDBNull方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DecodePrivateKey
AsymmetricKeyParameter DecodePrivateKey(SqliteDataReader reader, int column, ref byte[] buffer)
{
if (reader.IsDBNull (column))
return null;
int nread = ReadBinaryBlob (reader, column, ref buffer);
return DecryptAsymmetricKeyParameter (buffer, nread);
}
示例2: GetUserFromReader
/// <summary>
/// A helper function that takes the current row from the SqliteDataReader
/// and hydrates a MembershipUser from the values. Called by the
/// MembershipUser.GetUser implementation.
/// </summary>
/// <param name="reader">SqliteDataReader object</param>
/// <returns>MembershipUser object</returns>
MembershipUser GetUserFromReader(SqliteDataReader reader)
{
object providerUserKey = reader.GetValue(0);
string username = reader.GetString(1);
string email = string.Empty;
if (!reader.IsDBNull(2))
email = reader.GetString(2);
string passwordQuestion = string.Empty;
if (!reader.IsDBNull(3))
passwordQuestion = reader.GetString(3);
string comment = string.Empty;
if (!reader.IsDBNull(4))
comment = reader.GetString(4);
bool isApproved = reader.GetBoolean(5);
bool isLockedOut = reader.GetBoolean(6);
DateTime creationDate = reader.GetDateTime(7);
DateTime lastLoginDate = new DateTime();
if (!reader.IsDBNull(8))
lastLoginDate = reader.GetDateTime(8);
DateTime lastActivityDate = reader.GetDateTime(9);
DateTime lastPasswordChangedDate = reader.GetDateTime(10);
DateTime lastLockedOutDate = new DateTime();
if (!reader.IsDBNull(11))
lastLockedOutDate = reader.GetDateTime(11);
MembershipUser u = new MembershipUser(this.Name,
username,
providerUserKey,
email,
passwordQuestion,
comment,
isApproved,
isLockedOut,
creationDate,
lastLoginDate,
lastActivityDate,
lastPasswordChangedDate,
lastLockedOutDate);
return u;
}
示例3: DecodeEncryptionAlgorithms
static EncryptionAlgorithm[] DecodeEncryptionAlgorithms(SqliteDataReader reader, int column)
{
if (reader.IsDBNull (column))
return null;
var algorithms = new List<EncryptionAlgorithm> ();
var values = reader.GetString (column);
foreach (var token in values.Split (new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) {
EncryptionAlgorithm algorithm;
if (Enum.TryParse (token.Trim (), out algorithm))
algorithms.Add (algorithm);
}
return algorithms.ToArray ();
}
示例4: DataReturn
/// <summary>
/// 返回一個資料串
/// </summary>
public string DataReturn(SqliteDataReader data)
{
string database = "";
for (int i = 0; i < data.FieldCount; i++) {
// 資料是否為空
switch (data.IsDBNull(i)) {
case true:
switch (data.GetDataTypeName(i)){
case "TEXT":
database += "" + ",";
break;
case "INTEGER":
database += "" + 0 + ",";
break;
case "REAL":
database += "" + 0 + ",";
break;
default:
Debug.LogError("類型缺失");
return database;
}
break;
case false:
switch (data.GetDataTypeName(i)) {
case "TEXT":
database += data.GetString(i) + ",";
break;
case "INTEGER":
database += "" + data.GetInt32(i) + ",";
break;
case "REAL":
database += "" + data.GetFloat(i) + ",";
break;
default:
Debug.LogError("類型缺失");
return database;
}
break;
}
}
return database;
}
示例5: RecordFromReader
private static Record RecordFromReader(SqliteDataReader reader)
{
return new Record(
reader.GetString(RecordColumns.KEY_IDX),
reader.IsDBNull(RecordColumns.VALUE_IDX) ? null : reader.GetString(RecordColumns.VALUE_IDX),
reader.GetInt32(RecordColumns.SYNC_COUNT_IDX),
new DateTime(long.Parse(reader.GetString(RecordColumns.LAST_MODIFIED_TIMESTAMP_IDX), CultureInfo.InvariantCulture.NumberFormat), DateTimeKind.Utc),
reader.IsDBNull(RecordColumns.LAST_MODIFIED_BY_IDX) ? string.Empty : reader.GetString(RecordColumns.LAST_MODIFIED_BY_IDX),
new DateTime(long.Parse(reader.GetString(RecordColumns.DEVICE_LAST_MODIFIED_TIMESTAMP_IDX), CultureInfo.InvariantCulture.NumberFormat), DateTimeKind.Utc),
reader.GetInt32(RecordColumns.MODIFIED_IDX) == 1);
}
示例6: DatasetMetadataFromReader
private static DatasetMetadata DatasetMetadataFromReader(SqliteDataReader reader)
{
return new DatasetMetadata(
reader.GetString(DatasetColumns.DATASET_NAME_IDX) ?? string.Empty,
new DateTime(long.Parse(reader.GetString(DatasetColumns.CREATION_TIMESTAMP_IDX), CultureInfo.InvariantCulture.NumberFormat), DateTimeKind.Utc),
new DateTime(long.Parse(reader.GetString(DatasetColumns.LAST_MODIFIED_TIMESTAMP_IDX), CultureInfo.InvariantCulture.NumberFormat), DateTimeKind.Utc),
reader.IsDBNull(DatasetColumns.LAST_MODIFIED_BY_IDX) ? string.Empty : reader.GetString(DatasetColumns.LAST_MODIFIED_BY_IDX),
reader.GetInt32(DatasetColumns.STORAGE_SIZE_BYTES_IDX),
reader.GetInt32(DatasetColumns.RECORD_COUNT_IDX));
}
示例7: GetSafeString
public string GetSafeString(SqliteDataReader reader, int index)
{
if (reader.IsDBNull(index))
return string.Empty;
else
return reader.GetString(index);
}