Subject Re: [firebird-python] Re: How to use PowerConsole?
Author Pavel Cisar
Dobedani napsal(a):
> Hi Pavel,
>
> Thanks for reacting. I would like to use PowerConsole interactively.
> The documentation states that if I use the command RUN, I have to use
> an 'iterable containing lines to execute'. What in the world does
> that mean? I'm sorry, but with such terminology the documentation is
> not enough for me. Could you make an example available showing how to
> make a connection to a database etc.? TIA

1. RUN command executes commands stored in a file (or iterable like
Python list, open file object, string etc.) as they were typed in
console. You don't need to use it, but it may come handy when you
connect to certain databases often, as you can store connect (and other
commands, function definitions etc.) in a file and run it instead typing
it again and again.

2. To connect to a database, use "connect" command (see HELP CONNECT for
details). The documentation
(http://ibphoenix.cz/pwc/pwcfb/pwc-commands.html#connect) is IMO clear
about it. Pages http://ibphoenix.cz/pwc/pwcfb/sql-support.html and
http://ibphoenix.cz/pwc/pwcfb/python-objects.html contains many examples
how to work with database, like:

>>> connect 'employee' user 'sysdba' password 'masterkey'
Database employee as db, user sysdba
>>> list name,owner_name in db.tables
name owner_name
================ ==========
COUNTRY SYSDBA
JOB SYSDBA
DEPARTMENT SYSDBA
EMPLOYEE SYSDBA
PROJECT SYSDBA
CUSTOMER SYSDBA
EMPLOYEE_PROJECT SYSDBA
PROJ_DEPT_BUDGET SYSDBA
SALARY_HISTORY SYSDBA
SALES SYSDBA

best regards
Pavel Cisar
IBPhoenix