Askemos Forum

PostgreSQL integration 3. December 2003
First shot of a PostgreSQL driver, MySQL driver modified.
Hi all,

I just uploaded a first build of the BALL with PostgreSQL support.

Changes:

I) The formal of the XSQL connection definitions (distributed in
   policy/xsql-definition.xml) has changed.  A connection has now a
   'driver' child element (which might be moved in further releases to
   become an attribute of the connection, I'm not sure what's the
   right way here).  The content of that element define, which data
   base driver is to be used.  Example

   <!-- This connection is universally open. -->
   <connection>
    <name>demo</name>
    <driver>MySQL</driver>
    <database>test</database>
    <host>localhost</host>
    <user>test</user>
    <password></password>
   </connection>

  Currently two values are supported "MySQL" and "PostgreSQL".

II) The mysql driver has changed slightly.  It used to block the whole
   ball until the query completes.  At least Frank has suffered from
   mysql queries taking so long, that BALL's heartbeat decided the
   Askems server was locked up and killed it[1].  Unfortunately I've
   not found a mysql API, which allows asynchronous notification or
   polling about query completion.  Therefore I just inserted a
   configurable delay between the mysql query and response retrieval.
   Call (set-mysql-query-time! (milliseconds <integer>)) in your
   configuration to adjust that delay (defaults to 20 ms).

   Having written that, it turned out, that mysql_real_query is to
   blame.  It turned out that the ball stoped during this call.  Does
   someone have some info how to tune mysql not to block there?

III) The new PostgreSQL driver is almost identical to the mysql
   driver, except that PostgreSQL has 'PQisBusy', which allows me to
   poll for query completion.  Though this is better (and should
   therefore become the recommented way to use XSQL within BALL) than
   the mysql interface, it's still not satisfactory.  If anyone could
   point me to some notification interface, possibly with example
   code, that would be great.

   For the time being, you can adjust the polling interval in your
   configuration using (set-pgsql-query-time! (milliseconds <integer>))

Please note that this code is not yet tested and I will not have the
time to test it right now.  Please help.

Best regards

/J�rg

Footnotes:

1) Actually I'm curious to see what huge or complicated data base
   query will keep mysql busy for more than two seconds.  Frank, can
   you provide some details?

--
The worst of harm may often result from the best of intentions.
Re: PostgreSQL integration 6. December 2003

Post replies via login host.

Intro - slides
Askemos Wiki
Publikationen