Re: [libdbi-users] prepared statements

2015-06-11 Thread Alex Bligh

On 11 Jun 2015, at 08:12, Simon Walter si...@gikaku.com wrote:

 If the application I'm writing can benefit from prepared statements, I
 would like to eventually either add that feature to libdbi or I may have
 to use something else in the future.

Not much use I know, but I can confirm it doesn't support prepared
statement currently. You might consider APR, i.e.

http://apr.apache.org/docs/apr/2.0/group___a_p_r___util___d_b_d.html

-- 
Alex Bligh





--
___
libdbi-users mailing list
libdbi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdbi-users


Re: [libdbi-users] prepared statements

2015-06-11 Thread Alex Bligh

On 11 Jun 2015, at 12:00, Simon Walter si...@gikaku.com wrote:

 Looking at projects that use APR, many seem to include the entire thing
 in their code base. I'm guessing that one of the drawbacks is that APR
 comes with a lot of baggage so to speak.

You can dynamically link to an APR library.

 Have you used both libdbi and the database bits of APR? Is there any
 advantage to using libdbi compared to APR?

I've either used one or the other. I expect you can use both but
can't see any reason to.

apr is more frequently updated, has many other functions (e.g.
a complete memory pool manager), and works on a wider range of
platforms I believe (including Windows).

libdbi is simpler than APR to get used to, and has a smaller memory
footprint.

You should also compare the choice of backends if you care about
that.

-- 
Alex Bligh





--
___
libdbi-users mailing list
libdbi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdbi-users


Re: [libdbi-users] Valgrind error with pgsql: Conditional jump or move depends on uninitialised value(s)

2014-11-04 Thread Alex Bligh

On 3 Nov 2014, at 22:54, Markus Hoenicka markus.hoeni...@mhoenicka.de wrote:

 I wouldn't bet from valgrind's output that it is libdbi variables which are 
 uninitialized. Can you re-run your test with a different database engine? I'd 
 suggest using the sqlite3 driver as this engine has few if any external 
 dependencies.

I reran with mysql and it doesn't appear. I presume it's the pgsql dbi driver.

-- 
Alex Bligh





--
___
libdbi-users mailing list
libdbi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdbi-users


Re: [libdbi-users] Valgrind error with pgsql: Conditional jump or move depends on uninitialised value(s)

2014-11-04 Thread Alex Bligh

On 4 Nov 2014, at 12:09, Markus Hoenicka markus.hoeni...@mhoenicka.de wrote:

 At 2014-11-04 11:41 Alex Bligh was heard to say:
 On 3 Nov 2014, at 22:54, Markus Hoenicka markus.hoeni...@mhoenicka.de 
 wrote:
 I wouldn't bet from valgrind's output that it is libdbi variables which are 
 uninitialized. Can you re-run your test with a different database engine? 
 I'd suggest using the sqlite3 driver as this engine has few if any external 
 dependencies.
 I reran with mysql and it doesn't appear. I presume it's the pgsql dbi 
 driver.
 
 This is one explanation. Another explanation is that the PostgreSQL client 
 library or one of the libraries it depends on causes these messages. Could 
 you please fire up the psql command line utility under valgrind and do what 
 your test program does, i.e. establish a connection? If this test does not 
 report unitialized variables, we'll have to revisit the pgsql driver.

The valgrind nastiness appears even without the correct auth credentials.

Running using psql is very odd:

$ valgrind psql --username x -W 127.0.0.1
==14382== Memcheck, a memory error detector
==14382== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==14382== Using Valgrind-3.10.0.SVN and LibVEX; rerun with -h for copyright info
==14382== Command: /usr/bin/psql --username x -W 127.0.0.1
==14382==
Password for user x:
psql: FATAL:  Peer authentication failed for user x

No valgrind errors, but no valgrind summary either. Not quite sure what causes 
that.

-- 
Alex Bligh





--
___
libdbi-users mailing list
libdbi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdbi-users


[libdbi-users] Valgrind error with pgsql: Conditional jump or move depends on uninitialised value(s)

2014-11-02 Thread Alex Bligh
I have a very simple program (below) only marginally adapted from the example 
here:
  http://libdbi.sourceforge.net/docs/programmers-guide/quickstart-code.html

which works, but when run through valgrind produces an enormous number of 
errors.
The program in its entirety is below. It makes a connection to pgsql, does no
queries, and immediately shuts the connection.

I'm not so much worried about the alleged memory leaks but the 85 instances of
Conditional jump or move depends on uninitialised value(s). I don't
know if this is a real problem, but even if not the challenge here
is that /any/ query via dbi is now tainted as uninitialised, so it's impossible
to see 'real' errors.

I've not attached a full valgrind dump as it's enormous. However, you can see
the first two below.

Any ideas?

My platform is stock Ubuntu 14.04:

libdbd-pgsql:amd64 0.9.0-2ubuntu2
libdbi1:amd64 0.9.0-1
libdbi-dev 0.9.0-1

-- 
Alex Bligh




#include stdio.h
#include stdlib.h
#include dbi/dbi.h
#include string.h

/*
 * test.c
 *
 * compile with:
 *   gcc -Wall -o test test.c -ldbi
 *
 * Run with:
 *   ./test USERNAME PASSWORD [DBNAME]
 *
 */

int
main (int argc, char **argv)
{
  dbi_conn conn = NULL;
  dbi_inst conn_instance;

  if (argc  3)
{
  fprintf (stderr, Syntax: test USERNAME PASSWORD [DBNAME]\n);
  exit (1);
}

  /* return if already started */
  if (conn)
return 0;

  /* should be unnecessary */
  memset (conn_instance, 0, sizeof (conn_instance));

  dbi_initialize_r (NULL, conn_instance);
  conn = dbi_conn_new_r (pgsql, conn_instance);

  dbi_conn_set_option (conn, host, 127.0.0.1);
  dbi_conn_set_option (conn, username, argv[1]);
  dbi_conn_set_option (conn, password, argv[2]);
  if (argv[3])
dbi_conn_set_option (conn, dbname, argv[3]);
  dbi_conn_set_option (conn, encoding, UTF-8);

  if (dbi_conn_connect (conn)  0)
{
  fprintf (stderr, CONN error: cannot connect\n);
  exit (1);
}

  dbi_conn_close (conn);
  dbi_shutdown_r (conn_instance);

  fprintf (stderr, CONN test passed\n);

  exit (0);
}




==28748== Memcheck, a memory error detector
==28748== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==28748== Using Valgrind-3.10.0.SVN and LibVEX; rerun with -h for copyright info
==28748== Command: ./test tigerlily 6LXKKJV1QsbR38Hw tigerlily
==28748== Parent PID: 39449
==28748==
==28748== Conditional jump or move depends on uninitialised value(s)
==28748==at 0x5E77048: ??? (in /lib/x86_64-linux-gnu/libssl.so.1.0.0)
==28748==by 0x5E6DA22: ??? (in /lib/x86_64-linux-gnu/libssl.so.1.0.0)
==28748==by 0x5E6B053: ??? (in /lib/x86_64-linux-gnu/libssl.so.1.0.0)
==28748==by 0x5C3A936: ??? (in /usr/lib/libpq.so.5.6)
==28748==by 0x5C316B6: ??? (in /usr/lib/libpq.so.5.6)
==28748==by 0x5C2AA34: PQconnectPoll (in /usr/lib/libpq.so.5.6)
==28748==by 0x5C2BB8D: ??? (in /usr/lib/libpq.so.5.6)
==28748==by 0x5C2C496: PQconnectdb (in /usr/lib/libpq.so.5.6)
==28748==by 0x5A16EA9: _dbd_real_connect (in 
/usr/lib/x86_64-linux-gnu/dbd/libdbdpgsql.so)
==28748==by 0x4E3C7BE: dbi_conn_connect (in 
/usr/lib/x86_64-linux-gnu/libdbi.so.1.1.0)
==28748==by 0x400A2C: main (in 
/home/amb/extility/git/superproject-3.1/extility-vncforwarder/vncforwarder/test)
==28748==
==28748== Conditional jump or move depends on uninitialised value(s)
==28748==at 0x5C2ACEF: PQconnectPoll (in /usr/lib/libpq.so.5.6)
==28748==by 0x5C2BB8D: ??? (in /usr/lib/libpq.so.5.6)
==28748==by 0x5C2C496: PQconnectdb (in /usr/lib/libpq.so.5.6)
==28748==by 0x5A16EA9: _dbd_real_connect (in 
/usr/lib/x86_64-linux-gnu/dbd/libdbdpgsql.so)
==28748==by 0x4E3C7BE: dbi_conn_connect (in 
/usr/lib/x86_64-linux-gnu/libdbi.so.1.1.0)
==28748==by 0x400A2C: main (in 
/home/amb/extility/git/superproject-3.1/extility-vncforwarder/vncforwarder/test)
(and on and on and on)


--
___
libdbi-users mailing list
libdbi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdbi-users