netatalk 4.5.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
cnid_sqlite.c File Reference
`#include <arpa/inet.h>`
`#include <errno.h>`
`#include <fcntl.h>`
`#include <inttypes.h>`
`#include <net/if.h>`
`#include <netdb.h>`
`#include <netinet/in.h>`
`#include <netinet/tcp.h>`
`#include <stdlib.h>`
`#include <stdio.h>`
`#include <string.h>`
`#include <sys/param.h>`
`#include <sys/socket.h>`
`#include <sys/stat.h>`
`#include <sys/time.h>`
`#include <sys/uio.h>`
`#include <sys/un.h>`
`#include <time.h>`
`#include <bstrlib.h>`
`#include <sqlite3.h>`
`#include <atalk/adouble.h>`
`#include <atalk/cnid_bdb_private.h>`
`#include <atalk/cnid_sqlite_private.h>`
`#include <atalk/errchk.h>`
`#include <atalk/globals.h>`
`#include <atalk/logger.h>`
`#include <atalk/unix.h>`
`#include <atalk/util.h>`
`#include <atalk/volume.h>`

## Functions
static int | init_prepared_stmt_lookup (CNID_sqlite_private *db)
static int | init_prepared_stmt_add (CNID_sqlite_private *db)
static int | init_prepared_stmt_put (CNID_sqlite_private *db)
static int | init_prepared_stmt_get (CNID_sqlite_private *db)
static int | init_prepared_stmt_resolve (CNID_sqlite_private *db)
static int | init_prepared_stmt_delete (CNID_sqlite_private *db)
static int | init_prepared_stmt_find (CNID_sqlite_private *db)
static int | init_prepared_stmt_getstamp (CNID_sqlite_private *db)
static int | init_prepared_stmt (CNID_sqlite_private *db)
static void | close_prepared_stmt (CNID_sqlite_private *db)
static int | cnid_sqlite_execute (sqlite3 *con, const char *sql)
int | cnid_sqlite_delete (struct _cnid_db *cdb, const cnid_t id)
void | cnid_sqlite_close (struct _cnid_db *cdb)
int | cnid_sqlite_update (struct _cnid_db *cdb, cnid_t id, const struct stat *st, cnid_t did, const char *name, size_t len)
cnid_t | cnid_sqlite_lookup (struct _cnid_db *cdb, const struct stat *st, cnid_t did, const char *name, size_t len)
cnid_t | cnid_sqlite_add (struct _cnid_db *cdb, const struct stat *st, cnid_t did, const char *name, size_t len, cnid_t hint)
cnid_t | cnid_sqlite_get (struct _cnid_db *cdb, cnid_t did, const char *name, size_t len)
char * | cnid_sqlite_resolve (struct _cnid_db *cdb, cnid_t *id, void *buffer, size_t len)
int | cnid_sqlite_getstamp (struct _cnid_db *cdb, void *buffer, const size_t len)
int | cnid_sqlite_find (struct _cnid_db *cdb, const char *name, size_t namelen, void *buffer, size_t buflen, bool *more_available)
| Backend implementation of cnid_find() for the sqlite backend.
cnid_t | cnid_sqlite_rebuild_add (struct _cnid_db *cdb, const struct stat *st, cnid_t did, const char *name, size_t len, cnid_t hint)
int | cnid_sqlite_wipe (struct _cnid_db *cdb)
static struct _cnid_db * | cnid_sqlite_new (struct vol *vol)
struct _cnid_db * | cnid_sqlite_open (struct cnid_open_args *args)

## Variables
struct _cnid_module | cnid_sqlite_module

## Function Documentation

## ◆ close_prepared_stmt()

void close_prepared_stmt | ( | CNID_sqlite_private * | db | ) |
| static

## ◆ cnid_sqlite_add()

cnid_t cnid_sqlite_add | ( | struct _cnid_db * | cdb,
|  | const struct stat * | st,
|  | cnid_t | did,
|  | const char * | name,
|  | size_t | len,
|  | cnid_t | hint )

## ◆ cnid_sqlite_close()

void cnid_sqlite_close | ( | struct _cnid_db * | cdb | ) |

## ◆ cnid_sqlite_delete()

int cnid_sqlite_delete | ( | struct _cnid_db * | cdb,
|  | const cnid_t | id )

## ◆ cnid_sqlite_execute()

int cnid_sqlite_execute | ( | sqlite3 * | con,
|  | const char * | sql )
| static

## ◆ cnid_sqlite_find()

int cnid_sqlite_find | ( | struct _cnid_db * | cdb,
|  | const char * | name,
|  | size_t | namelen,
|  | void * | buffer,
|  | size_t | buflen,
|  | bool * | more_available )

Backend implementation of cnid_find() for the sqlite backend.

Parameters are pre-validated by the libatalk/cnid/cnid.c wrapper, so cdb, name, namelen and buflen are all sane on entry. Detects truncation by binding LIMIT max_results+1 and observing whether the extra row was produced; reports it via `more_available`.

`namelen` is unused: the SQLite backend builds the LIKE pattern via asprintf("%%%s%%", name), which already requires a NUL-terminated `name`. The parameter is kept to satisfy the cnid_db function-pointer signature shared with the dbd / mysql backends.

## ◆ cnid_sqlite_get()

cnid_t cnid_sqlite_get | ( | struct _cnid_db * | cdb,
|  | cnid_t | did,
|  | const char * | name,
|  | size_t | len )

## ◆ cnid_sqlite_getstamp()

int cnid_sqlite_getstamp | ( | struct _cnid_db * | cdb,
|  | void * | buffer,
|  | const size_t | len )

Caller passes buffer where we will store the db stamp

## ◆ cnid_sqlite_lookup()

cnid_t cnid_sqlite_lookup | ( | struct _cnid_db * | cdb,
|  | const struct stat * | st,
|  | cnid_t | did,
|  | const char * | name,
|  | size_t | len )

## ◆ cnid_sqlite_new()

struct _cnid_db * cnid_sqlite_new | ( | struct vol * | vol | ) |
| static

## ◆ cnid_sqlite_open()

struct _cnid_db * cnid_sqlite_open | ( | struct cnid_open_args * | args | ) |

## ◆ cnid_sqlite_rebuild_add()

cnid_t cnid_sqlite_rebuild_add | ( | struct _cnid_db * | cdb,
|  | const struct stat * | st,
|  | cnid_t | did,
|  | const char * | name,
|  | size_t | len,
|  | cnid_t | hint )

## ◆ cnid_sqlite_resolve()

char * cnid_sqlite_resolve | ( | struct _cnid_db * | cdb,
|  | cnid_t * | id,
|  | void * | buffer,
|  | size_t | len )

## ◆ cnid_sqlite_update()

int cnid_sqlite_update | ( | struct _cnid_db * | cdb,
|  | cnid_t | id,
|  | const struct stat * | st,
|  | cnid_t | did,
|  | const char * | name,
|  | size_t | len )

## ◆ cnid_sqlite_wipe()

int cnid_sqlite_wipe | ( | struct _cnid_db * | cdb | ) |

## ◆ init_prepared_stmt()

int init_prepared_stmt | ( | CNID_sqlite_private * | db | ) |
| static

## ◆ init_prepared_stmt_add()

int init_prepared_stmt_add | ( | CNID_sqlite_private * | db | ) |
| static

## ◆ init_prepared_stmt_delete()

int init_prepared_stmt_delete | ( | CNID_sqlite_private * | db | ) |
| static

## ◆ init_prepared_stmt_find()

int init_prepared_stmt_find | ( | CNID_sqlite_private * | db | ) |
| static

## ◆ init_prepared_stmt_get()

int init_prepared_stmt_get | ( | CNID_sqlite_private * | db | ) |
| static

## ◆ init_prepared_stmt_getstamp()

int init_prepared_stmt_getstamp | ( | CNID_sqlite_private * | db | ) |
| static

## ◆ init_prepared_stmt_lookup()

int init_prepared_stmt_lookup | ( | CNID_sqlite_private * | db | ) |
| static

## ◆ init_prepared_stmt_put()

int init_prepared_stmt_put | ( | CNID_sqlite_private * | db | ) |
| static

## ◆ init_prepared_stmt_resolve()

int init_prepared_stmt_resolve | ( | CNID_sqlite_private * | db | ) |
| static

## Variable Documentation

## ◆ cnid_sqlite_module

struct _cnid_module cnid_sqlite_module

Initial value:
= {
"sqlite",
{ NULL, NULL },
cnid_sqlite_open,
0
}
cnid_sqlite_open
struct _cnid_db * cnid_sqlite_open(struct cnid_open_args *args)
Definition cnid_sqlite.c:1289
NULL
#define NULL
Definition utf8util.c:47