T4S4  18.2 C7549 A21431
Teamcenter Gateway for SAP S/4HANA API Reference
SQL interface to the internal T4x database

Namespaces

 API::Core::Sql
 SQLlite interface to the internal T4x database.
 

Functions

 begin databaseRef
 Marks the begin of a database transaction. More...
 
 commit databaseRef
 Marks the completion of a database transaction as successful. More...
 
 connect databaseRef databaseFileName
 Opens a connection with a database. More...
 
 createIndex databaseRef indexName tableName columnNameList args
 Creates an index. More...
 
 createTable databaseRef tableName columnNameTypeList args
 Creates a table. More...
 
 delete databaseRef tableName whereCondition
 Deletes one or more rows from a table. More...
 
 deleteIndex databaseRef indexName
 Deletes an index. More...
 
 deleteTable databaseRef tableName
 Deletes a table. More...
 
 disconnect databaseRef
 Closes a connection with a database. More...
 
 executeSql databaseRef sqlStatement
 Executes an SQL statement. More...
 
 explainSql databaseRef sqlStatement
 Retrieves the execution plan of an SQL statement without executing the statement. More...
 
 export databaseRef tableName filePath
 Exports the content of a table to a CSV (tab-separated) file. More...
 
 getIndexInfo databaseRef indexName
 Retrieves meta information about an index. More...
 
 getIndexInfoList databaseRef
 Retrieves meta information about all indexes in the database. More...
 
 getShowSql
 Tells, if SQL statements are shown. More...
 
 getTableInfo databaseRef tableName
 Retrieves meta information about a table. More...
 
 getTableInfoList databaseRef
 Retrieves meta information about all tables in the database. More...
 
 import databaseRef tableName filePath
 Imports the content of a CSV (tab-separated) file to a table. More...
 
 insert databaseRef tableName columnValueList
 Inserts a row into a table. More...
 
 optimizeSpace databaseRef
 Optimizes the database with respect to space. More...
 
 optimizeTime databaseRef
 Optimizes the database with respect to time. More...
 
 rollback databaseRef
 Marks the completion of a database transaction as not successful. More...
 
 select databaseRef columnNameList tableNameList whereCondition args
 Retrieves one or more rows of one or more tables. More...
 
 setShowSql showSql
 Changes, if SQL statements are shown. More...
 
 update databaseRef tableName columnNameValueList whereCondition
 Updates one or more rows of a table. More...
 

Detailed Description

Function Documentation

◆ begin()

API::Core::Sql::begin   databaseRef  

Marks the begin of a database transaction.

Transactions may be nested

Parameters
databaseRef: a reference to a variable name representing the database
Returns
1=ok 0=error

◆ commit()

API::Core::Sql::commit   databaseRef  

Marks the completion of a database transaction as successful.

In case there is no transaction nesting, the effects of the transaction are made permanent. In case there is transaction nesting, the outermost transaction commits successfully if and only if all transactions including the subtransactions commit successfully. In this case the effects of all transactions are made permanent

Parameters
databaseRef: a reference to a variable name representing the database
Returns
1=ok 0=error

◆ connect()

API::Core::Sql::connect   databaseRef databaseFileName  

Opens a connection with a database.

Parameters
databaseRef: a reference to a variable name representing the database
databaseFileName: the file name of the database file
Returns
1=ok 0=error

◆ createIndex()

API::Core::Sql::createIndex   databaseRef indexName tableName columnNameList args  

Creates an index.

Parameters
databaseRef: a reference to a variable name representing the database
indexName: the index name
tableName: the table name
columnNameList: a list of column names, e.g [list b c]
args: (optional) constraints
  • if "unique": a list defining if the index has to be unique, e.g. [list unique]
Returns
1=ok 0=error

◆ createTable()

API::Core::Sql::createTable   databaseRef tableName columnNameTypeList args  

Creates a table.

Parameters
databaseRef: a reference to a variable name representing the database
tableName: the table name
columnNameTypeList: a list of column names and types, e.g. [list a integer b text c "text|unique|not null" d integer]
args: (optional) constraints
  • if "primaryKey": a list defining a primary key, e.g. [list primaryKey a]
  • if "foreignKey": a list defining a foreign key, e.g. [list foreignKey d table1]
  • if "check": a list defining a check constraint, e.g. [list check "b LIKE 'tes%plm%are'"]
Returns
1=ok 0=error

◆ delete()

API::Core::Sql::delete   databaseRef tableName whereCondition  

Deletes one or more rows from a table.

Parameters
databaseRef: a reference to a variable name representing the database
tableName: the table name
whereCondition: a condition specifying which rows to delete
Returns
1=ok 0=error

◆ deleteIndex()

API::Core::Sql::deleteIndex   databaseRef indexName  

Deletes an index.

Parameters
databaseRef: a reference to a variable name representing the database
indexName: the index name
Returns
1=ok 0=error

◆ deleteTable()

API::Core::Sql::deleteTable   databaseRef tableName  

Deletes a table.

Parameters
databaseRef: a reference to a variable name representing the database
tableName: the table name
Returns
1=ok 0=error

◆ disconnect()

API::Core::Sql::disconnect   databaseRef  

Closes a connection with a database.

Parameters
databaseRef: a reference to a variable name representing the database
Returns
1=ok 0=error

◆ executeSql()

API::Core::Sql::executeSql   databaseRef sqlStatement  

Executes an SQL statement.

Parameters
databaseRef: a reference to a variable name representing the database
sqlStatement: the SQL statement
Returns
statement result=ok ""=error

◆ explainSql()

API::Core::Sql::explainSql   databaseRef sqlStatement  

Retrieves the execution plan of an SQL statement without executing the statement.

Parameters
databaseRef: a reference to a variable name representing the database
sqlStatement: the SQL statement
Returns
execution plan=ok ""=error

◆ export()

API::Core::Sql::export   databaseRef tableName filePath  

Exports the content of a table to a CSV (tab-separated) file.

If the file does not exist, the file is created; otherwise, the file is overwritten.

Parameters
databaseRef: a reference to a variable name representing the database
tableName: the name of the table
filePath: the file path of the file
Returns
1=ok 0=error

References API::Core::Sql::select().

◆ getIndexInfo()

API::Core::Sql::getIndexInfo   databaseRef indexName  

Retrieves meta information about an index.

Parameters
databaseRef: a reference to a variable name representing the database
indexName: the index name
Returns
index info=ok ""=error

◆ getIndexInfoList()

API::Core::Sql::getIndexInfoList   databaseRef  

Retrieves meta information about all indexes in the database.

Parameters
databaseRef: a reference to a variable name representing the database
Returns
index info=ok ""=error

◆ getShowSql()

API::Core::Sql::getShowSql

Tells, if SQL statements are shown.

Returns
1=yes 0=no ""=error

◆ getTableInfo()

API::Core::Sql::getTableInfo   databaseRef tableName  

Retrieves meta information about a table.

Parameters
databaseRef: a reference to a variable name representing the database
tableName: the table name
Returns
table info=ok ""=error

◆ getTableInfoList()

API::Core::Sql::getTableInfoList   databaseRef  

Retrieves meta information about all tables in the database.

Parameters
databaseRef: a reference to a variable name representing the database
Returns
table info=ok ""=error

◆ import()

API::Core::Sql::import   databaseRef tableName filePath  

Imports the content of a CSV (tab-separated) file to a table.

If the table does not exist, an error is raised

Parameters
databaseRef: a reference to a variable name representing the database
tableName: the name of the table
filePath: the file path of the file
Returns
1=ok 0=error

References API::Core::Sql::insert().

◆ insert()

API::Core::Sql::insert   databaseRef tableName columnValueList  

Inserts a row into a table.

Parameters
databaseRef: a reference to a variable name representing the database
tableName: the table name
columnValueList: a list of column values, e.g [list NULL 1 "'new string value'"]
Returns
1=ok 0=error

Referenced by API::Core::Sql::import().

◆ optimizeSpace()

API::Core::Sql::optimizeSpace   databaseRef  

Optimizes the database with respect to space.

Parameters
databaseRef: a reference to a variable name representing the database
Returns
1=ok 0=error

◆ optimizeTime()

API::Core::Sql::optimizeTime   databaseRef  

Optimizes the database with respect to time.

Parameters
databaseRef: a reference to a variable name representing the database
Returns
1=ok 0=error

◆ rollback()

API::Core::Sql::rollback   databaseRef  

Marks the completion of a database transaction as not successful.

In case there is no transaction nesting, the effects of the transaction are made undone. In case there is transaction nesting, the outermost transaction rolls back successfully if and only if any transaction including the subtransactions rolls back successfully. In this case the effects of all transactions are made undone

Parameters
databaseRef: a reference to a variable name representing the database
Returns
1=ok 0=error

◆ select()

API::Core::Sql::select   databaseRef columnNameList tableNameList whereCondition args  

Retrieves one or more rows of one or more tables.

Parameters
databaseRef: a reference to a variable name representing the database
columnNameList: a list of column names, e.g. [list tab1.a tab1.b tab2.a tab2.c]
tableNameList: a list of table names, e.g. [list tab1 tab2]
whereCondition: a condition specifying which rows to retrieve
args: (optional) additional arguments
  • if "distinct": a list defining if only distinct values for the specified columns are allowed, e.g. [list distinct]
  • if "orderBy": a list defining the columns to order by, e.g. [list orderBy tab1.a tab2.a]
Returns
table rows=ok ""=error

Referenced by API::Core::Sql::export().

◆ setShowSql()

API::Core::Sql::setShowSql   showSql  

Changes, if SQL statements are shown.

Parameters
showSql: if SQL statements are shown: 1 = "yes", 0 = "no"
Returns
1=ok 0=error

◆ update()

API::Core::Sql::update   databaseRef tableName columnNameValueList whereCondition  

Updates one or more rows of a table.

Parameters
databaseRef: a reference to a variable name representing the database
tableName: the table name
columnNameValueList: a list of column names and values, e.g [list a 100 b 'luck']
whereCondition: a condition specifying which rows to update
Returns
1=ok 0=error