*
*/
/*
- Copyright (C) 2000-2006 Kern Sibbald
+ Bacula® - The Network Backup Solution
- This program is free software; you can redistribute it and/or
- 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.
+ Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
- 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
- the file LICENSE for additional details.
+ The main author of Bacula is Kern Sibbald, with contributions from
+ many others, a complete list can be found in the file AUTHORS.
+ This program is Free Software; you can redistribute it and/or
+ modify it under the terms of version two of the GNU General Public
+ License as published by the Free Software Foundation and included
+ in the file LICENSE.
- */
+ 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., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+ Bacula® is a registered trademark of John Walker.
+ The licensor of Bacula is the Free Software Foundation Europe
+ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+ Switzerland, email:ftf@fsfeurope.org.
+*/
/* The following is necessary so that we do not include
uint32_t bacula_db_version = 0;
-/* Forward referenced functions */
-
-extern const char *working_directory;
-
/* List of open databases */
static BQUEUE db_list = {&db_list, &db_list};
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
#define DB_CLIENT_FILENAME "client.db"
#define DB_FILESET_FILENAME "fileset.db"
+dbid_list::dbid_list()
+{
+ memset(this, 0, sizeof(dbid_list));
+ max_ids = 1000;
+ DBId = (DBId_t *)malloc(max_ids * sizeof(DBId_t));
+ num_ids = num_seen = tot_ids = 0;
+ PurgedFiles = NULL;
+}
+
+dbid_list::~dbid_list()
+{
+ free(DBId);
+}
+
static POOLMEM *make_filename(B_DB *mdb, char *name)
{
char sep;
POOLMEM *dbf;
dbf = get_pool_memory(PM_FNAME);
- if (working_directory[strlen(working_directory)-1] == '/') {
+ if (IsPathSeparator(working_directory[strlen(working_directory)-1])) {
sep = 0;
} else {
sep = '/';
return 1;
}
+/*
+ * Retrieve database type
+ */
+const char *
+db_get_type(void)
+{
+ return "Internal";
+}
+
/*
* Initialize database data structure. In principal this should
* never have errors, or it is really fatal.
return mdb; /* already open */
}
}
+
Dmsg0(200, "db_open first time\n");
mdb = (B_DB *)malloc(sizeof(B_DB));
memset(mdb, 0, sizeof(B_DB));
V(mutex);
}
+void db_thread_cleanup()
+{ }
+
-void db_escape_string(char *snew, char *old, int len)
+void db_escape_string(JCR *jcr, B_DB *db, char *snew, char *old, int len)
{
memset(snew, 0, len);
bstrncpy(snew, old, len);
return mdb->errmsg;
}
-int db_sql_query(B_DB *mdb, char const *query, DB_RESULT_HANDLER *result_handler, void *ctx)
+bool db_sql_query(B_DB *mdb, char const *query, DB_RESULT_HANDLER *result_handler, void *ctx)
{
- return 1;
+ return true;
}
/*