Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 10 of 13 total |
Do I need a Index If I have a constraint? |
Sun, Feb 16 2020 12:13 AM | Permanent Link |
KimHJ Comca Systems, Inc | I have a constraint on a MyID Integer. When I use it in Delphi like IndexByName := MyID and use it in a loop.
mytable.IndexByName := MyID; mytable.First; While not mytable.EOF do begin Label.Caption := mytable.FieldByName('MyID').AsString; mytable.Next; end; I get: 1000 1100 2000 1500 1300 2100 And all rows does not show. Do I need to create a index for MyID or are my Constrain corrupted? Thanks, Kim |
Sun, Feb 16 2020 2:07 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | KimHJ
A constraint controls data being added to a table, not being retrieved from it. You may have a corrupted table so its worth trying a repir. If that doesn't cure it a bit more information would be useful - what is the constraint, what rows are not showing, when did you add the constraint (was there already data there that didn't match the constraint) Roy Lambert |
Sun, Feb 16 2020 11:30 PM | Permanent Link |
KimHJ Comca Systems, Inc | Roy Lambert wrote:
>>A constraint controls data being added to a table, not being retrieved from it. You may have a corrupted table so its worth trying a repir. If that doesn't cure it a bit more information would be useful - what is the constraint, what rows are not showing, when did you add the constraint (was there already data there that didn't match the constraint)<< Roy, The constrain is an Integer and it was added when I created the table. I did run the repair. I added a new Index using the same column as the Constraint that is working. I was just confused sine when you create a Constriant it shows under index in the ElevateDB Manager. Thanks, Kim |
Mon, Feb 17 2020 8:57 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | KimHJ
Can you post the table definition? Roy Lambert |
Mon, Feb 17 2020 10:09 AM | Permanent Link |
Fernando Dias Team Elevate | Kim,
<<I was just confused sine when you create a Constriant it shows under index in the ElevateDB Manager.>> That is absolutely normal, when you define a constraint an index is automatically created because it's needed to enforce the constraint. There is no point in creating a new index by yourself on the same column - it's a duplication. -- Fernando Dias [Team Elevate] |
Mon, Feb 17 2020 11:29 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Fernando
>That is absolutely normal, when you define a constraint an index is automatically created because it's needed to enforce the constraint. >There is no point in creating a new index by yourself on the same column - it's a duplication. Almost right It depends on the type of constraint. Primary Key, Foreign Key & Unique will all create an index - after all that's the only way they will work. Check constraints will not since they don't need one. Re-reading the original post I've just noticed <<mytable.IndexByName := MyID;>> EDBTable doesn't have IndexByName so I assume a typo and it should be IndexName but simply setting the index should not prevent rows from showing which is why I want the table structure so I can play around a little. Roy |
Mon, Feb 17 2020 11:55 AM | Permanent Link |
Fernando Dias Team Elevate | Roy,
<<Almost right It depends on the type of constraint.>> Right, but Check Constraints are out of this game because they don't change row filtering, they only play a role when inserting or altering rows. -- Fernando Dias [Team Elevate] |
Tue, Feb 18 2020 1:57 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Fernando
>Right, but Check Constraints are out of this game because they don't change row filtering, they only play a role when inserting or altering rows. Neither do the others unless a filter is set. There is no filter set in the example given With the code shown I'm actually surprised that Kim can tell what's happening (I generally add lines to a memo) and I'm wondering if its down to gui refresh rather than database. Roy |
Thu, Feb 20 2020 7:32 PM | Permanent Link |
KimHJ Comca Systems, Inc | Roy Lambert wrote:
>>Re-reading the original post I've just noticed <<mytable.IndexByName := MyID;>> EDBTable doesn't have IndexByName so I assume a typo and it should be IndexName but simply setting the index should not prevent rows from showing which is why I want the table structure so I can play around a little.<< Roy, If i have a index with the Field MyID and call the index CustomerID, then in my Delphi code I can not use IndexByName := 'MyID'; ? Maybe that is why I get Access violation sometimes? Kim |
Fri, Feb 21 2020 2:24 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | KimHJ
I've just tried a couple of experiments, trying to assign a non existent index to IndexName --------------------------- Debugger Exception Notification --------------------------- Project MOA.exe raised exception class EEDBException with message 'ElevateDB Error #401 The index NoSuchIndex does not exist'. --------------------------- Break Continue Help --------------------------- and invalid field names to IndexFieldNames --------------------------- Debugger Exception Notification --------------------------- Project MOA.exe raised exception class EDatabaseError with message 'Names: No index for fields 'NoSuchIndex''. --------------------------- Break Continue Help --------------------------- I also tried to use IndexByName and the app won't compile [DCC Error] Names.pas(197): E2003 Undeclared identifier: 'IndexByName' Roy Lambert |
Page 1 of 2 | Next Page » | |
Jump to Page: 1 2 |
This web page was last updated on Sunday, May 19, 2024 at 08:46 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |