[Lazarus] What is a TSQLTransaction and why do I need one?

Alexsander Rosa alexsander.rosa at gmail.com
Tue Nov 23 18:01:35 CET 2010


I think the statement "without a transaction, Postgres will do nothing,
ever". For example: you can write a small C program using libpq that
executes a simple SELECT without any transaction SQL code. Here's a comment
from PostgreSQL's website [1]:

    /*
     * Our test case here involves using a cursor, for which we must be inside
     * a transaction block.  We could do the whole thing with a single
     * PQexec() of "select * from pg_database", but that's too trivial to make
     * a good example.
     */

Been there, done that. I've been programming C + libpq for almost a decade
now. There's another example at another website that do not use transactions
at all: http://momjian.us/main/writings/pgsql/writing_apps/

[1] http://www.postgresql.org/docs/current/static/libpq-example.html

2010/11/23 Joost van der Sluis <joost at cnoc.nl>

>
> Well, you always need a transaction. Without a transaction, Postgres
> will do nothing, ever.
>
> I assume you are used to the fact that postgres automatically creates an
> transaction for you. With Sqldb you have to do this yourself.
>

-- 
Atenciosamente,
Alexsander da Rosa
Linux User #113925

"Extremismo na defesa da liberdade não é defeito.
Moderação na busca por justiça não é virtude."
-- Barry Goldwater
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20101123/2ca728f0/attachment-0003.html>


More information about the Lazarus mailing list