Alternative to ODBC

SQL.EXPORT exports D3 data to MySQL without using ODBC for the data transfer. It runs from TCL and uses definitions in the SQLCR file. A daily batch export reflects the most recent completed run; Hot SQL Export can send changes between scheduled exports.

Note: Integer data types in SQL.EXPORT no longer include a data field length.

The ORDER dictionary includes EPRICE.NET, which returns the extended price less discount.

SQL.EXPORT sqlcr-item... (options

Separate SQLCR item names with spaces to export several files. Omit the names to use the list in SQL Setup, field 8. Use * to select every SQLCR item.

The options include:

L - Print an Export <L>og to the specified printer in SQL Setup

E - <E>mail an Export Log to the specified email address in SQL Setup

Y: Bypasses the normal confirmation. When exporting ORDER or POS.INVOICE individually, it also selects the full truncate-and-reload path without asking the full-export question. Review the scope before using this option.

Examples:

SQL.EXPORT INVENTORY (L

Export INVENTORY data and print export log

SQL.EXPORT (YE

Export all files found in SQL Setup & email log, bypassing the "Are You Sure" prompt.

SQL.EXPORT *

Export everything in the SQLCR file. Most customers will NOT do this, but rather set up the key files to export in the SQL Setup Program.

ORDER and POS.INVOICE use incremental exports by default. The default lookback is seven days; an individual export can prompt for a different number of days. The normal selection requires posted records, and ORDER also requires an invoice date. Other ordinary full-file exports generally send the selected file contents.

To request a full ORDER export, use:

SQL.EXPORT ORDER (Y

A full export can take a long time on a large system and rebuilds the export rather than limiting it to recent records.

POS.INVOICE requires the same syntax. A full-file export does not include unposted items from ORDER or POS.INVOICE.

Run full ORDER and POS.INVOICE exports individually as separate processes.

The following is an example schedule, not a requirement to replace an existing nightly export arrangement. Review the installed setup and data volume with Support before adding or changing jobs:

SQL.EXPORT (Y

Daily

SQL.EXPORT ORDER (Y

Weekly

SQL.EXPORT POS.INVOICE (Y

Weekly

Hot SQL Export

Hot SQL Export functions similarly to Hot Backup, but items are exported to SQL. To turn the feature on, a flag is available in the Hot Backup Setup (10.6.x.1), fields 9-11:

9. Hot SQL Active: Enables capture/export when set to Y.

10. Hot SQL Suspend Time: Optional time to pause sending changes.

11. Hot SQL Resume Time: Optional time to resume. Leaving it blank with a Suspend Time uses the configured external-process handshake.

Set the Active flag to Y. The Suspend and Resume Time are optional, allowing the user to set a time window when exporting data will stop. If the Suspend Time is set, but the Resume Time is left blank, the export process will set a flag for an external process when it is suspended. The export process will then wait for a signal back from the external process to indicate that it is clear to resume exporting.

If a group of items is in the process of being exported once the Suspend Time is reached, the export will complete before the process is suspended.

A one-time procedure is also necessary when starting up the process for the first time. The current settings in SQL Setup Entry (10.6.x.2) must be <S>aved, which updates all files found in field 8 with the necessary programming to capture changes to the data.

Review status and error messages before restarting a stopped export. Startup failures can stop the process immediately; repeated send errors use the consecutive-error handling described below. After resolving the cause, confirm that Hot SQL remains enabled and use the documented restart procedure.

SQL.EXPORT also supports individual-item updates and deletes, and table truncation. These are administrator operations that change the SQL destination:

SQL.EXPORT fname (I "id1" "id2" ....

Export individual items.

SQL.EXPORT fname (X "id1" "id2" ....

Delete individual items.

SQL.EXPORT fname (C

Clear the corresponding SQL tables by truncating them.

Item IDs must be enclosed in quotes <">

Abort on Consecutive Errors: If Hot SQL encounters 10 or more consecutive errors without a successful send, it stops to prevent repeated error emails while the problem remains unresolved.

The SQL Admin email address receives a separate message explaining that the process stopped. After resolving the cause, restart the process at TCL with CHECK.SQL.SEND.ACTIVE <Enter>.

Update Logic: Hot SQL groups changes by file and action. For an update, it first clears the item’s related sub-table rows while preserving the main row, then loads replacement data in normal table order. A delete processes tables in reverse order. Installed schema constraints still need to match the export definitions; this sequence is not a guarantee that every custom relationship is supported.

Performance: Hot SQL sends items in groups instead of one at a time, which improves export performance.

SQL field types come from the export and dictionary definitions. Integer and smallint fields store whole numbers; identifiers with embedded locations or other nonnumeric content need a compatible definition. Review schema changes with Support rather than assuming every identifier should be converted to an integer.

Update SQL Table Fields Upgrade 2018

The (F) option reconciles SQL table fields with SQLCR and dictionary definitions without exporting rows or truncating the table. It can add fields, change formats and drop columns missing from those definitions, subject to the protected-fields list. Dropping or changing a column can affect its stored values. Have your database administrator or Perfection Software Support review the schema changes before using it.

Table Creation During Export Upgrade 2018

MYSQL.ALWAYS.CREATE controls whether a normal full export includes CREATE TABLE IF NOT EXISTS. If the setup item is absent, the 2018 release defaults this behavior to enabled. Hot exports that add, change, or delete data omit that clause to reduce MySQL locking. Confirm this setting with your database administrator or Perfection Software Support before changing it.