Обсуждение: About PostgreSQL as developer

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

About PostgreSQL as developer

От
Hernán Cano Martínez
Дата:

Hi, boys.
I am interested in the way of implement PostgreSQL in my apps --if possible-- in a native way.
I am in a project that use C++ as the base programming-language.

We want a guidance from you with this respect.

Thanks.


HERNAN CANO MARTINEZ
Analista de Sistemas - Programador
jhernancanom@hotmail.com
Medellín, Antioquia, Colombia
Cel: 300-782.48.44.
Cel: 316-601.12.67.

Re: About PostgreSQL as developer

От
John R Pierce
Дата:
On 11/02/12 10:11 PM, Hernán Cano Martínez wrote:
> I am interested in the way of implement PostgreSQL in my apps --if
> possible-- in a native way.
> I am in a project that use C++ as the base programming-language.
>
> We want a guidance from you with this respect.

the native API from C is libpq ...   see
http://www.postgresql.org/docs/current/static/libpq.html

there's a C++ wrapper, libpqxx, here http://pqxx.org/development/libpqxx/



--
john r pierce                            N 37, W 122
santa cruz ca                         mid-left coast




Re: About PostgreSQL as developer

От
Scott Marlowe
Дата:
On Fri, Nov 2, 2012 at 11:11 PM, Hernán Cano Martínez
<jhernancanom@hotmail.com> wrote:
>
> Hi, boys.
> I am interested in the way of implement PostgreSQL in my apps --if
> possible-- in a native way.
> I am in a project that use C++ as the base programming-language.

If you want an embedded db, you'd likely do better looking elsewhere.
PostgreSQL's design does not lend itself to embedded work. SQLite is a
good choice there.

If you're looking at writing a self-contained app etc then you could
look at something like a live CD with it, google pglive for an
example.


Re: About PostgreSQL as developer

От
Craig Ringer
Дата:
On 11/05/2012 12:33 PM, Scott Marlowe wrote:
> On Fri, Nov 2, 2012 at 11:11 PM, Hernán Cano Martínez
> <jhernancanom@hotmail.com> wrote:
>> Hi, boys.
>> I am interested in the way of implement PostgreSQL in my apps --if
>> possible-- in a native way.
>> I am in a project that use C++ as the base programming-language.
> If you want an embedded db, you'd likely do better looking elsewhere.
> PostgreSQL's design does not lend itself to embedded work. SQLite is a
> good choice there.
Agreed. For small DBs or apps that must be portable, PostgreSQL isn't a
great choice, and it's utterly unsuitable if you want to embed the
database in-process. For that you want SQLite or Firebird.

In particular, I strongly advise you not to bundle the EnterpriseDB
installer in an application as a silent install. The poor user will
wonder where this "PostgreSQL" thing came from and might just uninstall
it. Or they might try to use it and wonder why they don't know the
passwords. They might even try to install another package that bundles
PostgreSQL, or directly install PostgreSQL for their own use, and find
out that they can't because your app has already installed it.

The standard installer version doesn't like having the data directory
moved around or having permissions messed with, doesn't like the service
account password being changed (pre-9.2), etc. It's really not ideal for
bundling in an application.

If you want to use PostgreSQL, consider distributing the .zip binaries
without the installer. Start PostgreSQL on demand with `pg_ctl` or by
installing your own service in Windows services / launchd / systemd /
etc. Run PostgreSQL on a non-standard port so you don't conflict with
any installs the user may do themselves. You'll need to check for some
common problems like the user trying to put the data directory on a
FAT32 volume, which isn't supported, but that isn't hard.

--
Craig Ringer