Search found 4 matches

by pedro.castelo
Thu 11 Mar 2010 11:01
Forum: dotConnect for Oracle
Topic: Oracle Constraints Again:
Replies: 11
Views: 4177

Same issue on lattest beta 5.60.102.0

I'm having same issue on lattest beta! :(

I created a new topic because I did not saw this before... On my post I added more infos...
http://www.devart.com/forums/viewtopic.php?t=17324
by pedro.castelo
Thu 11 Mar 2010 10:44
Forum: dotConnect for Oracle
Topic: Returning TableSchema(System.Data.CommandBehavior.KeyInfo)
Replies: 4
Views: 2922

Returning TableSchema(System.Data.CommandBehavior.KeyInfo)

Hi,
I'm using dotOracle version 5.60.102.0.
I have to create a datatable which reflects a database table and I'm using the following code:

Code: Select all

using (System.Data.Common.DbConnection connection = Manager.DBFactory.CreateConnection())
{
    connection.ConnectionString = Manager.ConnectionString;
    using (System.Data.Common.DbCommand selectCommand = Manager.DBFactory.CreateCommand())
    {
        selectCommand.Connection = connection;
        connection.Open();
        selectCommand.CommandText = string.Format("SELECT * FROM {0} WHERE 1=0", table);
        System.Data.Common.DbDataReader reader = selectCommand.ExecuteReader(System.Data.CommandBehavior.KeyInfo);
        //Then we get the reader tableSchema to update some infos not automatically retrieved
        System.Data.DataTable schemaTable = reader.GetSchemaTable();
        //Loading the datatable, to fetch the structure
        dataTable.Load(reader);   
        //Storing some numeric relevat data to the extendend properties for later usage
        foreach (System.Data.DataRow column in schemaTable.Rows)
        {   //For more infos about the SchemaTable
            //http://msdn.microsoft.com/en-us/library/system.data.datatablereader.getschematable.aspx
            //NumericPrecision: How many significant digits(left side of decimal deparator) EX: Number(18,2) should be 18
            //NumericScale: How many decimal digits EX: Number(18,2) should be 2
            //ColumnSize: How big is the column
            if(dataTable.Columns.Contains(column["ColumnName"].ToString()))
            {
                System.Data.DataColumn dataColumn = dataTable.Columns[column["ColumnName"].ToString()];
                dataColumn.ExtendedProperties.Add("NumericPrecision", column["NumericPrecision"]);
                dataColumn.ExtendedProperties.Add("NumericScale", column["NumericScale"]);
                dataColumn.ExtendedProperties.Add("ColumnSize", column["ColumnSize"]);
            }                            
        }
        reader.Close();
        connection.Close();
    }
}
The problem is that, it is creating a constraint for each column of a a compound unique key(Not primary key!). For example if I have a compound Unique key with fields A and B, instead of create a datatable constraint with A and B, it's creating two contraints: One for A and One for B.

I further investigated and I noticed that the "IsUnique" column on the table returned by GetSchemaTable() is true for both fields involved. The problem is that there's no way to know by the information that is coming if it's a compound key or not.

On the other hand I used dbMonitor to monitor the comands being executed on the database. Here it is:

Code: Select all

select 0 as typ,0 as table_id,column_name,column_id,' ' as constraint_type, owner
from all_tab_columns
where owner = SYS_CONTEXT ('USERENV', 'CURRENT_SCHEMA') and table_name = 'DICFIELD'
union all
select 0 as typ,0 as table_id,cc.column_name,0 as column_id,cs.constraint_type || ':' || cs.constraint_name, cc.owner as owner
from all_constraints cs,all_cons_columns cc
where cc.owner = SYS_CONTEXT ('USERENV', 'CURRENT_SCHEMA') and cc.table_name = 'DICFIELD' and
cs.owner = cc.owner and cs.table_name = cc.table_name and cs.constraint_name = cc.constraint_name and cs.constraint_type in ('P','U')
According to the results of this statement I can see that the constraintname is being taken(cs.constraint_type || ':' || cs.constraint_name), which would allow dotOracle to know if the constraint has multiple columns or not, and the create only one contsraint instead of multiple.

Can you please help me on this?

Kind regards,

Pedro
by pedro.castelo
Thu 04 Mar 2010 16:08
Forum: dotConnect for Oracle
Topic: trailing null missing from STR bind value Error
Replies: 7
Views: 6975

ORA-01480 on v4.75.43.0(Corelab.Oracle)

Hi,
I'm using the version 4.75.43.0 of CoreLab.oracle and I'm getting exactly same error..
The problem is that my subscription is over and I cannot download the corrected version. Is there any other way?

Kind regards,
Pedro
by pedro.castelo
Tue 24 Jun 2008 12:48
Forum: dotConnect for Oracle
Topic: GetSchema() PrimaryKeys Collection does not exits
Replies: 1
Views: 2635

GetSchema() PrimaryKeys Collection does not exits

Hi!

I'm evaluating OraDirect.Net product but I got surprised when I did not find the PrimaryKeys Collection from GetSchema() method. The most Curious thing is that the Microsoft Native Oracle Provider has it. In the following lines you can see their differences...

=========================================
CoreLab.Oracle.OracleConnection
=========================================
MetaDataCollections
Restrictions
ReservedWords
Users
Tables
Views
Columns
Indexes
IndexColumns
Functions
Procedures
Arguments
Synonyms
Sequences
Packages
PackageBodies
ForeignKeys
ForeignKeyColumns
Triggers
Clusters
QueuePublishers
Queues
QueueTables

=========================================
System.Data.OracleClient.OracleConnection
=========================================
MetaDataCollections
DataSourceInformation
DataTypes
Restrictions
ReservedWords
Users
Tables
Columns
Views
Synonyms
Sequences
ProcedureParameters
Functions
IndexColumns
Indexes
Packages
PackageBodies
Arguments
Procedures
UniqueKeys
PrimaryKeys << I Need this one
ForeignKeys
ForeignKeyColumns

Rather than the current GetSchema return collections, I really need this PrimaryKeys Collection. And unfortunatelly, In my case, I cannot assume Unique Index as PrimaryKeys.

Can you help me? Is there any way to get this PrimaryKeys Collection?

Kind regards,

Pedro Castelo Branco Lourenço
Innovation Manager
Savcor Forest Ltda
Tel. +55 12 3946 2609
Cel. +55 12 8158 5338



“Things should be as simple as possible, but not simpler.” Albert Einstein