SubSonic Forums
All Your Database Are Belong To Us

Problem wih invalid SQL for oracle (10g)

Latest post 08-07-2008 5:47 PM by runxc1. 5 replies.
  • 07-24-2008 12:49 PM

    • Vlady
    • Not Ranked
    • Joined on 07-24-2008
    • Posts 1

    Problem wih invalid SQL for oracle (10g)

    I have some code that works with 2.0.3 but does not work with 2.1.0

    example:

    Dim cd as string = "code"

    Dim exampleCollection= New EXAMPLE.ExampleCollection()

     exampleCollection.Where("COL1", SubSonic.Comparison.NotEquals, cd).Where("COL2", cd).Load()

    System.Console.WriteLine(exampleCollection.Count)

    in 2.1.0 the generate sql seems to have the schema name in the where section of the select statement causing an oracle ORA-00904 (invalid identifier) error.

    as soon as i remove the schema name ( bold below) it works ( or add it to the from statement)

    SELECT EXAMPLE.COL1, EXAMPLE.COL2,
    FROM EXAMPLE
    WHERE
    EXAMPLE.EXAMPLE.COL1 <> 'code'
    AND
    EXAMPLE.EXAMPLE.COL2 = 'code'
    ORDER BY COL1 ASC

    Filed under: ,
  • 07-31-2008 2:53 PM In reply to

    Re: Problem wih invalid SQL for oracle (10g)

    I have encountered the same issue with SS 2.1.0 and Oracle 10g. 

    I was trying to put together a quick demo and did the following:

    Dim y As New DAL.GCS.DAT_ITRController

    DataGridView1.DataSource = y.FetchByID(665).ToDataTable

    The error is thrown in the controller class here:

    <DataObjectMethod(DataObjectMethodType.Select, True)> Public Function FetchByID(ByVal DI_ID As Object) As DAT_ITRCollection

    Dim coll As DAT_ITRCollection = New DAT_ITRCollection().Where("DI_ID", DI_ID).Load()

    Return coll

    End Function

    I have the following settings in my config:

     RemoveUnderscores="False" fixDatabaseObjectCasing="false" fixPluralClassNames="false"

    My tables are upper cased in name and fields.  There are no duplicate table names in different schemas either.  This worked in 2.0.3.

    Oh, the underlying Oracle error is: "ORA-00904: "SCHEMA_TEST08"."DAT_ITR"."DI_ID": invalid identifier

    Yes, the schema, table and column names are correct.

    Software Is Like Cathedrals: First we build 'em, then we pray.
  • 08-01-2008 2:59 PM In reply to

    Re: Problem wih invalid SQL for oracle (10g)

    I seem to only have the above problem when I am asking it to FetchByID.  FetchAll works as expected.

    Software Is Like Cathedrals: First we build 'em, then we pray.
  • 08-07-2008 2:04 PM In reply to

    Re: Problem wih invalid SQL for oracle (10g)

     This works for FetchAll because there is no Where Clause.  The Bug is in Building the where clause

  • 08-07-2008 5:44 PM In reply to

    Re: Problem wih invalid SQL for oracle (10g)

     I think I may have found the cause of the error.   It appears to be two fold. 

    First if you look at the OracleDataProvider Line 244 you will see that the Automatic Connection is getting Disposed and so the reader is getting Closed.

    I changed the OracleDataProvider to look like the SqlDataProvider replacing the code that is there with the following line

    return

    automaticConnectionScope.IsUsingSharedConnection ? cmd.ExecuteReader() : cmd.ExecuteReader(CommandBehavior.CloseConnection | CommandBehavior.SingleRow);

    This seems to have fixed the problem for me. 

    Filed under: ,
  • 08-07-2008 5:47 PM In reply to

    Re: Problem wih invalid SQL for oracle (10g)

    Filed under: ,
Page 1 of 1 (6 items) | RSS