29 lines
1.4 KiB
Markdown
29 lines
1.4 KiB
Markdown
## ormCheckTable()
|
|
|
|
The `ormCheckTable()` command checks for the existence of a table in a specific database and stores the result in a destination variable. This command is useful for verifying if a table already exists before attempting further operations on it.
|
|
|
|
### Parameters
|
|
|
|
* dbaseName Type: value Description: The name of the database in which the table's existence should be checked. It should be a string indicating the database to check.
|
|
* varTarget Type: variable Description: The variable in which the result of the check will be stored. It should be a variable that will receive a value indicating whether the table exists or not.
|
|
|
|
### Command Flow
|
|
|
|
### Example Usage
|
|
|
|
Suppose you want to check if a table called `users` exists in a database called `myDatabase`.
|
|
|
|
```javascript
|
|
// Define variables
|
|
dbaseName = "myDatabase"
|
|
tableExists = ''
|
|
|
|
// Call the command to check the existence of the table
|
|
ormCheckTable(dbaseName, tableExists)
|
|
|
|
// Return the result of the check via addResult
|
|
addResult(tableExists)
|
|
```
|
|
|
|
In this example, the `ormCheckTable()` command will check for the existence of the `users` table in the `myDatabase` database. The result of the check (whether the table exists or not) will be stored in the `tableExists` variable, and this variable will be returned via `addResult(tableExists)`. The output will reflect whether the table exists (True) or not (False).
|