[Dovecot] Oracle SQL driver

Alexander Bukharov bukharov at bpc.ru
Wed Jan 6 14:09:12 EET 2010


> The transaction handling doesn't look correct to me. The sql_update()s
> just add the change to a linked list and commit() is then supposed to
> run them in one transaction and either everything should succeed or
> fail. Your commit appears to ignore errors and just commit everything
> that goes through? Also since nothing is actually sent before commit(),
> your rollback() shouldn't need to send ROLLBACK.

You right. I've corrected the transaction handling mechanism. The only
thing I couldn't understand: why rollback() shouldn't need to make real
ROLLBACK? In case when whole transaction was failed succeded statements
will remain uncommited. Then they will be commited later on next successful
transaction. May be ROLLBACK is still needed?

> The "VARCHAR sqltext[2048]" seems like an unnecessary restriction on the
> query length. Wasn't there a way to do this without the limit? Or in

AFAIK there is no possibility to use C types in PREPARE statement. Also
Oracle cannot handle unsized VARCHARs. I've increased VARCHAR size to
65535.

> test_connection() seems unnecessary.

Right you are.

> Couldn't driver_oracle_generate_name() be simply:
> static unsigned int counter = 0;
> return i_strdup_printf("ORACONN_%x", ++counter);

=) Right.

> driver_oracle_escape_string() really should be escaping the string.

I made this function to replace single quote in string with two single
quotes. IMHO this should be enough. How do you think?

> Kind of annoying that each query needs a cursor, even though nearly all
> queries are expected to return only a single row, but I guess that can't
> be helped with the current API..

Yes. There are no other ways to work with untyped statements in OCI. But
Oracle claims that all these statements shouldn't produce significant
performance impact.

The new version attached.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: driver-oracle.pc
Type: application/octet-stream
Size: 25740 bytes
Desc: not available
Url : http://dovecot.org/pipermail/dovecot/attachments/20100106/e058341b/attachment-0001.obj 


More information about the dovecot mailing list