Difference between revisions of "ADATABASES()"

From Lianjapedia
Jump to: navigation, search
(Products)
 
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
Function to place the names of all open databases and their paths into a variable array.
+
Function to place the name of the open database and its path into a dynamic array.
 
+
  
 
==Syntax==
 
==Syntax==
 
ADATABASES(<array>)
 
ADATABASES(<array>)
 
  
 
==See Also==
 
==See Also==
[[ADIR()]], [[ALIAS()]], [[CLOSE DATABASES]], [[COPY DATABASE]], [[DATABASE()]], [[DBF()]], [[DBUSED()]], [[DISPLAY SCHEMAS]], [[DISPLAY STATUS]], [[GETENV()]], [[LIST SCHEMAS]], [[LIST STATUS]], [[OPEN DATABASE]], [[SET SQL]], [[SQL USE|USE]], [[USED()]]
+
[[ADIR()]], [[ALIAS()]], [[ATABLES()]], [[CLOSE DATABASES]], [[COPY DATABASE]], [[DATABASE()]], [[DBC()]], [[DBF()]], [[DBUSED()]], [[DISPLAY SCHEMAS]], [[DISPLAY STATUS]], [[GETENV()]], [[LIST SCHEMAS]], [[LIST STATUS]], [[OPEN DATABASE]], [[SET SQL]], [[SQL USE|USE]], [[USED()]]
 
+
  
 
==Description==
 
==Description==
The ADATABASES() function is used to place the names of all open databases and their paths into a variable array.  The name if the array is specified in <array>.  If the array does not exist, it is created.  If the array is smaller or larger than required, it is resized.  The array is two-dimensional with two columns.  The first column contains the name of an open database, the second the path for that database.
+
The ADATABASES() function is used to place the name of the open database and its path into a dynamic array.  The name of the array is specified in <array>.  If the array does not exist, it is created.  If the array is smaller or larger than required, it is resized.  The array is two-dimensional with two columns.  The first column contains the name of the open database, the second the path for that database.
  
The ADATABASES() function returns the number of database names added to the array.  If no databases are open or the array cannot be created, the ADATABASES() function returns 0.
+
The ADATABASES() function returns 1 if the open database name has been added to the array.  If no databases are open or the array cannot be created, the ADATABASES() function returns 0.
 
+
NOTE: The ADATABASES() function operates on databases, not tables.
+
 
+
Databases in Recital are implemented as directories containing files that correspond to the tables and associated files in the database.  Operating System file protection can be applied individually to the files for added security.  The directories are sub-directories of the Recital data directory.  The environment variable / symbol DB_DATADIR points to the current Recital data directory and can be queried using the GETENV() function.  Files from other directories can be added to the database using the ADD TABLE command or via the database catalog and SET AUTOCATALOG functionality.
+
 
+
Databases can be opened using the SQL USE command, with SQL set to MYSQL, or using the SQL OPEN DATABASE command.
+
  
 +
NOTE: The ADATABASES() function operates on the open database, not tables.
  
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
VFP/SQL> OPEN DATABASE hr EXCLUSIVE
+
OPEN DATABASE hr EXCLUSIVE
VFP/SQL> nDatabases = adatabases(aDBCNames)
+
nDatabases = adatabases(aDBCNames)
VFP/SQL> CLOSE DATABASES
+
CLOSE DATABASES
 
</code>
 
</code>
  
 
==Products==
 
Recital Server, Recital
 
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]
 
[[Category:SQL]]
 
[[Category:SQL]]
[[Category:Databases]]
+
[[Category:Database Functions]]
[[Category:Databases Functions]]
+
[[Category:Array Processing Functions]]

Latest revision as of 23:39, 20 May 2018

Purpose

Function to place the name of the open database and its path into a dynamic array.

Syntax

ADATABASES(<array>)

See Also

ADIR(), ALIAS(), ATABLES(), CLOSE DATABASES, COPY DATABASE, DATABASE(), DBC(), DBF(), DBUSED(), DISPLAY SCHEMAS, DISPLAY STATUS, GETENV(), LIST SCHEMAS, LIST STATUS, OPEN DATABASE, SET SQL, USE, USED()

Description

The ADATABASES() function is used to place the name of the open database and its path into a dynamic array. The name of the array is specified in <array>. If the array does not exist, it is created. If the array is smaller or larger than required, it is resized. The array is two-dimensional with two columns. The first column contains the name of the open database, the second the path for that database.

The ADATABASES() function returns 1 if the open database name has been added to the array. If no databases are open or the array cannot be created, the ADATABASES() function returns 0.

NOTE: The ADATABASES() function operates on the open database, not tables.

Example

OPEN DATABASE hr EXCLUSIVE
nDatabases = adatabases(aDBCNames)
CLOSE DATABASES