view src/lib-dict/dict-sql-settings.h @ 19604:c996bc091c6b

master: Do not close stdout if going foreground This lets one to use /dev/stdout for logging. Mainly useful for testing purposes where we can generate log output to stdout and use tee to write it to a file for later examination.
author Aki Tuomi <aki.tuomi@dovecot.fi>
date Mon, 18 Jan 2016 15:50:23 +0200
parents 6bb60a869c71
children 87d2e33aef64
line wrap: on
line source

#ifndef DICT_SQL_SETTINGS_H
#define DICT_SQL_SETTINGS_H

enum dict_sql_type {
	DICT_SQL_TYPE_STRING = 0,
	DICT_SQL_TYPE_UINT,
	DICT_SQL_TYPE_HEXBLOB
};

struct dict_sql_field {
	const char *name;
	enum dict_sql_type value_type;
};

struct dict_sql_map {
	/* pattern is in simplified form: all variables are stored as simple
	   '$' character. fields array is sorted by the variable index. */
	const char *pattern;
	const char *table;
	const char *username_field;
	const char *value_field;
	const char *value_type;
	bool value_hexblob;

	ARRAY(struct dict_sql_field) sql_fields;
};

struct dict_sql_settings {
	const char *connect;

	unsigned int max_field_count;
	ARRAY(struct dict_sql_map) maps;
};

struct dict_sql_settings *
dict_sql_settings_read(pool_t pool, const char *path, const char **error_r);

#endif