Subject | Re: [firebird-python] Is it possible to execute a sql script with KInterbasDB? |
---|---|
Author | Sasha Matijasic |
Post date | 2009-04-24T08:30:32Z |
>Your approach doesn't work when the script is:
> The thing is, python's so adept at string handling that having this sort
> of feature in KInterbasDB would be redundant.
>
> If each line of SQL is one command, then you can do something like
> this:
>
recreate table b(a char(1) default ';' not null );
-- set term ^;
/* ; */
set term ^;
recreate procedure c(i char(1)='/*''')
returns (result char(1))
as begin
select '^' from rdb$database into :result;
end^
set term ;^
Admittedly, it's contrived example, but I do use set terms, and i do
have semicolons in strings, and i do have comments which can have
anything.
So, you can not do a string.split(';') nor you can assume each
statement is one line because it will not work. It's simply not a
string manipulation problem.
I guess I'll just shell out isql.
Thanx to everyone