Database class | QSYS API Reference Guide

Estimated reading time: 13 minutes

Handles connections to a Database.

Namespace: ASNA.QSys.Runtime Assembly: ASNA.QSys.Runtime.dll

Inheritance: Object

Constructors

Name Description
Database(String) Constructs a Database object using a database name.
Database(String, VirtualTerminal, OpenAccessDspF) Constructs a Database object using a database name, VirtualTerminal value, and OpenAccessDspF value.

Database(String)

Constructs a Database object using a database name.

Database(String)

Parameters

Type Parameter name Description
String databaseName Database name.

Database(String, VirtualTerminal, OpenAccessDspF)

Constructs a Database object using a database name, VirtualTerminal value, and OpenAccessDspF value.

Database(String, VirtualTerminal, OpenAccessDspF)

Parameters

Type Parameter name Description
String databaseName Database name.
VirtualTerminal virtualTerminal Value that specifies whether this connection will be used for an interactive virtual terminal connection.
OpenAccessDspF openAccessDspF Value that specifies whether this connection is for use with Open Access RPG programs.

Properties

Type Name Description
AdgConnection Connection Gets the DataGate Connection instance.
String[] CurrentUserLibl Sets the current library list for the current connection.
String DBName Gets the Database Name.
Int32 DefaultJobCodePageID Gets or sets the Job’s default Code Page ID.
dgException InitialException Gets the initial DataGate exception.
IEnumerable<String> InitialLibl Gets or sets the current database initial library list.
Boolean IsInteractive Gets a boolean value indicating that the Database is associated with an Interactive Job.
Boolean IsOpen Returns a True or False indicating if the database is open.
String Label Gets or sets a string containing the label of the database to connect to.
String[] NameStoreConfigFiles Gets the list of the database name store configuration files.
NameStoreOptions NameStoreOptions Gets the database name store options.
Boolean NameStorePrepared Gets whether the database name store has already been set for the process.
String Password Sets the password to be used in conjunction with User for connection authentication.
String PlatformAttribute Gets or sets a platform-specific attribute of the database engine.
Int32 PoolingTimeout Gets or sets the database PoolingTimeOut (in minutes).
Int32 Port Gets or sets the TCP port number used by the database server for TCP/IP-based transport (default 5042).
String Server The database server host machine name.
ServerSupport ServerSupport For interactive connections, determines if program can issue server requests like open file or call program.
String SslCertificateName Gets or sets the SSL Certificate name for the database connection.
SslOptions SslOptions Gets or sets the SLL Options for the database connection.
String TerminalDeviceName For interactive connections, determines the name of the device.
String Text Gets or sets a description of the database connection.
String User Gets or sets the user name that used to authorize thecurrent database connection.
VirtualTerminal VirtualTerminal VirtualTerminal summary.

Methods

Signature Description
AddMember(String, String) Add a member to a file.
ClearMember(String, String) Clear a file member.
Close() Closes a connection to a Database.
Commit(String) Commits an open transaction.
Connect() Open a connection to a Database.
CopyFileToDb(String, Database, String, Boolean) Copies a file with all its members and data, if they exist, from the current Database to another Database.
CopyLogicalFileToDb(String, Database, String, Boolean, Boolean) Copies a logical file and its base physical files from the current Database to another Database.
CreateDirectory(String) Creates a new directory (library) in the Database.
DeleteFile(String) Deletes a file from the Database.
Dispose(Boolean) Releases resources.
Dispose() Releases resources.
EndTpm() Ends a Database transaction operation.
GetNames(Boolean) Returns an array of strings with all of the database names found.
GetSourceProfile(String) Gets a SourceProfile from the Database name store.
InitializeMember(String, String, Int32) Initializes a file member with the specified number of deleted records.
Open() Open a connection to a Database.
PrepareNameStore<T>(NameStoreOptions, String[]) Prepares the Database name store. Should be called only once and before any attempt to use a DataGated database by name.
RemoveDirectory(String) Removes a directory (library) in the Database.
RemoveMember(String, String) Removes a member from the specified file.
RenameFile(String, String) Changes the name of a file in the Database.
RenameMember(String, String, String) Changes the name of a member in a file.
Rollback() Rollbacks, i.e. cancels, a transaction.
SetDatabaseName(String) Sets the Database name.
SetSourceProfile(SourceProfile) Sets the Database name.
StartTpm(Int32, String, String) Starts transaction processing.

void AddMember(string filePath, string memberName)

Add a member to a file.

void AddMember(string filePath, string memberName)

Parameters

Type Parameter name Description
String filePath Path to the file as “library/fileName”.
String memberName Name of the member to be added.

void ClearMember(string filePath, string memberName)

Clear a file member.

void ClearMember(string filePath, string memberName)

Parameters

Type Parameter name Description
String filePath Path to the file as “library/fileName”.
String memberName Name of the member to clear.

void Close()

Closes a connection to a Database.

void Close()

void Commit(string boundary)

Commits an open transaction.

void Commit(string boundary)

Parameters

Type Parameter name Description
String boundary Transaction name to commit.

void Connect()

Open a connection to a Database.

void Connect()

void CopyFileToDb(string filePath, Database toDb, string toDirectory, bool copyData)

Copies a file with all its members and data, if they exist, from the current Database to another Database.

void CopyFileToDb(string filePath, Database toDb, string toDirectory, bool copyData)

Parameters

Type Parameter name Description
String filePath Path of the file to be copied, as “library/fileName”.
Database toDb Database onto which the file will be copied.
String toDirectory Destination directory.
Boolean copyData True to copy also the file data.

void CopyLogicalFileToDb(string filePath, Database toDb, string toDirectory, bool replaceBaseFiles, bool copyData)

Copies a logical file and its base physical files from the current Database to another Database.

void CopyLogicalFileToDb(string filePath, Database toDb, string toDirectory, bool replaceBaseFiles, bool copyData)

Parameters

Type Parameter name Description
String filePath Path of the file to be copied, as “library/fileName”.
Database toDb Database onto which the file will be copied.
String toDirectory Destination directory.
Boolean replaceBaseFiles If true, if a base file already exists in the target DB it will be replaced. If false, if a base file already exists it will not be replaced.
Boolean copyData True to copy also the physical file data.

void CreateDirectory(string directoryName)

Creates a new directory (library) in the Database.

void CreateDirectory(string directoryName)

Parameters

Type Parameter name Description
String directoryName Name of the directory to be created.

void DeleteFile(string filePath)

Deletes a file from the Database.

void DeleteFile(string filePath)

Parameters

Type Parameter name Description
String filePath Path to the file as “library/fileName”.

void Dispose(bool disposing)

Releases resources.

void Dispose(bool disposing)

Parameters

Type Parameter name Description
Boolean disposing If True, it is safe to dispose of class members.

void Dispose()

Releases resources.

void Dispose()

void EndTpm()

Ends a Database transaction operation.

void EndTpm()

String[] GetNames(bool publicDBs)

Returns an array of strings with all of the database names found.

String[] GetNames(bool publicDBs)

Parameters

Type Parameter name Description
Boolean publicDBs A boolean parameter indicating whether to get Public Databases (true) or those private to the current user (false).

Returns

Type Description
String[]  

SourceProfile GetSourceProfile(string dbName)

Gets a SourceProfile from the Database name store.

SourceProfile GetSourceProfile(string dbName)

Parameters

Type Parameter name Description
String dbName Database name to search.

Returns

Type Description
SourceProfile The SourceProfile corresponding to the given dbName parameter.

void InitializeMember(string filePath, string memberName, int recordCount)

Initializes a file member with the specified number of deleted records.

void InitializeMember(string filePath, string memberName, int recordCount)

Parameters

Type Parameter name Description
String filePath Path to the file as “library/fileName”.
String memberName Name of the member to initialize.
Int32 recordCount Number of deleted records to add to the member.

void Open()

Open a connection to a Database.

void Open()

void PrepareNameStore<T>(NameStoreOptions options, String[] configFiles)

Prepares the Database name store. Should be called only once and before any attempt to use a DataGated database by name.

void PrepareNameStore<T>(NameStoreOptions options, String[] configFiles)

Parameters

Type Parameter name Description
NameStoreOptions options Tells the name store where to look for database connection information, e.g. config files, user secrets, and others.
String[] configFiles Optional collection of configuration files containing database connection information.

void RemoveDirectory(string directoryName)

Removes a directory (library) in the Database.

void RemoveDirectory(string directoryName)

Parameters

Type Parameter name Description
String directoryName Name of the directory to remove.

void RemoveMember(string filePath, string memberName)

Removes a member from the specified file.

void RemoveMember(string filePath, string memberName)

Parameters

Type Parameter name Description
String filePath Path to the file as “library/fileName”.
String memberName Name of the member to remove.

void RenameFile(string filePath, string newName)

Changes the name of a file in the Database.

void RenameFile(string filePath, string newName)

Parameters

Type Parameter name Description
String filePath Path to the file as “library/fileName”.
String newName New file name.

void RenameMember(string filePath, string memberName, string newName)

Changes the name of a member in a file.

void RenameMember(string filePath, string memberName, string newName)

Parameters

Type Parameter name Description
String filePath Path to the file as “library/fileName”.
String memberName Current member name.
String newName New member name.

void Rollback()

Rollbacks, i.e. cancels, a transaction.

void Rollback()

void SetDatabaseName(string databaseName)

Sets the Database name.

void SetDatabaseName(string databaseName)

Parameters

Type Parameter name Description
String databaseName Database name. Use null for a blank source profile.

void SetSourceProfile(SourceProfile sourceProfile)

Sets the Database name.

void SetSourceProfile(SourceProfile sourceProfile)

Parameters

Type Parameter name Description
SourceProfile sourceProfile The new source profile.

void StartTpm(int level, string name, string options)

Starts transaction processing.

void StartTpm(int level, string name, string options)

Parameters

Type Parameter name Description
Int32 level Transaction level.
String name Transaction name.
String options Transaction options.