Using the create.sql Script to Recreate the Tables

You may find it convenient to use the create script as part of a custom database setup process, e.g., if you would rather create the databases via manually entered commands instead of running the setup script mentioned previously. You do not need to run the create program if you have already run the setup script, as the tables have already been created as part of that process.

You should also feel free to recreate the testing database tables as needed, and in any case, you will need to do this to upgrade your table design as new versions of the shim are released. The create.sql script, in particular, is provided to enable you to rebuild the tables without again obtaining mysql root access; you should only have to run the setup.sql script once, while the create.sql script may be executed many, many times during development.

If you are considering table recreation after some period of program operation, you should realize that the OrderJournal table contains accounting information about the orders, if any, that you have made, so that if you use a real IB account with the trading database, as opposed to the paper account that should be used with the testing database, you will need to first preserve the logical contents of that table.

In the case that you wish to recreate the tables and load their initial values, recall that the setup script above created a user account code, meant for general purpose programming and maintenance of your trading-shim databases. Use this account to connect, and run the create.sql script, as illustrated below. Note that in the example here the account is not protected by a password; and again, the ellipses indicate missing material, as many rows scroll by, with values similar but not identical to those for the ``source setup.sql;'' step above.

sql$ mysql -u code testing
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 928 to server version: 5.0.27

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> source create.sql;

... ... ... ... ... ... ... ... ... ...

Query OK, 8 rows affected (0.00 sec)
Records: 8  Duplicates: 0  Warnings: 0

Query OK, 1 row affected (0.00 sec)

Query OK, 3 rows affected (0.01 sec)
Records: 3  Duplicates: 0  Warnings: 0

mysql>
mysql> quit
Bye
sql$

Bill Pippin 2010-01-14