warning: file_get_contents( [function.file-get-contents]: failed to open stream: HTTP request failed! in /var/www/ : eval()'d code on line 4.

SQL Views

This How-Do-I shows you some examples on how to use SQL Views in more and less complex ways.

SQL views


Download for Windows & Mac

4D Indexes

This example database shows the various possibilities for using indexes in 4D.

There are several types of indexes in 4D that can be selected according to the type of data and their use.


In addition to demonstrating their effectiveness, this example explains how to choose the most appropriate type of index.


Download for Windows or Mac


This example database demonstrates the possibility of carrying out queries via the 4D language as well as SQL.

Specific examples show both languages in parallel so that they can be compared easily and in order to highlight their respective advantages.


Comments and explanations are provided during the execution of these queries.


Download for Windows or Mac

Database Events

This "How Do I" gives you an example of the new database method 'On System events' management.

The new events supported by this new method apply to background or foreground application moves.


Download for Windows or Mac

Externalized application settings

Application settings and preferences can now be stored external to your 4D application’s primary structure (e.g. the size of the database cache, HTTP port number, etc.).

This allows for smoother upgrades whenever you update your solutions, especially on large-scale deployments that have numerous users.


Indexed picture metadata

The 4D database engine indexes picture metadata.

Search images and get much faster results based on the keywords that are automatically indexed by the database engine.


External data storage

Store pictures, blobs and text outside of the data file.

This feature reduces the size of the data file itself, so that operations that occur on the file happen much more quickly. 4D will automatically manage the storage and backup of the external data. Or, if you prefer, customize it to your own needs and manage the backup yourself. In the latter scenario, you can store the paths to these external files within 4D, which will remain part of the data that uses the file.


SQL Dump and Insert

4D v12 introduces new SQL-related commands for exporting and importing data.

The SQL EXPORT DATABASE command exports all the records and tables of a database in SQL format.


The SQL EXPORT SELECTION command exports the records of the current selection of a 4D table in SQL format.


Previously, 4D export formats were binary. SQL dump is in highly readable text format.


And although text data is not standard/normalized between various platforms, 4D can accept data from multiple SQL engines using the SQL EXECUTE SCRIPT command, which supports multiple inserts, joins and more.

Use Multiple Databases

4D v12 can be used to create, modify and use "external databases" via the SQL language.

An external database is an auxiliary 4D database linked with the main 4D database.


Multiple external databases can be used with the same 4D database, and a 4D client can access external databases on the same server.  This can all be accomplished without having to close or restart the application, in a matter totally transparent to the user.


Integrated Database

A powerful relational database is fully integrated into 4D.

4D provides a true enterprise-class database, with the capacity to process massive databases while keeping the same responsiveness and performance you've come to expect in 4D. We've shattered all previous database size limits to give both new and existing databases much more breathing room.

It is up to the challenge of even the most demanding projects.

4D's large capacity lets you serve ever-increasing data storage requirements without a problem, and provides the speed for guaranteed performance no matter how large your database.