All Classes Namespaces Functions Variables Groups Pages
SqlUtil Module

# Introduction to the SqlUtil Module

The SqlUtil module provides a high level database-independent API for working with database objects and SQL.

To use this module, use `"%requires SqlUtil"` in your code.

All the public symbols in the module are defined in the SqlUtil namespace

Major sections of this documentation:

- SQL Operations: working with database data (finding, updating, inserting, deleting, merging data, etc)
- Schema Management: working schema definitions (creating, modifying, aligning tables, functions, types, triggers, etc)

The SqlUtil module provides generic functionality and a framework for SQL operations and schema management, and in order to use the SqlUtil module with a particular database, a driver-specific module has to be available as well.

Currently the following driver-specific modules are available:

- MysqlSqlUtil: for working with MySQL databases
- OracleSqlUtil: for working with Oracle databases
- PgsqlSqlUtil: for working with PostgreSQL databases

The underlying driver-specific module is automatically loaded and used when required; the classes provided in the SqlUtil module provide a generic API that uses the driver-specific implementations for the underlying driver-specific implementation.

# Overview of Functionality

SqlUtil provides API support for the following:

- SQL Operations
  - Retrieving Data from the Database
  - Inserting Data into the Database
  - Updating Data
  - Deleting Data
  - Upserting or Merging Data
- Schema Management
  - Creating New Objects
  - Retrieving Objects from the Database
  - Listing Objects
  - Working With Interdependent Tables
  - Aligning Schemas With a Template
  - Table Management

# Release Notes

## SqlUtil v1.1

- implemented new upsert strategy SqlUtil::AbstractTable::UpsertInsertOnly
- adding a default value to a column with a not null constraint and existing data populates existing null columns with the new default value automatically in schema alignment
- fixed an infinitely recursive call in SqlUtil::Table::del()
- fixed bugs generating "create table" and "align table" SQL with DBs where unique indexes automatically create unique constraints (ex: MySQL)

## SqlUtil v1.0

- initial release of the SqlUtil modules for schema management and SQL operations