IP Library Granted Patent US 8,108,367
Granted Patent B2
US 8,108,367 · App. 12/123,905 · Granted Jan 31, 2012

Constraints with hidden rows in a database

Assignee: International Business Machines Corporation
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 8,108,367
App. No.
12/123,905
Granted
Jan 31, 2012
Kind
B2
Abstract

In an embodiment, a constraint is created for a database table. The constraint specifies a condition for a first column in the database table and an action. The action specifies whether data that violates the condition is allowed to be stored in the first column. A value and a specification of a second column in the database table are received from a data source. If the second column is identical to the first column, the value violates the condition, and the action specifies that data that violates the condition is allowed to be stored, the value is stored in a row in the database, the row is marked as hidden, and an identification of the constraint that was violated is stored in the row. A query does not return the row that is marked as hidden.

Claims (45)

1. A method comprising:

creating a constraint in a storage device for a database table, wherein the constraint specifies a condition for a first column in the database table and an action, wherein the action specifies whether data that violates the condition is allowed to be stored in the first column;

receiving a value and a specification of a second column in the database table from a data source;

if the second column is identical to the first column, if the value that has been received by the receiving but has not yet been stored to the database table violates the condition, and if the action specifies that data that violates the condition is allowed to be stored, storing the value in a row in the database and marking the row in a view status column in the database as hidden, wherein the row comprises the first column and the view status column, wherein a query returns the row if the row is marked as readable in the view status column, and wherein the query does not return the row if the row is marked as hidden in the view status column in the database by the storing in response to the data violating the condition of the constraint; and

in response to a command that specifies the constraint and requests a recommendation for changing the constraint, recommending a change to the constraint that causes the value in the row to satisfy the constraint, wherein the recommending the change to the constraint further comprises searching a plurality of rows that comprise a plurality of values that violate the constraint, wherein the searching finds an extreme value in the plurality of values, wherein the extreme value has a greatest difference from an operand specified by the condition of the constraint and recommending that the operand of the condition be changed to the extreme value, wherein the recommending specifies the extreme value.

2. The method of claim 1 , further comprising:

if the second column is identical to the first column, the value violates the condition, and the action specifies that data that violates the condition is not allowed to be stored, refraining from storing the value in the row in the database and returning an error to the data source.

3. The method of claim 2 , further comprising:

if the second column is identical to the first column and the value satisfies the condition, storing the value in the second column of the row in the database and marking the row as readable.

4. The method of claim 1 , further comprising:

if the second column is identical to the first column, the value violates the condition, and the action specifies that data that violates the condition is allowed to be stored, storing an identification of the constraint that was violated in the row.

5. The method of claim 3 , further comprising:

altering the condition into a new condition; and

if the row is marked as hidden, marking the row as readable if the value satisfies the new condition.

6. The method of claim 1 , further comprising:

if the second column is not identical to the first column, storing the value in the second column of the row in the database and marking the row as readable.

7. A non-transitory storage medium encoded with instructions, wherein the instructions when executed comprise:

creating a constraint for a database table, wherein the constraint specifies a condition for a first column in the database table and an action, wherein the action specifies whether data that violates the condition is allowed to be stored in the first column;

receiving a value and a specification of a second column in the database table from a data source;

if the second column is identical to the first column, if the value that has been received by the receiving but has not yet been stored to the database table violates the condition, and if the action specifies that data that violates the condition is allowed to be stored, storing the value in a row in the database, marking the row in a view status column in the database as hidden, wherein the row comprises the first column and the view status column, and storing an identification of the constraint that was violated in the row, wherein a query does not return the row that is marked as hidden in the view status column in the database by the storing in response to the data violating the condition of the constraint; and

in response to a command that specifies the constraint and requests a recommendation for changing the constraint, recommending a change to the constraint that causes the value in the row to satisfy the constraint, wherein the recommending the change to the constraint further comprises searching a plurality of rows that comprise a plurality of values that violate the constraint, wherein the searching finds an extreme value in the plurality of values, wherein the extreme value has a greatest difference from an operand specified by the condition of the constraint and recommending that the operand of the condition be changed to the extreme value, wherein the recommending specifies the extreme value.

8. The non-transitory storage medium of claim 7 , further comprising:

deleting all of a plurality of rows in the database table that comprise a plurality of values that violate the constraint.

9. The non-transitory storage medium of claim 7 , further comprising:

if the second column is identical to the first column and the value violates the condition, refraining from storing the value in the row in the database and returning an error to the data source if the action specifies that data that violates the condition is not allowed to be stored; and

if the second column is identical to the first column and the value satisfies the condition, storing the value in the second column of the row in the database and marking the row as readable, wherein the query returns the row that is marked as readable.

10. The non-transitory storage medium of claim 9 , further comprising:

altering the condition into a new condition; and

if the row is marked as hidden, marking the row as readable if the value satisfies the new condition.

11. A computer system comprising:

a processor; and

memory communicatively connected to the processor, wherein the memory encodes instructions that when executed by the processor comprise:

creating a constraint for a database table, wherein the constraint specifies a condition for a first column in the database table and an action, wherein the action specifies whether data that violates the condition is allowed to be stored in the first column,

receiving a value and a specification of a second column in the database table from a data source,

if the second column is identical to the first column, if the value that has been received by the receiving but has not yet been stored to the database table violates the condition, and if the action specifies that data that violates the condition is allowed to be stored, storing the value in a row in the database, marking the row in a view status column in the database as hidden, wherein the row comprises the first column and the view status column, and storing an identification of the constraint that was violated in the row, wherein a query does not return the row that is marked as hidden in the view status column in the database by the storing in response to the data violating the condition of the constraint, and

in response to a command that specifies the constraint and requests a recommendation for changing the constraint, recommending a change to the constraint that causes the value in the row to satisfy the constraint, wherein the recommending the change to the constraint further comprises searching a plurality of rows that comprise a plurality of values that violate the constraint, wherein the searching finds an extreme value in the plurality of values, wherein the extreme value has a greatest difference from an operand specified by the condition of the constraint and recommending that the operand of the condition be changed to the extreme value, wherein the recommending specifies the extreme value.

12. The computer system of claim 11 , wherein the instructions further comprise:

altering the condition into a new condition; and

if the row is marked as hidden, marking the row as readable if the value satisfies the new condition.

13. The computer system of claim 11 , wherein the instructions further comprise:

deleting all of a plurality of rows in the database table that comprise a plurality of values that violate the constraint.

14. The computer system of claim 11 , wherein the instructions further comprise:

in response to the receiving, determining whether the second column is identical to the first column and the value satisfies the condition, wherein the determining whether the value satisfies the condition further comprises determining whether the value exists in a parent column of a parent table, wherein the first column comprises a foreign key, the condition specifies a parent table, and a parent column in the parent table matches the foreign key.

15. The computer system of claim 11 , wherein the instructions further comprise:

in response to the receiving, determining whether the second column is identical to the first column and the value satisfies the condition, wherein the determining whether the value satisfies the condition further comprises substituting the value for a variable in the condition and evaluating truth of the condition.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded May 20, 2008
From: KONIK, RAFAL P; THEUER, MARK W; VENZ, MICHAEL A
To: INTERNATIONAL BUSINESS MACHINES CORPORATION
Reel/Frame 020973/0787 →
Continuity (1)
Related Publication 20090292711A1 · Nov 26, 2009