Cleanup non-literal format string warnings.
nod2db: Message queue send and retry timing fixes.

Instead of a non-blocking msgsnd() followed by sleep() and a retry on
failure, set an alarm() on a blocking msgsnd(). A one-second alarm lets
us log retries similarly to what was done before: the difference being
sends that don't complete immediately but do complete within one second
are no longer retires. In testing, the vast majority of reties were
completed within one second and are no longer logged.

The alarm() signal handling should not interfere with
ndo2db_child_sighandler(), as that simply calls _exit(0). Signals
that don't result in process termination but do EINTR the msgsnd() are
seen as an alarm expiration, so this scheme is not perfect..
ndo2db/queue: Remove unneeded includes.

Most system headers we use are detected by configure and included in
config.h. The SysV IPC headers are the only current exceptions.
ndo{mod|2db}: Formatting cleanup and config refactoring.

Make ndo2db.c's formatting consistent and more (or less) readable.
Use the configuration processing macros from ndomod to simplify error
checking of config values. Explicitly set errno = 0 before using it to
check the results of strto*() functions.
ndo2db: Reduce memory moves when handling NDO input.

The previous queue interface required extra copies of the data to be
enqueued. By reading client input directly to a queue message
structure, we can msgsnd() without any additional copies.

Start renaming queue functions with ndo2db_ prefix.

Handle edge cases where a failure on the last retry could be reported
as success or exceeding the maximum number of retries.

Additionally, read up to NDO_MAX_MSG_SIZE-1 bytes at a time from the
client to reduce the syscalls that need to be made for larger messages.
Previously this was 511 bytes.
ndo2db/queue: Cleanup old declarations, unused results.
ndo2db: A bit of cleanup to some old debug code.
ndo2db: Remove configure tests for nanosleep().

We no longer use nanosleep() so we don't need to detect it.

This reverts bd6ed8f5d2ba3a1bffed54c58c542022a63f431f and
8eaa5f365c3d40836a51d02bec55506bf82a42be.
ndo2db: Remove PostgreSQL support stub code.

ndo2db only supports MySQL.

A Postgres implementation had been started, but never finished. Since
our schema and many DB operations (e.g., auto increment,
last_insert_id) assume MySQL, and there hasn't been much recent demand
to support Postgres; remove the commented configure tests, DB server
type conditionals, and documentation references.

Removing the server type tests simplifies several chunks of the code,
which will make maintaining and tuning the DB code a bit easier.

Different storage backends _MAY_ _POSSIBLY_ be supported in the future.
The changes in this commit show some (but by no means all) operations
identified as DB specific, and may be helpful if implementing a new
backend.
ndo2db: More formatting cleanup.

There are enough edge cases and existing mixed formatting to make
astyle and other tools confused to the point that their output isn't
much of an improvement...
ndo2db: Correct an inverted error condition.
ndo2db: Start cleanup of SQL date/timestamp formatting.

With SQL we often need to use a timestamp value/column as a datetime,
and vice versa. Two functions handled these conversions, encapsulating
DB specific operations, but with the cost of extra memory allocation
and movement. Since ndo2db_db_timet_to_sql() was accounting for a
significant fraction of CPU time (approaching 10% of the DB writer CPU
time on some workloads), and it's basically a fancy printf format,
we'll make it and the corresponding ndo2db_db_sql_to_timet() exactly
fancy printf format macros, a la C99's PRI macros.

This commit handles the few cases in db.c, the bulk remains to be done
in dbhandlers.c.
ndo2db/dbhandlers: Cleanup of SQL date/timestamp formatting.

First occurance in dbhandlers.c. Along the way, fix a dodgy cast, don't
do an extra malloc only to immediately free the original, and make sure
the temporary escaped string is accounted for on all return paths.
db/upgrade: Fix a schema version typo.

The place in the DB version list for 1.4b9 was 1.4b2 instead.
Merge branch 'ndo2db-refactor'