zone2sqlite.c revision 02d54949f0f1db4729e14c3322b207f58d2578a4
/*
* Copyright (C) 2007, 2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <stdlib.h>
#include <string.h>
#include <dns/dbiterator.h>
#include <dns/fixedname.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/rdatatype.h>
#include <sqlite3.h>
#ifndef UNUSED
#define UNUSED(x) (x) = (x)
#endif
/*
* Generate an SQLite table from a zone.
*/
typedef struct _dbinfo {
char *filename;
char *table;
} dbinfo_t;
static void
closeandexit(int status)
{
}
}
static void
{
if (result != ISC_R_SUCCESS) {
closeandexit(1);
}
}
static isc_result_t
{
return (ISC_R_SUCCESS);
} else {
/* a connection is returned even if the open fails */
return (ISC_R_FAILURE);
}
}
static int
{
return 0;
}
static void
{
unsigned char typearray[20];
unsigned char dataarray[2048];
isc_buffer_t b;
char *sql;
int res;
namearray[isc_buffer_usedlength(&b)] = 0;
typearray[isc_buffer_usedlength(&b)] = 0;
dataarray[isc_buffer_usedlength(&b)] = 0;
"INSERT INTO %Q (NAME, TTL, RDTYPE, RDATA)"
" VALUES ('%q', %d, '%q', '%q') ",
closeandexit(1);
}
}
int
{
char *sql;
int res;
isc_buffer_t b;
if (argc != 5) {
exit(1);
}
if (result == DNS_R_SEENINCLUDE)
closeandexit(1);
}
#if 0
}
#endif
#if 0
closeandexit(1);
}
#endif
"CREATE TABLE %Q "
"(NAME TEXT, TTL INTEGER, RDTYPE TEXT, RDATA TEXT) ",
closeandexit(1);
}
while (result == ISC_R_SUCCESS) {
if (result == ISC_R_NOMORE)
break;
while (result == ISC_R_SUCCESS) {
while (result == ISC_R_SUCCESS) {
}
}
}
#if 0
closeandexit(1);
}
#endif
dns_db_detach(&db);
closeandexit(0);
exit(0);
}