*
* Version $Id$
*/
-
/*
Copyright (C) 2000-2005 Kern Sibbald
This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of
- the License, or (at your option) any later version.
+ modify it under the terms of the GNU General Public License
+ version 2 as amended with additional clauses defined in the
+ file LICENSE in the main source directory.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ the file LICENSE for additional details.
*/
#ifdef HAVE_SQLITE
-#define BDB_VERSION 8
+#define BDB_VERSION 9
#include <sqlite.h>
* subroutines.
* S Q L I T E
*/
-typedef struct s_db {
+struct B_DB {
BQUEUE bq; /* queue control */
brwlock_t lock; /* transaction lock */
struct sqlite *db;
POOLMEM *esc_name; /* Escaped file/path name */
int fnl; /* file name length */
int pnl; /* path name length */
-} B_DB;
+};
/*
#ifdef HAVE_SQLITE3
-#define BDB_VERSION 8
+#define BDB_VERSION 9
#include <sqlite3.h>
* subroutines.
* S Q L I T E
*/
-typedef struct s_db {
+struct B_DB {
BQUEUE bq; /* queue control */
brwlock_t lock; /* transaction lock */
struct sqlite3 *db;
POOLMEM *esc_name; /* Escaped file/path name */
int fnl; /* file name length */
int pnl; /* path name length */
-} B_DB;
+};
/*
* Conversion of sqlite 2 names to sqlite3
#ifdef HAVE_MYSQL
-#define BDB_VERSION 8
+#define BDB_VERSION 9
#include <mysql.h>
*
* M Y S Q L
*/
-typedef struct s_db {
+struct B_DB {
BQUEUE bq; /* queue control */
brwlock_t lock; /* transaction lock */
MYSQL mysql;
POOLMEM *esc_name; /* Escaped file/path name */
int fnl; /* file name length */
int pnl; /* path name length */
-} B_DB;
+};
#define DB_STATUS int
/* "Generic" names for easier conversion */
#define sql_store_result(x) mysql_store_result((x)->db)
+#define sql_use_result(x) mysql_use_result((x)->db)
#define sql_free_result(x) mysql_free_result((x)->result)
#define sql_fetch_row(x) mysql_fetch_row((x)->result)
#define sql_query(x, y) mysql_query((x)->db, (y))
#ifdef HAVE_POSTGRESQL
-#define BDB_VERSION 8
+#define BDB_VERSION 9
#include <libpq-fe.h>
/* TEMP: the following is taken from select OID, typname from pg_type; */
-#define IS_NUM(x) ((x) == 20 || (x) == 21 || (x) == 23 || (x) == 700 || (x) == 701)
-#define IS_NOT_NULL(x) ((x) == 1)
+#define IS_NUM(x) ((x) == 20 || (x) == 21 || (x) == 23 || (x) == 700 || (x) == 701)
+#define IS_NOT_NULL(x) ((x) == 1)
typedef char **POSTGRESQL_ROW;
typedef struct pg_field {
- char *name;
- int max_length;
- unsigned int type;
- unsigned int flags; // 1 == not null
+ char *name;
+ int max_length;
+ unsigned int type;
+ unsigned int flags; // 1 == not null
} POSTGRESQL_FIELD;
*
* P O S T G R E S Q L
*/
-typedef struct s_db {
+struct B_DB {
BQUEUE bq; /* queue control */
brwlock_t lock; /* transaction lock */
PGconn *db;
POOLMEM *esc_name; /* Escaped file/path name */
int fnl; /* file name length */
int pnl; /* path name length */
-} B_DB;
+};
void my_postgresql_free_result(B_DB *mdb);
POSTGRESQL_ROW my_postgresql_fetch_row (B_DB *mdb);
/* This is the REAL definition for using the
* Bacula internal DB
*/
-typedef struct s_db {
+struct B_DB {
BQUEUE bq; /* queue control */
/* pthread_mutex_t mutex; */ /* single thread lock */
brwlock_t lock; /* transaction lock */
POOLMEM *cached_path;
int cached_path_len; /* length of cached path */
uint32_t cached_path_id;
-} B_DB;
+};
#endif /* HAVE_SQLITE3 */
#endif /* HAVE_MYSQL */
/* This is a "dummy" definition for use outside of sql.c
*/
-typedef struct s_db {
+struct B_DB {
int dummy; /* for SunOS compiler */
-} B_DB;
+};
#endif /* __SQL_C */
char cStartTime[MAX_TIME_LENGTH];
char cEndTime[MAX_TIME_LENGTH];
/* Extra stuff not in DB */
+ int limit; /* limit records to display */
faddr_t rec_addr;
};
uint32_t EndFile; /* End file on Volume */
uint32_t StartBlock; /* start block on tape */
uint32_t EndBlock; /* last block */
+ uint32_t Copy; /* identical copy */
+ uint32_t Stripe; /* RAIT strip number */
};
uint32_t EndFile; /* End file on Volume */
uint32_t StartBlock; /* start block on tape */
uint32_t EndBlock; /* last block */
+// uint32_t Copy; /* identical copy */
+// uint32_t Stripe; /* RAIT strip number */
};
DBId_t PathId;
DBId_t FilenameId;
FileId_t FileId;
+ char *Sig;
+ int SigType;
};
public:
DBId_t StorageId;
char Name[MAX_NAME_LENGTH]; /* Device name */
- DBId_t MediaTypeId; /* MediaType */
int AutoChanger; /* Set if autochanger */
+
+ /* Not in database */
+ bool created; /* set if created by db_create ... */
};
class MEDIATYPE_DBR {
int32_t Recycle; /* recycle yes/no */
int32_t Slot; /* slot in changer */
int32_t InChanger; /* Volume currently in changer */
+ DBId_t StorageId; /* Storage record Id */
uint32_t EndFile; /* Last file on volume */
uint32_t EndBlock; /* Last block on volume */
char VolStatus[20]; /* Volume status */