Our biggest issue porting to Oracle (our first port from MS SQL) is that Oracle does not have bool or guid data types. After getting over the initial shock, my programmer made changes to the ES 2007 source to work around this. However, this might not have been the best way to solve the problem. We do not want to change our MS SQL data types - guids should be stored as guids, and we don't want to change our application either. What we did is the following:
GetSystemBoolean
Original version:
protected System.Boolean? GetSystemBoolean(string columnName)
{
if (this.row == null) this.AddNew();
object o = this.row[columnName];
return (o == DBNull.Value) ? null : (System.Boolean?)o;
}
Modified version:
protected System.Boolean? GetSystemBoolean(string columnName)
{
if (this.row == null) this.AddNew();
object o = this.row[columnName];
return (o == DBNull.Value) ? null : (System.Boolean?)Convert.ToBoolean(o);
}
GetSystemGuid
Original version:
protected System.Guid? GetSystemGuid(string columnName)
{
if (this.row == null) this.AddNew();
object o = this.row[columnName];
return (o == DBNull.Value) ? null : (System.Guid?)o;
}
Modified version (allow use string data as GUID, Oracle don’t have GUID data type):
protected System.Guid? GetSystemGuid(string columnName)
{
if (this.row == null) this.AddNew();
object o = this.row[columnName];
if (o == DBNull.Value)
{
return null;
}
else if(o is System.String)
{
return new Guid((String)o);
}
else
{
return (System.Guid?)o;
}
}
If there is a better way to solve our problem, I'm happy to change, as long as I can still use my guid and bool datatypes in my C# code, and can use the same code for Oracle, MS SQL, and soon DB2. I
Any words of wisdom would be appreciated.