本文整理汇总了C#中OracleDataReader.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# OracleDataReader.GetValue方法的具体用法?C# OracleDataReader.GetValue怎么用?C# OracleDataReader.GetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OracleDataReader
的用法示例。
在下文中一共展示了OracleDataReader.GetValue方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: loadCurrentUserDirectRoleGrant
public static RoleGrant loadCurrentUserDirectRoleGrant(OracleDataReader odr)
{
string username;
string grantedRole;
bool adminOption;
bool defaultRole;
bool directGrant;
if (odr.IsDBNull(odr.GetOrdinal("username")) ||
odr.IsDBNull(odr.GetOrdinal("granted_role")))
return null;
username = odr.GetString(odr.GetOrdinal("username"));
if (username.Equals("PUBLIC"))
directGrant = false;
else
directGrant = true;
grantedRole = odr.GetString(odr.GetOrdinal("granted_role"));
adminOption = RoleGrant.ParseAdminOption(odr.GetValue(odr.GetOrdinal("admin_option")));
defaultRole = RoleGrant.ParseDefaultRole(odr.GetValue(odr.GetOrdinal("default_role")));
return new RoleGrant(username, grantedRole, adminOption, defaultRole, directGrant);
}
示例2: loadDbaRoleGrant
public static RoleGrant loadDbaRoleGrant(OracleDataReader odr)
{
string grantee;
string grantedRole;
bool adminOption;
bool defaultRole;
if (odr.IsDBNull(odr.GetOrdinal("grantee")) ||
odr.IsDBNull(odr.GetOrdinal("granted_role")))
return null;
grantee = odr.GetString(odr.GetOrdinal("grantee"));
grantedRole = odr.GetString(odr.GetOrdinal("grantedRole"));
adminOption = RoleGrant.ParseAdminOption(odr.GetValue(odr.GetOrdinal("admin_option")));
defaultRole = RoleGrant.ParseDefaultRole(odr.GetValue(odr.GetOrdinal("default_role")));
return new RoleGrant(grantee, grantedRole, adminOption, defaultRole, true);
}
示例3: loadCurrentUserAccessibleRoleGrant
public static RoleGrant loadCurrentUserAccessibleRoleGrant(OracleDataReader odr)
{
string role;
string grantedRole;
bool adminOption;
bool directGrant = true;
if (odr.IsDBNull(odr.GetOrdinal("role")) ||
odr.IsDBNull(odr.GetOrdinal("granted_role")))
return null;
role = odr.GetString(odr.GetOrdinal("role"));
grantedRole = odr.GetString(odr.GetOrdinal("grantedRole"));
adminOption = RoleGrant.ParseAdminOption(odr.GetValue(odr.GetOrdinal("admin_option")));
return new RoleGrant(role, grantedRole, adminOption, false, directGrant);
}
示例4: GetBooleanFromString
/// <summary>Gets the boolean from string constant value ("T" or "F").</summary>
/// <remarks>Defaults to false if value != TRUE constant ("T")</remarks>
/// <author>David Williams</author>
/// <date>11/29/2012</date>
internal static bool GetBooleanFromString(OracleDataReader reader, int index)
{
if (reader.IsDBNull(index) || !(reader.GetValue(index) is string)) { return false; }
return (reader.GetString(index) == Constants.TRUE);
}
示例5: GetBooleanFromStringNullable
/// <summary>Gets the boolean from string constant value ("T" or "F").</summary>
/// <remarks>Defaults to false if value != TRUE constant ("T")</remarks>
/// <author>David Williams</author>
/// <date>11/29/2012</date>
internal static bool? GetBooleanFromStringNullable(OracleDataReader reader, int index, bool? defaultValue)
{
if (reader.IsDBNull(index) || !(reader.GetValue(index) is string)) { return defaultValue; }
return (reader.GetString(index) == Constants.TRUE);
}
示例6: GetDecimalNullable
internal static decimal? GetDecimalNullable(OracleDataReader reader, int index, decimal? defaultValue)
{
return reader.IsDBNull(index) ? null : new Nullable<decimal>(Convert.ToDecimal(reader.GetValue(index)));
//return (reader.IsDBNull(index) || !(reader.GetValue(index) is Decimal)) ? defaultValue : (decimal?)reader.GetDecimal(index);
}
示例7: GetBoolean
internal static bool GetBoolean(OracleDataReader reader, int index, bool defaultValue = false)
{
return (reader.IsDBNull(index) || !(reader.GetValue(index) is bool)) ? defaultValue : reader.GetBoolean(index);
}
示例8: GetDecimal
internal static decimal GetDecimal(OracleDataReader reader, int index, decimal defaultValue)
{
return (reader.IsDBNull(index) || !(reader.GetValue(index) is Decimal)) ? defaultValue : (decimal)reader.GetDecimal(index);
}
示例9: GetString
internal static string GetString(OracleDataReader reader, int index, string defaultValue)
{
return (reader.IsDBNull(index) || !(reader.GetValue(index) is String)) ? defaultValue : reader.GetString(index);
}
示例10: ExecuteStatementString
//public IDataReader DataReader(string strSql)
//{
// objConnection = open_connection();
// objCommand = new OracleCommand(strSql, objConnection);
// objDatareader = objCommand.ExecuteReader(CommandBehavior.CloseConnection);
// objCommand.Dispose();
// return objDatareader;
//}
public string ExecuteStatementString(string strSql)
{
objConnection = open_connection();
objCommand = new OracleCommand(strSql, objConnection);
objDatareader = objCommand.ExecuteReader(CommandBehavior.CloseConnection);
objCommand.Dispose();
if (objDatareader.Read())
{
return Convert.ToString(objDatareader.GetValue(0));
objConnection.Close();
objConnection.Dispose();
}
else
{
return "";
objConnection.Close();
objConnection.Dispose();
}
//return objDatareader.GetString(0).ToString();
}
示例11: BuildValueArray
private static object[] BuildValueArray(OracleDataReader reader, IList<string> fieldTypes, bool prefetch)
{
var columnData = new object[fieldTypes.Count];
for (var i = 0; i < fieldTypes.Count; i++)
{
var fieldType = fieldTypes[i];
object value;
switch (fieldType)
{
case "BFile":
value = new OracleExternalBinaryFile(reader.GetOracleBFile(i));
break;
case "Blob":
value = new OracleBlobValue(reader.GetOracleBlob(i));
break;
case "Clob":
case "NClob":
value = new OracleClobValue(fieldType.ToUpperInvariant(), reader.GetOracleClob(i));
break;
case "Long":
var oracleString = reader.GetOracleString(i);
var stringValue = oracleString.IsNull
? (object)DBNull.Value
: $"{oracleString.Value}{(oracleString.Value.Length == OracleDatabaseModel.InitialLongFetchSize ? CellValueConverter.Ellipsis : null)}";
value = new OracleSimpleValue(stringValue);
break;
case "Raw":
value = new OracleRawValue(reader.GetOracleBinary(i));
break;
case "LongRaw":
value = new OracleLongRawValue(reader.GetOracleBinary(i));
break;
case "TimeStamp":
value = new OracleTimestamp(reader.GetOracleTimeStamp(i));
break;
case "TimeStampTZ":
value = new OracleTimestampWithTimeZone(reader.GetOracleTimeStampTZ(i));
break;
case "TimeStampLTZ":
value = new OracleTimestampWithLocalTimeZone(reader.GetOracleTimeStampLTZ(i));
break;
case "Decimal":
value = new OracleNumber(reader.GetOracleDecimal(i));
break;
#if !ORACLE_MANAGED_DATA_ACCESS_CLIENT
case "XmlType":
value = new OracleXmlValue(reader.GetOracleXmlType(i));
break;
#endif
case "Object":
case "Array":
value = reader.GetOracleValue(i);
break;
case "Date":
var oracleDate = reader.GetOracleDate(i);
value = oracleDate.IsNull
? new OracleDateTime()
: new OracleDateTime(oracleDate);
break;
case "IntervalDS":
value = new OracleIntervalDayToSecond(reader.GetOracleIntervalDS(i));
break;
case "IntervalYM":
value = new OracleIntervalYearToMonth(reader.GetOracleIntervalYM(i));
break;
case "Char":
case "NChar":
case "Varchar":
case "Varchar2":
case "NVarchar":
case "NVarchar2":
value = new OracleSimpleValue(reader.GetValue(i));
break;
case OracleRowId.TypeName:
value = new OracleRowId(reader.GetOracleString(i));
break;
default:
value = reader.GetValue(i);
break;
}
if (prefetch)
{
var largeValue = value as ILargeValue;
largeValue?.Prefetch();
}
columnData[i] = value;
}
return columnData;
}
示例12: LoadColumn
public static TableColumn LoadColumn(OracleDataReader odr)
{
string tableOwner;
string tableName;
string columnName;
OracleDbType? dataType = null;
int dataLength;
int? dataPrecision = null, dataScale = null;
bool nullable;
int? defaultLength = null;
object dataDefault = null;
int? charLength = null;
bool? charUsed = null;
tableOwner = odr.GetString(odr.GetOrdinal("owner"));
tableName = odr.GetString(odr.GetOrdinal("table_name"));
columnName = odr.GetString(odr.GetOrdinal("column_name"));
//if(!odr.IsDBNull(odr.GetOrdinal("data_type")))
// =odr.GetString(odr.GetOrdinal(""));
dataLength = odr.GetInt32(odr.GetOrdinal("data_length"));
if (!odr.IsDBNull(odr.GetOrdinal("data_precision")))
dataPrecision = odr.GetInt32(odr.GetOrdinal("data_precision"));
if(!odr.IsDBNull(odr.GetOrdinal("data_scale")))
dataScale = odr.GetInt32(odr.GetOrdinal("scale"));
//// nullable
//if(!odr.IsDBNull(odr.GetOrdinal("data_type")))
// =odr.GetString(odr.GetOrdinal(""));
if(!odr.IsDBNull(odr.GetOrdinal("default_length")))
defaultLength = odr.GetInt32(odr.GetOrdinal("default_length"));
if(!odr.IsDBNull(odr.GetOrdinal("data_default")))
dataDefault = odr.GetValue(odr.GetOrdinal("data_default"));
if(!odr.IsDBNull(odr.GetOrdinal("char_length")))
charLength = odr.GetInt32(odr.GetOrdinal("char_length"));
//// char used
//if(!odr.IsDBNull(odr.GetOrdinal("char_used")))
// charUsed=odr.GetString(odr.GetOrdinal("char_used"));
return new TableColumn(tableOwner, tableName, columnName,
dataType, dataLength, dataPrecision, dataScale,
nullable, defaultLength, dataDefault, charLength, charUsed);
}