db.h
author Mahlon E. Smith <mahlon@martini.nu>
Sun, 23 Oct 2011 22:59:59 -0700
changeset 12 191b3c25974a
parent 11 9aa5114326e8
child 13 23a242d7b7fa
permissions -rw-r--r--
Clean up redundant parser actions via preprocessor macros, add a hostname->tld extractor for doing tld "wildcard" queries. Stop tracking 'parser.c' completely.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     1
/* vim: set noet nosta sw=4 ts=4 ft=c : */
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     2
/*
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     3
Copyright (c) 2011, Mahlon E. Smith <mahlon@martini.nu>
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     4
All rights reserved.
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     5
Redistribution and use in source and binary forms, with or without
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     6
modification, are permitted provided that the following conditions are met:
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     7
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     8
    * Redistributions of source code must retain the above copyright
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     9
      notice, this list of conditions and the following disclaimer.
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    10
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    11
    * Redistributions in binary form must reproduce the above copyright
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    12
      notice, this list of conditions and the following disclaimer in the
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    13
      documentation and/or other materials provided with the distribution.
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    14
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    15
    * Neither the name of Mahlon E. Smith nor the names of his
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    16
      contributors may be used to endorse or promote products derived
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    17
      from this software without specific prior written permission.
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    18
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    19
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    20
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    21
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    22
DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    23
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    24
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    25
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    26
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    27
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    28
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    29
*/
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    30
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    31
#ifndef _DB_H
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    32
#define _DB_H
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    33
11
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 7
diff changeset
    34
#include "sqlite3.h"
4
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    35
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    36
extern const unsigned short int DB_VERSION;
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    37
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    38
/*
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    39
 * Function prototypes
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    40
 *
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    41
 */
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    42
int db_attach( void );
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    43
int db_upgrade( unsigned short int current_version );
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    44
short int db_version( void );
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    45
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    46
#endif
5701b7859a31 Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    47