Subject | Re: [firebird-python] Is it possible to execute a sql script with KInterbasDB? |
---|---|
Author | Sasha Matijasic |
Post date | 2009-04-22T23:02:06Z |
> Long anwser:Thanks, but that's not what I was looking for. I have a sql script
> import kinterbasdb
> if not kinterbasdb.initialized:
> kinterbasdb.init(type_conv=200,concurrency_level=1)
>
> con = kinterbasdb.connect(
> host='192.168.0.101', database='/data/db/pool.fdb',
> user='sysdba', password='masterkey',
> dialect=3, # necessary for all dialect 1 databases
> charset='UTF8' # specify a character set for the connection
> )
> cur = con.cursor()
> cur.execute('HERE YOU SCRIPT')
> cur.execute('HERE YOU SCRIPT')
>
> don't forget the commits.
>
containing multiple statements, and with your example I can only
execute a single sql statement in one cur.execute() call.
For example, my script is like this:
sql = """create table foo(a char(1) not null); create table bar(a
char(1)); commit;"""
cur.execute(sql)
Can this be done without any 3rd party library? (and if it can't, do
you know of any?)
Thanx,
sasha