Sometimes it might be necessary to manually work in a Darwin2 database. Eg you might want to find database entries that fulfill certain search criteria and Darwin2 doesn't offer an appropriate filter.
You can do that using the internal sql client that is installed with firebird.
Let's say we want to determine a list of all Patient-IDs:
- Open the windows command shell by executing "cmd"
- Change to the firebird folder: cd "\Program Files\Firebird\Firebird_2_5\bin"
- isql C:\ProgramData\Darwin2\Evolution2.fdb -user sysdba -pass masterkey
- Select Distinct(CustomId) from RecView;
As a result you will get the required list.
To find out which database fields are available, it makes sense to use a convenient database browser like the Firebird Maestro.
Run commands directly from batch file
If you want to perform modifications on the database through a script you do the following:
Create a file that contains the SQL-commands. Eg. the file "sql.txt" looks as follows:
|
|
Run that script using this command:
"C:\Program Files\Firebird\Firebird_2_5\bin\isql" e:\Evolution2.fdb -user sysdba -pass masterkey -i sql.txt
Exporting data via a batch-file
For integration into your product it might be necessary to automatically export data from the fireird database.
To do that create a file SqlExport.txt
| OUTPUT 'E:\export.txt'; SELECT Name, GroupName FROM Users; OUTPUT; |
and a file DoExport.bat
| "C:\Program Files\Firebird\Firebird_2_5\bin\isql.exe" -user SYSDBA -password masterkey E:\Evolution2.fdb -i E:\SqlExport.txt pause |
You will have to change the paths to match your configuration. Then you can simply run the batach-file and you'll get the results as an easy to parse text-table.
Have fun :)