Problem reading LONG columns

Problem reading LONG columns

Postby dedgar » Thu 24 Nov 2005 10:00

I am having trouble accessing the values in columns of the LONG datatype. Here is some sample code - please advise:

using VS2003 c#, OraDirect3.1.5 Oracle v9.2.1
Code: Select all
            string tableName="EX_LONG";
            string connStrIn ="Data Source=TESTDB1;User ID=xfer_src;Password=xfer_src";
            string cmdStrIn = "SELECT * FROM " + tableName;

            // build the input connections and command
            OracleConnection oConnIn = new OracleConnection(connStrIn);
            OracleCommand cmdIn = new OracleCommand(cmdStrIn, oConnIn);
            oConnIn.Open();
            OracleDataReader reader = cmdIn.ExecuteReader();
            while (reader.Read())
            {
                // now get all values from that row
                for(int colNum=0;colNum                {
                    LogMessage("column "+colNum.ToString()+" is an object of type:"+reader.GetOracleValue(colNum).GetType().ToString());
                    LogMessage("Field Type="+reader.GetFieldType(colNum).ToString() + " Name="+reader.GetName(colNum)+" oratype="+reader.GetDataTypeName(colNum));
                    LogMessage("Data>>>"+reader.GetOracleValue(colNum).ToString());
                    if(reader.GetOracleValue(colNum).GetType().ToString()=="CoreLab.Oracle.OracleString")
                    {
                        OracleString tmpObj=(OracleString)reader.GetOracleValue(colNum);
                        LogMessage("length:"+tmpObj.Length);
                        LogMessage("value:"+tmpObj.Value.ToString());
                    }
                }
            }
            //Close the reader
            reader.Close();

            // Close the connections
            oConnIn.Close();


The output looks like:
Code: Select all
24/11/2005 09:49:26 LongRaw.frmMain: column 0 is an object of type:CoreLab.Oracle.OracleNumber
24/11/2005 09:49:26 LongRaw.frmMain: Field Type=System.Decimal Name=C1 oratype=NUMBER
24/11/2005 09:49:26 LongRaw.frmMain: Data>>>1
24/11/2005 09:49:26 LongRaw.frmMain: column 1 is an object of type:CoreLab.Oracle.OracleString
24/11/2005 09:49:26 LongRaw.frmMain: Field Type=System.String Name=C2 oratype=LONG
24/11/2005 09:49:26 LongRaw.frmMain: Data>>>
24/11/2005 09:49:26 LongRaw.frmMain: length:0
24/11/2005 09:49:26 LongRaw.frmMain: value:


Sample Table

Code: Select all
create table EX_LONG
   (
   c1 number,
   c2 long
   );
INSERT INTO EX_LONG values (1,'1 aaaaa');
dedgar
 
Posts: 6
Joined: Tue 22 Nov 2005 10:23

Postby Paul » Fri 25 Nov 2005 08:19

We reproduced your problem and fixed it. This fix will be included in the next OraDirect .NET build.
Paul
 
Posts: 725
Joined: Thu 28 Oct 2004 14:06

Postby dedgar » Fri 25 Nov 2005 09:00

Paul wrote:We reproduced your problem and fixed it. This fix will be included in the next OraDirect .NET build.


Thanks, any idea on when that will be?
dedgar
 
Posts: 6
Joined: Tue 22 Nov 2005 10:23


Return to dotConnect for Oracle