XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''"> Miscellaneous Database Functions
There are many Patran functions which affect the overall behavior of a database. Through these function, it is possible to open a database, close a database, commit the latest change to a database or undo the latest change to a database. These functions are described below.
To open a database from an external program, the function is “db_open_database” is used. Only one database can be open to Patran functions at a given time.
Input: | | |
CHARACTER STRING | <database_name> | The name of the database to be opened. |
Output: | | |
INTEGER | <Return Value> | This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error. |
Notes:
The C call is “DbOpenDatabase”.
int DbOpenDatabase ( database_name )
char *database_name
To close the previously opened database from an external program, “db_close_database” is used. Closing a database automatically commits the latest change to the database. So, it is never necessary to explicitly commit changes to a database unless the application desires to do such.
Output: | | |
INTEGER | <Return Value> | This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error. |
Notes:
The C call is “DbCloseDatabase”.
int DbCloseDatabase ()
PCL functions which are incorporated into the main Patran program should not use the
db_open_database and
db_close_database functions. Only external programs should make use of these functions. In order to open or close databases from within the Patran program, use
ui_file_close.go,
uil_file_new.go and
ui_file_open.go which are described in
Viewport Menu (p. 223) in the PCL Reference Manual.
The last change made to a database is not committed to the database until another database change is made, the database is closed, or the change is explicitly committed to the database. The “db_commit” function will explicitly commit the last change to a database. Since, a new database change automatically commits the previous change and closing a database automatically commits the last change, the function “db_commit” is not required but can be used if the application desires. Possible reasons for explicitly committing changes to a database include ensuring that the changes will not be destroyed by a program or system failure or preventing you from undoing the latest change to the database.
Output: | | |
INTEGER | <Return Value> | This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error. |
Notes:
The C call is “Dbcommit”.
int Dbcommit ()
The last change made to a database (if not explicitly committed by “db_commit”) can be undone. The “db_undo” function performs this operation.
Output: | | |
INTEGER | <Return Value> | This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error. |
Notes:
The C call is “DbUndo”.
int DbUndo ()
From within the Patran program it is preferable to use the uil_db_commit and uil_bd_undo functions described in
Viewport Menu (p. 223) in the PCL Reference Manual. The db_count and db_undo functions are more intended for use by external programs.
Opening a Patran database automatically begins a transaction between the program and the database. The db_commit and uil_db_commit programs not only commit the last transaction but also begin a new transaction. Sometimes it is necessary to commit the last transaction with beginning a new transaction. This is the case when an external program is to be spawned which extracts information from the database. The function described below ends the last transaction without beginning a new transaction.
Output: | | |
INTEGER | <Return Value> | This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error. |
Notes:
This function is not FORTRAN callable. The C call is “DbCommitRaw”.
int DbCommitRaw ()
Once a program has issued a db_commit_raw command it must start a new database transaction prior to issuing any other database commands. The function to start a new database traction is described below. The function should only be called if the last database command issued by the program is db_commit_raw.
.
Output: | | |
INTEGER | <Return Value> | This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error. |
Notes:
This function is not FORTRAN callable. The C call is “DbStartTransactionRaw”.
int DbStartTransactionRaw ()
To determine whether a program has a database currently open or not the following function should be used.
Output: | | |
LOGICAL | <Return Value> | Flag which specifies whether a database is open (TRUE) or not (FALSE). |
Notes:
This function is not FORTRAN callable. The C call is “DbIsOpen”.
int DbIsOpen ()
To get the name of the currently opened database use db_name_get.
Output: | | |
STRING | <database_name> |
| | The name of the currently opened database. |
INTEGER | <Return Value> | This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error. |
Notes:
This function is not FORTRAN callable. Also the C call differs in argument list.
The C call is as follows:
Input: | | |
INTEGER | <maximum_length> |
| | The maximum length of the output database name. |
Output: | | |
STRING | <database_name> |
| | The name of the currently opened database. |
INTEGER | <Return Value> | This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error. |
int DbNameGet ( maximum_length, database_name )
int maximum_length
char *database_name