pgsqldb.c revision 1ff970120a57b9a1e88d0a5326c44d9abb4a3863
2N/A * Copyright (C) 2000, 2001 Internet Software Consortium. 2N/A * Permission to use, copy, modify, and distribute this software for any 2N/A * purpose with or without fee is hereby granted, provided that the above 2N/A * copyright notice and this permission notice appear in all copies. 2N/A * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM 2N/A * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL 2N/A * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL 2N/A * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, 2N/A * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING 2N/A * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 2N/A * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 2N/A * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 2N/A/* $Id: pgsqldb.c,v 1.12 2001/02/28 23:42:37 bwelling Exp $ */ * A simple database driver that interfaces to a PostgreSQL database. This * is not complete, and not designed for general use. It opens one * connection to the database per zone, which is inefficient. It also may * not handle quoting correctly. * The table must contain the fields "name", "rdtype", and "rdata", and * is expected to contain a properly constructed zone. The program "zonetodb" * Canonicalize a string before writing it to the database. * "dest" must be an array of at least size 2*strlen(source) + 1. /* SQL doesn't treat \ as special, but PostgreSQL does */ * Connect to the database. * Check to see if the connection is still valid. If not, attempt to * This database operates on absolute names. * Queries are converted into SQL queries and issued synchronously. Errors * are handled really badly. "SELECT TTL,RDTYPE,RDATA FROM \"%s\" WHERE " * Issue an SQL query to return all nodes in the database and fill the "SELECT TTL,NAME,RDTYPE,RDATA FROM \"%s\" ORDER BY NAME",
* Create a connection to the database and save any necessary information * argv[0] is the name of the database * argv[1] is the name of the table * argv[2] (if present) is the name of the host to connect to * argv[3] (if present) is the name of the user to connect as * argv[4] (if present) is the name of the password to connect with * Close the connection to the database. * Since the SQL database corresponds to a zone, the authority data should * be returned by the lookup() function. Therefore the authority() function * Wrapper around dns_sdb_register(). * Wrapper around dns_sdb_unregister().