本文整理汇总了C#中ResultSet.getString方法的典型用法代码示例。如果您正苦于以下问题:C# ResultSet.getString方法的具体用法?C# ResultSet.getString怎么用?C# ResultSet.getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ResultSet
的用法示例。
在下文中一共展示了ResultSet.getString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FetchInternal
protected override void FetchInternal(ResultSet rs, int columnIndex)
{
_s = rs.getString(columnIndex);
// Oracle Jdbc driver returns extra trailing 0 chars for NCHAR columns
// if ((_s != null) && (_jdbcType == 1)) {
// Console.WriteLine(_jdbcType);
// int zeroIndex = ((string)_s).IndexOf((char)0);
// if (zeroIndex > 0) {
// Console.WriteLine("zero-padded");
// _s = ((string)_s).Substring(0,zeroIndex);
// }
// else {
// // Oracle sometimes pads with blanks (32)
// int blankIndex = ((string)_s).IndexOf((char)32);
// if (blankIndex > 0) {
// Console.WriteLine("blank-padded");
// _s = ((string)_s).Substring(0,blankIndex);
// }
// }
// }
}
示例2: getValue4Type
/// <summary>
/// 在rs中获取column字段的typeClass型的值
/// </summary>
/// <param name="rs"> </param>
/// <param name="column"> </param>
/// <param name="paramClass">
///
/// @return
/// </param>
/// <exception cref="SQLException"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static Object getValue4Type(java.sql.ResultSet rs, String column, Class typeClass) throws java.sql.SQLException
public static object getValue4Type(ResultSet rs, string column, Type typeClass)
{
if (typeClass.IsSubclassOf(typeof(ICollection)))
{
return null;
}
try
{
rs.findColumn(column);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
Console.Write(e.StackTrace);
return null;
}
if (typeClass.Equals(typeof(Integer)) || typeClass.Equals(Integer.TYPE))
{
return rs.getInt(column);
}
if (typeClass.Equals(typeof(Long)) || typeClass.Equals(Long.TYPE))
{
return rs.getLong(column);
}
if (typeClass.Equals(typeof(Boolean)) || typeClass.Equals(Boolean.TYPE))
{
return rs.getBoolean(column);
}
if (typeClass.Equals(typeof(Float)) || typeClass.Equals(Float.TYPE))
{
return rs.getFloat(column);
}
if (typeClass.Equals(typeof(Double)) || typeClass.Equals(Double.TYPE))
{
return rs.getDouble(column);
}
if (typeClass.Equals(typeof(Byte)) || typeClass.Equals(Byte.TYPE))
{
return rs.getByte(column);
}
if (typeClass.Equals(typeof(string)))
{
return rs.getString(column);
}
if (typeClass.IsSubclassOf(typeof(DateTime)))
{
return rs.getTimestamp(column);
}
if (typeClass.IsSubclassOf(typeof(java.sql.Date)))
{
return rs.getDate(column);
}
return rs.getObject(column);
}
示例3: SetParameterDbType
protected sealed override void SetParameterDbType(ResultSet res) {
int jdbcType = res.getInt("DATA_TYPE");
// FIXME : is that correct?
if (jdbcType == Types.OTHER) {
string typeName = res.getString("TYPE_NAME");
if (String.Compare("REF CURSOR", typeName, true, CultureInfo.InvariantCulture) == 0) {
jdbcType = (int)JavaSqlTypes.CURSOR;
}
else if (String.Compare("BLOB",typeName,true, CultureInfo.InvariantCulture) == 0) {
jdbcType = (int)JavaSqlTypes.BLOB;
}
else if (String.Compare("CLOB",typeName,true, CultureInfo.InvariantCulture) == 0) {
jdbcType = (int)JavaSqlTypes.CLOB;
}
else if(String.Compare("FLOAT",typeName,true, CultureInfo.InvariantCulture) == 0) {
jdbcType = (int)JavaSqlTypes.FLOAT;
}
else if(String.Compare("NVARCHAR2",typeName,true, CultureInfo.InvariantCulture) == 0) {
jdbcType = (int)JavaSqlTypes.VARCHAR;
}
else if(String.Compare("NCHAR",typeName,true, CultureInfo.InvariantCulture) == 0) {
jdbcType = (int)JavaSqlTypes.VARCHAR;
}
}
OracleType = OracleConvert.JdbcTypeToOracleType(jdbcType);
JdbcType = jdbcType;
}
示例4: SetParameterName
protected sealed override void SetParameterName(ResultSet res) {
ParameterName = res.getString("COLUMN_NAME");
}
示例5: SetParameterName
protected internal sealed override void SetParameterName(ResultSet res)
{
string name = res.getString("COLUMN_NAME");
if (name != null && name.Length > 0 && name[0] != '@')
name = String.Concat("@", name);
ParameterName = name;
}
示例6: SetSpecialFeatures
protected internal sealed override void SetSpecialFeatures(ResultSet res)
{
IsOracleRefCursor = (res.getString("TYPE_NAME") == "REF CURSOR");
}
示例7: SetParameterName
protected internal sealed override void SetParameterName(ResultSet res)
{
ParameterName = res.getString("COLUMN_NAME");
if (ParameterName.StartsWith("@")) {
ParameterName = ParameterName.Remove(0,1);
}
}