4D v14CREATE DATABASE |
||||||||||||||
|
4D v14
CREATE DATABASE
CREATE DATABASE
The CREATE DATABASE command lets you create a new external database (.4db and .4dd files) at a specific location. If the IF NOT EXISTS constraint is passed, the database is not created and no error is generated if a database with the same name already exists at the location specified. The DATAFILE clause lets you specify the complete name (complete pathname + name) of the new external database. You must pass the name of the structure file. The program automatically adds the ".4db" extension to the file if it is not already specified and creates the data file. The pathname can be expressed either in POSIX syntax or in the system syntax. It can be absolute or relative to the structure file of the main 4D database.
After successful execution of the CREATE DATABASE command, the new database created does not automatically become the current database. To do this, you must explicitly declare it as the current database using the USE DATABASE command. An external database is a 4D database that is independent from the main 4D database, but that you can work with from the main 4D database by using the SQL engine of 4D. Using an external database means temporarily designating this database as the current database, in other words, as the target database for the SQL queries executed by 4D. By default, the main database is the current database. You can create an external database directly from the main database with the CREATE DATABASE command. Once created, an external database can be designated as the current database using the USE DATABASE command. It can then be modified via standard SQL commands (CREATE TABLE, ALTER TABLE, etc.) and you can store data in it. The DATABASE_PATH function can be used to find out the current database at any time. Note: An external database is a standard 4D database. It can be opened and worked with as the main database by a 4D or 4D Server application. Conversely, any standard 4D database can be used as an external database. However, it is imperative that you do not activate the access management system (by assigning a password to the Designer) in an external database, otherwise you will no longer be able to have access to it via the USE DATABASE command. Creation of ExternalDB.4DB and ExternalDB.4DD external database files at the location C:/MyDatabase/: Begin SQL Creation of TestDB.4DB and TestDB.4DD external database files next to the structure file of the main database: Begin SQL Creation of External.4DB and External.4DD external database files at the location specified by the user: C_TEXT($path) |
PROPERTIES
Product: 4D SEE ALSO ARTICLE USAGE
4D SQL Reference ( 4D v14) |
||||||||||||