com.joybase.DB.dll源代碼(5)
2024-07-21 02:22:35
供稿:網友
 
 /// <summary>
 /// 枚舉類型,即一個數據庫連接類型的枚舉
 /// </summary>
 public enum dbtype
 {
  /// <summary>
  /// sql方式連接
  /// </summary>
  sqlclient=0,
  /// <summary>
  /// oledb方式連接
  /// </summary>
  oledb=1
 }
 /// <summary>
 /// 本程序集的異常信息
 /// </summary>
 public class joybasedbexception:exception
 {
  /// <summary>
  /// 構造方法
  /// </summary>
  public joybasedbexception():base()
  {
   this.helplink="http://www.joycode.com";
   this._reason="無特定原因";
  }
  /// <summary>
  /// 構造方法
  /// </summary>
  /// <param name="message">錯誤信息</param>
  public joybasedbexception(string message):base("com.joybase.db.dll exception message:"+message)
  {
   //this.message=message;
   this._reason="無特定原因";
   this.helplink="http://www.joycode.com";
  }
  /// <summary>
  /// 構造方法
  /// </summary>
  /// <param name="message">錯誤信息</param>
  /// <param name="e">內部異常</param>
  public joybasedbexception(string message,system.exception e):base("com.joybase.db.dll exception message:"+message,e)
  {
   //this.message=;
   this.helplink="http://www.joycode.com";
   this._reason="無特定原因";
  }
  /// <summary>
  /// 構造方法
  /// </summary>
  /// <param name="message">錯誤信息</param>
  /// <param name="reason">錯誤原因</param>
  public joybasedbexception(string message,string reason):base("com.joybase.db.dll exception message:"+message+".更多信息請捕捉本異常的reason變量")
  {
   this._reason="可能原因如下:/r/n"+reason;
  }
  private string _reason;
  /// <summary>
  /// 錯誤原因,只讀
  /// </summary>
  public string reason
  {
   get
   {
    return this._reason;
   }
  }
  
 }
// /// <summary>
// /// 
// /// </summary>
// public class dbparameter:idataparameter
// {
//  dbtype m_dbtype  = dbtype.object;
//  parameterdirection m_direction = parameterdirection.input;
//  bool m_fnullable  = false;
//  string m_sparamname;
//  string m_ssourcecolumn;
//  datarowversion m_sourceversion = datarowversion.current;
//  object m_value;
//
//  public dbparameter()
//  {
//  }
//
//  public dbparameter(string parametername, dbtype type)
//  {
//   m_sparamname = parametername;
//   m_dbtype   = type;
//  }
//
//  public dbparameter(string parametername, object value)
//  {
//   m_sparamname = parametername;
//   this.value = value;   
//   // setting the value also infers the type.
//  }
//
//  public dbparameter( string parametername, dbtype dbtype, string sourcecolumn )
//  {
//   m_sparamname  = parametername;
//   m_dbtype    = dbtype;
//   m_ssourcecolumn = sourcecolumn;
//  }
//
//  public dbtype dbtype 
//  {
//   get  { return m_dbtype; }
//   set  { m_dbtype = value;  }
//  }
//
//  public parameterdirection direction 
//  {
//   get { return m_direction; }
//   set { m_direction = value; }
//  }
//
//  public boolean isnullable 
//  {
//   get { return m_fnullable; }
//  }
//
//  public string parametername 
//  {
//   get { return m_sparamname; }
//   set { m_sparamname = value; }
//  }
//
//  public string sourcecolumn 
//  {
//   get { return m_ssourcecolumn; }
//   set { m_ssourcecolumn = value; }
//  }
//
//  public datarowversion sourceversion 
//  {
//   get { return m_sourceversion; }
//   set { m_sourceversion = value; }
//  }
//
//  public object value 
//  {
//   get
//   {
//    return m_value;
//   }
//   set
//   {
//    m_value    = value;
//    m_dbtype  = _infertype(value);
//   }
//  }
//
//  private dbtype _infertype(object value)
//  {
//   switch (type.gettypecode(value.gettype()))
//   {
//    case typecode.empty:
//     throw new systemexception("invalid data type");
//
//    case typecode.object:
//     return dbtype.object;
//
//    case typecode.dbnull:
//    case typecode.char:
//    case typecode.sbyte:
//    case typecode.uint16:
//    case typecode.uint32:
//    case typecode.uint64:
//     // throw a systemexception for unsupported data types.
//     throw new systemexception("invalid data type");
//
//    case typecode.boolean:
//     return dbtype.boolean;
//
//    case typecode.byte:
//     return dbtype.byte;
//
//    case typecode.int16:
//     return dbtype.int16;
//
//    case typecode.int32:
//     return dbtype.int32;
//
//    case typecode.int64:
//     return dbtype.int64;
//
//    case typecode.single:
//     return dbtype.single;
//
//    case typecode.double:
//     return dbtype.double;
//
//    case typecode.decimal:
//     return dbtype.decimal;
//
//    case typecode.datetime:
//     return dbtype.datetime;
//
//    case typecode.string:
//     return dbtype.string;
//
//    default:
//     throw new systemexception("value is of unknown data type");
//   }
//  }
// }
//
// public class dbparameters: system.collections.arraylist,idataparametercollection
// {
//  //private dbparameter x[int];
////  public object this[string index] 
////  {
////   get;set;
////  }
//
//  public object this[string index] 
//  {
//   get
//   {
//    
//    return this[indexof(index)];
//   }
//   set
//   {
//    this[indexof(index)] = value;
//   }
//  }
//
//
////  public dbparameter this[string x]
////  {
////   get
////   {
////   }
////   set
////   {
////   }
////  }
////  public dbparameter this[string index]
////  {
////   get
////   {
////    return (dbparameter)this[indexof(index)];
////    
////    
////   }
////   set
////   {
////    this[indexof(index)]=value;
////   }
////  }
////  public dbparameter this[int index]
////  {
////   get
////   {
////    return (dbparameter)this[index];
////   }
////   set
////   {
////    this[index]=value;
////   }
////  }
//
//  public bool contains(string parametername)
//  {
//   return(-1 != indexof(parametername));
//   
//  }
//
//  public int indexof(string parametername)
//  {
//   int index = 0;
//   foreach(system.data.idataparameter item in this) 
//   {
//    if (0 == _cultureawarecompare(item.parametername,parametername))
//    {
//     return index;
//    }
//    index++;
//   }
//   return -1;
//  }
//
//  public void removeat(string parametername)
//  {
//   removeat(indexof(parametername));
//  }
//
//  public override int add(object value)
//  {
//   return add((dbparameter)value);
//  }
//
//  public int add(dbparameter valuein)
//  {
//   if (valuein.parametername != null)
//   {
//    return base.add(valuein);
//   }
//   else
//    throw new argumentexception("parameter must be named");
//  }
//
//  public int add(string parametername, system.data.dbtype type)
//  {
//   return add(new dbparameter(parametername, type));
//  }
//
//  public int add(string parametername, object value)
//  {
//   return add(new dbparameter(parametername, value));
//  }
//
//  public int add(string parametername, dbtype dbtype, string sourcecolumn)
//  {
//   return add(new dbparameter(parametername, dbtype, sourcecolumn));
//  }
//
//  private int _cultureawarecompare(string stra, string strb)
//  {
//   return system.globalization.cultureinfo.currentculture.compareinfo.compare(stra, strb, system.globalization.compareoptions.ignorekanatype | compareoptions.ignorewidth | compareoptions.ignorecase);
//  }
//
//  
//
//  
// }
// public abstract class datareader:system.data.idatareader
// {
//  public abstract int depth {get;}
//  public abstract bool isclosed{get;}
//  public abstract int recordsaffected{get;}
//  public abstract void close();
//  public abstract bool nextresult();
//  public abstract bool read();
//  public abstract datatable getschematable();
//  public abstract int fieldcount{get;}
//  public abstract string getname(int i);
//  public abstract string getdatatypename(int i);
//  public abstract type getfieldtype(int i);
//  public abstract object getvalue(int i);
//  public abstract int getvalues(object[] values);
//  public abstract int getordinal(string name);
//  public abstract object this [ int i ]{get;}
//  public abstract object this [ string name ]{get;}
//  public abstract bool getboolean(int i);
//  public abstract byte getbyte(int i);
//  public abstract long getbytes(int i, long fieldoffset, byte[] buffer, int bufferoffset, int length);
//  public abstract char getchar(int i);
//  public abstract long getchars(int i, long fieldoffset, char[] buffer, int bufferoffset, int length);
//  public abstract guid getguid(int i);
//  public abstract int16 getint16(int i);
//  public abstract int32 getint32(int i);
//  public abstract int64 getint64(int i);
//  public abstract float getfloat(int i);
//  public abstract double getdouble(int i);
//  public abstract string getstring(int i);
//  public abstract decimal getdecimal(int i);
//  public abstract datetime getdatetime(int i);
//  public abstract idatareader getdata(int i);
//  public abstract bool isdbnull(int i);
//  public abstract void dispose();
//  //private abstract int _cultureawarecompare(string stra, string strb);
//  
// }
 
}