Обсуждение: Terms advice.

Поиск
Список
Период
Сортировка

Terms advice.

От
Dmitriy Igrishin
Дата:
Hey all,

I am working on C++ library to work with PostgreSQL.

I am trying to follow strong correctness in terms.
One of my current dilemmas is how to distinguish the results
of commands in correct terms. E.g., is it correct to call commands
which returns tuples as "queries" but commands like which does
not returns tuples (e.g. "BEGIN") as "commands" ?

Any advises are welcome !

--
// Dmitriy.


Re: Terms advice.

От
Craig Ringer
Дата:
On 11/26/2010 09:37 PM, Dmitriy Igrishin wrote:
> Hey all,
>
> I am working on C++ library to work with PostgreSQL.

Are you aware of libpqxx ?

Is your intent to implement the protocol from scratch in c++ rather than
wrap libpq? If so, why?

--
Craig Ringer

Re: Terms advice.

От
Dmitriy Igrishin
Дата:
Hey Craig,

I know about libpqxx. But I like to implement my library
just for fun :-).

The one goal of my library is to support all features of libpq.
So, I don't intent to implement the protocol from scratch
and use libpq as basis.

Another goal of my library is to be very clean and consistent
in terms. For example, I want avoid the situations like this.
consider PQsendQuery function of libpq:

int PQsendQuery(PGconn *conn, const char *command);

Description: "Submits a command to the server ... "

Because I meticulous, I don't clearly understand, why
function called PQsendQuery rather than PQsendCommand?
There is no consistence between name of function and name
of its second argument, and furthermore according to
http://www.postgresql.org/docs/9.0/static/sql-commands.html
users operates with commands (not queries) :-)
But according to SQL (structured query language) users
operates with queries :-)

Next, consider
http://www.postgresql.org/docs/9.0/static/libpq-exec.html#LIBPQ-EXEC-SELECT-INFO

"These functions are used to extract information from a PGresult
object that represents a successful query result (that is, one that
has status PGRES_TUPLES_OK)... ". Well, here "query" used as
a command which returns data (tuples). But this is inconsistent
e.g., with mentioned PQsendQuery, because in this case "query"
can be a "command" which returns no data (and in terms of SQL
it is correct).

Of course, this may seem petty and not worthy of such attention.
But I believe that extra correctness helps better understand any
library or program.

BTW. "query" and "command" are synonyms, as I mentioned
above. :-)

2010/11/27 Craig Ringer <craig@postnewspapers.com.au>
On 11/26/2010 09:37 PM, Dmitriy Igrishin wrote:
Hey all,

I am working on C++ library to work with PostgreSQL.

Are you aware of libpqxx ?

Is your intent to implement the protocol from scratch in c++ rather than wrap libpq? If so, why?

--
Craig Ringer



--
// Dmitriy.