Unique Constraint

Posts   
 
    
shekar
User
Posts: 327
Joined: 26-Mar-2010
# Posted on: 06-Jul-2010 08:01:19   

LLBLGen 3.0 DB Oracle 9i Framework LLBLGen

Hi I have defined unique constrant on columnname.description.

Problem is if i have text as "EXAMPLE" and check unique constraint with "example" it does not work. I mean it is case sensitive. Is there a way to ignore case while checking for unique constraint in LLBLGEN itself OR do i have to write a Csharp code for this purpose

Regards, Shekar

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 06-Jul-2010 09:02:23   

How do you check for the unique costraint?

(Edit) Why don't you specify "case-insensitive" in the database?

shekar
User
Posts: 327
Joined: 26-Mar-2010
# Posted on: 06-Jul-2010 09:36:43   

Walaa wrote:

How do you check for the unique costraint?

(Edit) Why don't you specify "case-insensitive" in the database?

Like this

private static bool isduplicaterecord(string inputstring) // check duplicate records in table {

        var adapteraccountnature = new DataAccessAdapter();
        var accountnature = new AccountnatureEntity
                                {
                                    Description = inputstring,
                                    Flag = ClubCentricBISpecific.StandardFlag.recordvalidflag
                                };
        adapteraccountnature.FetchEntityUsingUniqueConstraint(accountnature,
                                                                accountnature.ConstructFilterForUCDescriptionFlag());
        adapteraccountnature.CloseConnection();
        return (accountnature.Fields.State) == EntityState.Fetched;
    }
Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 06-Jul-2010 10:47:46   

You should specify Case-Insensitive colation in the database table/column.

Or use FieldLikePredicate and set the CaseSensitiveCollation to true while sending the parameter in UpperCase.

shekar
User
Posts: 327
Joined: 26-Mar-2010
# Posted on: 06-Jul-2010 12:55:39   

Walaa wrote:

You should specify Case-Insensitive colation in the database table/column.

Or use FieldLikePredicate and set the CaseSensitiveCollation to true while sending the parameter in UpperCase.

This works

SELECT * FROM ACCOUNTNATURE where UPPER(DESCRIPTION)=UPPER('Aqua Aerobics Coaching')

But how do i modify the code to work this way ?

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 06-Jul-2010 20:35:57   

You can use Database Functions to accomplish this.

Matt

shekar
User
Posts: 327
Joined: 26-Mar-2010
# Posted on: 07-Jul-2010 06:02:17   

MTrinder wrote:

You can use Database Functions to accomplish this.

Matt

Ok Thanks