Tracking changes with IBConsole
Go Up to Change Views Quick Start
For the following examples you need two users: SYSDBA which is a default user on InterBase and HRMANAGER you'll need to create this user and grant it all required permissions.
Contents
Example 1: Seeing Changes on wisql
This is a basic example on how to see changes on a table using the Interactive SQL Window (wisql).
Initializing your subscription
Use a SELECT
query to set a starting point for your subscription, you only need to this the first time you set the subscription.
- Launch IBConsole
- Connect to the employee database as HRMANAGER.
- Click on the "Interactive SQL" window icon
.
- On the "Interactive SQL" window paste the following code:
SET SUBSCRIPTION sub_employee_changes ACTIVE; -- Query all the salaries for Engineering employees, their job grade, country, and salary: SELECT job_code, job_country, job_grade, salary FROM employee WHERE job_code='Eng';
- Click on "Execute Query"
or press F5.
- You should see a list of records similar to:
- Press F9 to commit.
Updating Data
Next, using the isql console modify records on the 'employee'. Make the changes using a different user otherwise you won't be able to see them.
- Start the isql console.
- Connect to the
employee
database as SYSDBA. - Update all the engineering salaries with a job grade of 4 and located in the USA:
UPDATE employee SET salary = salary + salary * 0.0125 WHERE job_grade=4 AND job_country = 'USA';
- Commit your changes.
commit;
Seeing the Changes
The Interactive SQL window lists all the changes on the employee
database and it also shows which records were modified.
- Go back to the "Interactive SQL" window.
- Clear any previous code and paste the following code:
SET SUBSCRIPTION sub_employee_changes ACTIVE; -- Query all the salaries for Engineering employees, their job grade, country, and salary: SELECT job_code, job_country, job_grade, salary FROM employee WHERE job_code='Eng';
- Click on "Execute Query"
or press F5.
- You should see a list of modified records.
- Press F9 to commit.
Example 2: Seeing Different Changes
In this example you can see how IBConsole shows different kinds of changes.
Initializing your Subscription
Use the SELECT
queries to set a starting point for your subscriptions, you only need to this the first time you set the subscription.
- Launch IBConsole
- Connect to the
employee
database using the HRMANGER user. - Click on the "Interactive SQL" window icon
.
- On the "Interactive SQL" window paste the following code:
SET SUBSCRIPTION sub_employee_changes AT 'device_2' ACTIVE; SELECT emp_no, dept_no, job_code, job_country FROM employee WHERE job_country='England';
- Click on "Execute Query"
or press F5.
- You should see a list of records.
- Press F9 to commit.
Updating Data
Using the isql console modify records on the 'employee'. Make the changes using a different user otherwise you won't be able to see them.
- Start the isql console.
- Connect to the
employee
database as SYSDBA. - Move employee "28" from department 120 to department 621:
UPDATE employee SET dept_no=621 WHERE emp_no=28;
- Commit your changes:
commit;
- Next, add a new entry to the database:
INSERT INTO EMPLOYEE (EMP_NO, FIRST_NAME, LAST_NAME, PHONE_EXT, HIRE_DATE, DEPT_NO, JOB_CODE, JOB_GRADE, JOB_COUNTRY, SALARY) VALUES (147, 'John', 'Smith', '223', '10/20/2014 00:00:00', '621', 'Eng', 4, 'England', 39211);
- Commit your changes:
commit;
Seeing the Changes
- Go back to the IBConsole.
- On the "Interactive SQL" window paste the following code:
SET SUBSCRIPTION sub_employee_changes AT 'device_2' ACTIVE; SELECT emp_no, dept_no, job_code, job_country FROM employee WHERE job_country='England';
- Click on "Execute Query"
or press F5.
- You should see a list of modified records.
- Press F9 to commit.