mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-18 03:51:19 -10:00
* Assembly/AssemblyInfo.cs: updated copyright * System.Data.OracleClient/OracleCommand.cs: add connection string parameter "Server" and removed "Database" to match .NET * System.Data.OracleClient/OracleLob.cs: handle BLOBs and CLOBs that are not null, but are empty * System.Data.OracleClient/OracleCommand.cs: started implementing Clone and ExecuteOracleScalar * System.Data.OracleClient/OracleDataReader.cs: modified - ms.net has GetDataTypeName return data types upper case - implement GetFieldType - implement GetOracleValues, GetOracleValue, GetOracleDateTime, GetOracleNumber, GetOracleString - modified GetOracleLob based on internal change - fix GetSchemaTable to return the correct "DataType" instead of always being System.String - GetValue should return Blobs as a byte array and Clobs as a string - Test/TestOracleClient.cs: updated Mono Oracle Tests - System.Data.OracleClient.Oci/OciCalls.cs: update DllImports for data type, actual data size, and iters * System.Data.OracleClient.Oci/OciDefineHandle.cs: modified - added properties for precision and field type - if ROWID is specified in a SELECT statement, handle the data type of OciDataType.RowIdDescriptor by just treating it as 10 byte string - do not free a HGlobal handle for a LOB since they do not get a HGlobal created for them - GetValue should return an OracleLob for BLOBs and CLOBs * System.Data.OracleClient.Oci/OciDataType.cs: make enum OciDataType to be uint * System.Data.OracleClient.Oci/OciParameterDescriptor.cs: - add function to convert Oracle's data type name to .net data type name * System.Data.OracleClient.Oci/OciRowIdDescriptor.cs: flush svn path=/trunk/mcs/; revision=38419
208 lines
4.8 KiB
C#
208 lines
4.8 KiB
C#
//
|
|
// OciParameterDescriptor.cs
|
|
//
|
|
// Part of managed C#/.NET library System.Data.OracleClient.dll
|
|
//
|
|
// Part of the Mono class libraries at
|
|
// mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci
|
|
//
|
|
// Assembly: System.Data.OracleClient.dll
|
|
// Namespace: System.Data.OracleClient.Oci
|
|
//
|
|
// Author:
|
|
// Tim Coleman <[email protected]>
|
|
//
|
|
// Copyright (C) Tim Coleman, 2003
|
|
//
|
|
|
|
using System;
|
|
using System.Data.OracleClient;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace System.Data.OracleClient.Oci {
|
|
internal sealed class OciParameterDescriptor : OciDescriptorHandle
|
|
{
|
|
#region Fields
|
|
|
|
OciErrorHandle errorHandle;
|
|
OciServiceHandle service;
|
|
OciDataType type;
|
|
|
|
#endregion // Fields
|
|
|
|
#region Constructors
|
|
|
|
public OciParameterDescriptor (OciHandle parent, IntPtr handle)
|
|
: base (OciHandleType.Parameter, parent, handle)
|
|
{
|
|
}
|
|
|
|
#endregion // Constructors
|
|
|
|
#region Properties
|
|
|
|
public OciErrorHandle ErrorHandle {
|
|
get { return errorHandle; }
|
|
set { errorHandle = value; }
|
|
}
|
|
|
|
#endregion // Properties
|
|
|
|
#region Methods
|
|
|
|
public string GetName ()
|
|
{
|
|
return GetAttributeString (OciAttributeType.Name, ErrorHandle);
|
|
}
|
|
|
|
public int GetDataSize ()
|
|
{
|
|
return (int) GetAttributeUInt16 (OciAttributeType.DataSize, ErrorHandle);
|
|
}
|
|
|
|
public OciDataType GetDataType ()
|
|
{
|
|
return (OciDataType) GetAttributeInt32 (OciAttributeType.DataType, ErrorHandle);
|
|
}
|
|
|
|
public Type GetFieldType (string sDataTypeName)
|
|
{
|
|
switch (sDataTypeName) {
|
|
case "VarChar2":
|
|
return typeof (System.String);
|
|
case "Number":
|
|
return typeof (System.Decimal);
|
|
case "Integer":
|
|
return typeof (System.Int32);
|
|
case "Float":
|
|
return typeof (System.Decimal);
|
|
case "String":
|
|
return typeof (System.String);
|
|
case "VarNum":
|
|
return typeof (System.Decimal);
|
|
case "Long":
|
|
return typeof (System.String);
|
|
case "VarChar":
|
|
return typeof (System.String);
|
|
case "RowId":
|
|
return typeof (System.String);
|
|
case "Date":
|
|
return typeof (System.DateTime);
|
|
case "VarRaw":
|
|
return Type.GetType ("System.Byte[]");
|
|
case "Raw":
|
|
return Type.GetType ("System.Byte[]");
|
|
case "LongRaw":
|
|
return Type.GetType ("System.Byte[]");
|
|
case "UnsignedInt":
|
|
return typeof (System.UInt32);
|
|
case "LongVarChar":
|
|
return typeof (System.String);
|
|
case "LongVarRaw":
|
|
return Type.GetType ("System.Byte[]");
|
|
case "Char":
|
|
return typeof (System.String);
|
|
case "CharZ":
|
|
return typeof (System.String);
|
|
case "RowIdDescriptor":
|
|
return typeof (System.String);
|
|
case "NamedDataType":
|
|
return typeof (System.String);
|
|
case "Ref":
|
|
return Type.GetType ("System.Data.OracleClient.OracleDataReader");
|
|
case "Clob":
|
|
return typeof (System.String);
|
|
case "Blob":
|
|
return Type.GetType ("System.Byte[]");
|
|
case "BFile":
|
|
return Type.GetType ("System.Byte[]");
|
|
case "OciString":
|
|
return typeof (System.String);
|
|
case "OciDate":
|
|
return typeof (System.DateTime);
|
|
default:
|
|
// FIXME: are these types correct?
|
|
return typeof(System.String);
|
|
}
|
|
}
|
|
|
|
public string GetDataTypeName ()
|
|
{
|
|
switch(GetDataType())
|
|
{
|
|
case OciDataType.VarChar2:
|
|
return "VarChar2";
|
|
case OciDataType.Number:
|
|
return "Number";
|
|
case OciDataType.Integer:
|
|
return "Integer";
|
|
case OciDataType.Float:
|
|
return "Float";
|
|
case OciDataType.String:
|
|
return "String";
|
|
case OciDataType.VarNum:
|
|
return "VarNum";
|
|
case OciDataType.Long:
|
|
return "Long";
|
|
case OciDataType.VarChar:
|
|
return "VarChar";
|
|
case OciDataType.RowId:
|
|
return "RowId";
|
|
case OciDataType.Date:
|
|
return "Date";
|
|
case OciDataType.VarRaw:
|
|
return "VarRaw";
|
|
case OciDataType.Raw:
|
|
return "Raw";
|
|
case OciDataType.LongRaw:
|
|
return "LongRaw";
|
|
case OciDataType.UnsignedInt:
|
|
return "UnsignedInt";
|
|
case OciDataType.LongVarChar:
|
|
return "LongVarChar";
|
|
case OciDataType.LongVarRaw:
|
|
return "LongVarRaw";
|
|
case OciDataType.Char:
|
|
return "Char";
|
|
case OciDataType.CharZ:
|
|
return "CharZ";
|
|
case OciDataType.RowIdDescriptor:
|
|
return "RowIdDescriptor";
|
|
case OciDataType.NamedDataType:
|
|
return "NamedDataType";
|
|
case OciDataType.Ref:
|
|
return "Ref";
|
|
case OciDataType.Clob:
|
|
return "Clob";
|
|
case OciDataType.Blob:
|
|
return "Blob";
|
|
case OciDataType.BFile:
|
|
return "BFile";
|
|
case OciDataType.OciString:
|
|
return "OciString";
|
|
case OciDataType.OciDate:
|
|
return "OciDate";
|
|
default:
|
|
return "Unknown";
|
|
}
|
|
}
|
|
|
|
public short GetPrecision ()
|
|
{
|
|
return (short) GetAttributeByte (OciAttributeType.Precision, ErrorHandle);
|
|
}
|
|
|
|
public short GetScale ()
|
|
{
|
|
return (short) GetAttributeSByte (OciAttributeType.Scale, ErrorHandle);
|
|
}
|
|
|
|
public bool GetIsNull ()
|
|
{
|
|
return GetAttributeBool (OciAttributeType.IsNull, ErrorHandle);
|
|
}
|
|
|
|
#endregion // Methods
|
|
}
|
|
}
|