# US 2017/0286474 A1 · Generating Source Code for Creating Database Triggers

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2017/0286474 A1
- Document ID: US20170286474A1
- Status: Published application
- Kind: A1
- Application number: 15/087,141
- Filed: 2016-03-31
- Published: 2017-10-05
- Earliest claimed: 2016-03-31
- Assignees: Toshiba Global Commerce Solutions Holdings Corporation
- Applicants: Toshiba Global Commerce Solutions Holdings Corporation
- Inventors: Peter Sramka
- Web page: https://patentgrep.com/patent/US20170286474A1

## CPC

- G06F 16/2365: {Ensuring data consistency and integrity}
- G06F 16/2282: {Tablespace storage structures; Management thereof}
- G06F 16/9024: {Graphs; Linked lists (G06F16/9027 takes precedence)}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A computing device obtains information associated with creating a plurality of database triggers. The computing device processes this information to determine a list of foreign keys that directly link a plurality of database tables. At least two of these database tables, however, are not directly linked. Therefore, the computing device uses the list of foreign keys to generate an indirect table path that indirectly links these two database tables through one or more intermediary tables. So linked, the computing device can automatically generate the source code for creating the plurality of database triggers to verify the integrity of the data stored in all of the plurality of database tables.

## Claims

### Claim 1

A method, implemented at a computing device, of creating source code for database triggers, the method comprising:
obtaining information associated with creating a plurality of database triggers, wherein the plurality of database triggers verify the integrity of data stored across a plurality of database tables in a database, the information comprising:
a Boolean expression identifying one or more verification checks to be applied to the data stored in the plurality of database tables; and
metadata associated with a structure of the database;
generating an indirect table path linking first and second database tables through an intermediary database table based on the metadata, wherein the indirect table path comprises foreign keys that link the first and second database tables to the intermediary database table; and
generating source code for creating the plurality of database triggers based on the Boolean expression, the metadata, and the indirect table path.

### Claim 2 (depends on 1)

The method of claim 1 wherein the metadata identifies the foreign keys that link the first and second database tables through the intermediary database table.

### Claim 3 (depends on 2)

The method of claim 2 wherein generating an indirect table path linking first and second database tables through an intermediary database table based on the metadata further comprises determining an ordered sequence for the foreign keys.

### Claim 4 (depends on 1)

The method of claim 1 wherein the metadata identifies the first and second database tables, and wherein generating an indirect table path linking first and second database tables through an intermediary database table based on the metadata comprises:
querying the database to determine, based on identities of the first and second database tables, the foreign keys that link the first and second database tables to the intermediary database table; and
determining an ordered sequence for the foreign keys.

### Claim 5 (depends on 1)

The method of claim 1 wherein the metadata further comprises information identifying a connection to the database.

### Claim 6 (depends on 1)

The method of claim 1 further comprising verifying the Boolean expression against a set of predetermined policies.

### Claim 7 (depends on 1)

The method of claim 1 further comprising verifying the metadata against a set of predetermined policies.

### Claim 8 (depends on 1)

The method of claim 1 further comprising verifying the indirect table path against a set of predetermined policies.

### Claim 9 (depends on 1)

The method of claim 1 wherein generating source code for creating the plurality of database triggers based on the Boolean expression, the metadata, and the indirect table path comprises generating the source code to create a plurality of INSERT BEFORE triggers and a plurality of UPDATE BEFORE triggers.

### Claim 10 (depends on 1)

The method of claim 1 further comprising optimizing the source code for creating the plurality of database triggers.

### Claim 11

A computing device comprising:
a communications interface circuit configured to communicate data via a computer network with one or more devices; and
a processing circuit operatively connected to the communications interface circuit and configured to:
extract a plurality of tokens, based on a lexical analysis, from an input command associated with creating a plurality of database triggers that verify the integrity of data stored across a plurality of database tables in a database;
verify the order of the plurality of tokens based on a syntactic analysis of the plurality of tokens; and
if the order of the plurality of tokens is verified:
verify the ordered plurality of tokens against a set of predetermined policies based on a semantic analysis of the plurality of tokens; and
if the ordered plurality of tokens is verified:
generate an indirect table path linking first and second database tables through an intermediary database table based on the ordered plurality of tokens, wherein the indirect table path comprises ordered foreign keys that link the first and second database tables to the intermediary database table; and
generate source code for creating the plurality of database triggers based on the ordered plurality of tokens and on the indirect table path.

### Claim 12 (depends on 11)

The computing device of claim 11 wherein the input command associated with creating the plurality of database triggers comprises:
a Boolean expression identifying one or more verification checks to be applied to the data stored across the plurality of database tables; and
metadata associated with a structure of the database.

### Claim 13 (depends on 12)

The computing device of claim 12 wherein the processing circuit is configured to verify one or both of the Boolean expression and the metadata against one or more predetermined policies.

### Claim 14 (depends on 12)

The computing device of claim 12 wherein the processing circuit is configured to verify the indirect table path against one or more predetermined policies.

### Claim 15 (depends on 11)

The computing device of claim 11 wherein the input command associated with creating the plurality of database triggers comprises the foreign keys that link the first and second database tables to the intermediary database table.

### Claim 16 (depends on 11)

The computing device of claim 11 wherein the input command associated with creating the plurality of database triggers identifies the first and second database tables, and wherein to generate an indirect table path, the processing circuit is configured to:
query the database to determine, based on identities of the first and second database tables, the foreign keys that link the first and second database tables to the intermediary database table; and
determine an ordered sequence for the foreign keys.

### Claim 17 (depends on 11)

The computing device of claim 11 wherein to generate the source code for creating the plurality of database triggers, the processing circuit is configured to generate a plurality of CREATE TRIGGER commands.

### Claim 18 (depends on 11)

The computing device of claim 11 wherein the source code for creating the plurality of database triggers comprises a plurality of INSERT BEFORE triggers and a plurality of UPDATE BEFORE triggers.

### Claim 19 (depends on 11)

The computing device of claim 11 wherein the processing circuit is further configured to optimize the source code for creating the plurality of database triggers.

### Claim 20

A non-transitory computer-readable storage medium comprising computer code stored thereon, wherein, when executed by a processing circuit of a computer, causes the computer to:
obtain information associated with creating a plurality of database triggers, wherein the plurality of database triggers verify the integrity of data stored across a plurality of database tables in a database, the information comprising:
a Boolean expression identifying one or more verification checks to be applied to the data stored in the plurality of database tables; and
metadata associated with a structure of the database;
verify one or both of the Boolean expression and the metadata against a set of predetermined policies; and
if the one or both of the Boolean expression and the metadata are verified:
generate an indirect table path linking first and second database tables through an intermediary database table based on the metadata, wherein the indirect table path comprises ordered foreign keys that link the first and second database tables to the intermediary database table; and
generate source code for creating the plurality of database triggers based on the Boolean expression, the metadata, and the indirect table path.
