String sizes and long SQL statements

Standard limitations

The MySQL library works with arrays to create SQL statements

Strings have a fixed maximum length. By splitting into arrays, longer statements can be created.

Adjust global constants

You can change these values in the Global Constants :

Where do I find the settings?

// In the GLOBAL CONSTANTS of the library:
gc_MySQL_iStatementMax    : INT := 10;      // Array size (0..10 = 11 elements)
gc_MySQL_iStatementLength : INT := 100;     // Characters per element

Example: Allow larger statements

// Standard (default):
gc_MySQL_iStatementMax    := 10;      // 11 parts
gc_MySQL_iStatementLength := 100;     // 100 characters/part


// Extended for longer statements:
gc_MySQL_iStatementMax    := 20;      // 21 parts
gc_MySQL_iStatementLength := 200;     // 200 characters/part

Long SQL statements

Strategy 1: Split the statement (standard)

Example: Long INSERT with many values

Important: Each element may have a maximum of 100 characters!

Strategy 2: Use intermediate variables

If a substring becomes too long:

Practical examples

Example 1: INSERT with many columns

Task: Write 15 values to the database

But: Only 7 of 15 values fit! Solution: Second INSERT or UPDATE


Example 2: SELECT with long WHERE clause


Example 3: UPDATE with many fields

Last updated