14.3 Database commands
These commands are useful to manage the databases trough a script.
DBCLOSE (UINT)Handle
Close a database and release its resources.
Parameters: | ||
Handle | It's the database handle returned by the DBOPEN command. |
Return values:
If it fails (e.g. the database is already closed or the handle is invalid), 0
(false) is returned, otherwise 1 (true) is set.
Example:
DBCLOSE 13423
See also:
DBCREATE,
DBOPEN,
DBGET,
DBGETID,
DBPUT.
DBCREATE (CHAR)FileName (CHAR)DbaseFormat
(CHAR)MolFormat (CHAR)MolCompression (INT)Flags
Create a new empty database. Please remember that you need call the DBOPEN
function to change the database contents after its creation.
Parameters: | ||||||||||
FileName | File name or directory name with or without full path. The extension is added automatically. |
|||||||||
DbaseFormat | Database format. The allowed keywords are: |
|||||||||
|
||||||||||
MolFormat | Default molecule format (see -f command line option). This field is ignored by SD files. |
|||||||||
MolCompression | Default molecule compression (NONE, BZIP2, GZIP, POWERPACKER, ZCOMPRESS). This field is ignored by File and Sdf database format. |
|||||||||
Flags | Default database flags. These flags can be combined with the OR operator.
|
Return values:
Error code if it fails.
Example:
DBCREATE "NewDatabase" zip pdb
none 0
See also:
DBCLOSE,
DBOPEN,
DBGET,
DBGETID,
DBPUT.
DBGET (UINT)Handle (CHAR)MolName
(MCHAR)Mode
Extract a molecule from the database specifying its name.
Parameters: | ||||||||||
Handle | It's the database handle returned by the DBOPEN command. |
|||||||||
MolName | Name of the molecule to extract (with the file extension) . |
|||||||||
Mode | It's the extraction mode, that can be:
|
Return values:
If it fails (e.g. the database handle is invalid or the molecule name is wrong), 0
(false) is returned, otherwise 1 (true) is set.
Example:
DBGET 13423 Water.iff Replace
See also:
DBOPEN,
DBCLOSE,
DBGETID,
DBPUT.
DBGETID (UINT)Handle (CHAR)MolID
(MCHAR)Mode
Extract a molecule from the database specifying its identification number
(ID). Each database record has an ID that is a progressive number starting from
zero to the total number of record minus one. To obtain the total number of
molecules in a database, see the DBINFO command.
Parameters: | ||||||||||
Handle | It's the database handle returned by the DBOPEN command. |
|||||||||
MolID | Molecule identification number. |
|||||||||
Mode | It's the extraction mode, that can be:
|
Return values:
If it fails (e.g. the database handle is invalid or the molecule name is wrong), 0
(false) is returned, otherwise 1 (true) is set.
Example:
DBGETID 13423 4 Replace
See also:
DBOPEN,
DBCLOSE,
DBGET,
DBINFO,
DBPUT.
DBINFO (UINT)Handle (MCHAR)Variable
Obtain the value of a database variable.
Parameters: | ||||||||||||||||
Handle | Database handle returned by the DBOPEN command. |
|||||||||||||||
Variable | Database system variable. It can be:
|
Return values:
If the database exists, the variable value is returned.
Example:
DBINFO 26123 MOLECULES
See also:
DBCLOSE,
DBGET,
DGETID,
DBOPEN,
DBPUT.
DBOPEN (CHAR)DbName
Open an existing database. This command is required to access (read and write
operation) to an existing database.
Parameters: | ||
DbName | Database file name whit full path. |
Return values:
If the database exists, its handle is returned, otherwise the function returns 0
(error condition).
Example:
DBOPEN "Vega\Data\Fragments\Solvents.zip"
See also:
DBCLOSE,
DBCREATE,
DBGET,
DBGETID,
DBINFO,
DBPUT.
DBPUT (UINT)Handle (CHAR)MolName
Put the current molecule in the specified database.
Parameters: | ||
Handle | It's the database handle returned by the DBOPEN command.. |
|
NolName | Name of the molecule to put with the file extension, if the database format requires it (e.g. file and zip). If the molecule is already present in the database, it will be replaced by the new one (update mode). |
Return values:
If it fails (e.g. the database handle is invalid), 0
(false) is returned, otherwise 1 (true) is set.
Example:
DBPUT 13182 "MyMolecule"
See also:
DBCLOSE,
DBCREATE,
DBGET,
DBGETID,
DBINFO,
DBOPEN.