DEV Community

Franz
Franz

Posted on

Uniface 10.4 + Informix: Simple Guide to DSQL Support 🧩

🤖 This blog post was created with the help of an AI assistant and is based on the Uniface 10.4 documentation section “SQL Support on Informix”.

When you use Uniface 10.4 with Informix, you can run direct SQL from your ProcScript code. The main tools for this are the sql ProcScript command and the SQL Editor in the Uniface environment. 😊

What is DSQL in Uniface?

In this context, DSQL means that Uniface sends your SQL string directly to Informix. You write the SQL yourself, and it is executed on the Informix side without extra Uniface logic.

You can use the sql statement in ProcScript to execute SQL like select, insert, update, or delete. You can also use the SQL Editor in Uniface to run SQL statements against your Informix database.

Monitoring SQL in the message frame

Uniface can show the SQL statements that are sent to Informix in the message frame. This can help you understand which SQL is actually executed.

However, you cannot see the actual values used in these SQL statements. Only the statement itself is visible, not the concrete parameter values.

Important rules for transactions

For the single connection mechanism, you must not use commit work or rollback inside an SQL string that you send with the sql instruction. The same restriction applies to SQL that you execute in SQL Edit.

Uniface handles the single database connection and its transaction state. If you send commit work or rollback yourself, you can disturb this mechanism, so it should be avoided in this mode.

Example: what you should not do

; ❌ Bad example in single connection mode
sql "update customer set active = 1 where id = 100;
     commit work", "inf"
Enter fullscreen mode Exit fullscreen mode

This example mixes data change and transaction control in one SQL string and should not be used with the single connection mechanism.

Better example without transaction control

; ✅ Better example: let Uniface control the connection
sql "update customer set active = 1 where id = 100", "inf"

; Here, Uniface or your normal application flow decides when the work is committed.
Enter fullscreen mode Exit fullscreen mode

In this example, the SQL statement only updates data and does not send commit work or rollback, which fits the rule for the single connection mechanism.

Using SQL Edit when you have no front-end

Sometimes you do not have an Informix front-end and have not yet created an Informix database. In that situation, you cannot log on to Informix with another tool.

In this case, you can use SQL Edit in Uniface to create the Informix database and run the required SQL statements. This gives you a way to work with Informix even if Uniface is your only available front-end.

Limitations with BLOB fields

There is an important limitation for BLOB data when you use DSQL on Informix. You cannot select, insert, or update BLOB fields in SQL Edit or with the sql instruction.

If you need to work with BLOB fields, you must use other Uniface mechanisms instead of SQL Edit or the sql command. This keeps your application compatible with the Informix driver limitations.

Example: simple select without BLOB

; ✅ Valid DSQL example (no BLOB involved)
sql/data "select id, name from document where status = 'A'", "inf"

if ($status >= 0)
  message "Select was successful."
else
  message "Select failed, status = %%$status"
endif
Enter fullscreen mode Exit fullscreen mode

Here the SQL selects only normal fields like ID and NAME and does not touch any BLOB fields, so it is safe with the documented DSQL limitations.

When to use DSQL on Informix

Use DSQL (the sql instruction or SQL Edit) when you want to send your own SQL directly to Informix from Uniface. It is useful when you know the exact statement you want to execute.

Do not use DSQL for BLOB operations and do not include commit work or rollback in your SQL when you work with the single connection mechanism. Following these rules keeps your Uniface and Informix integration stable and predictable.


✍️ This article is a simplified explanation of the “SQL Support on Informix” section from the Uniface 10.4 documentation, written with AI assistance to make the topic easier to understand.

Top comments (0)