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
+ modify it under the terms of version three of the GNU Affero General Public
License as published by the Free Software Foundation and included
in the file LICENSE.
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
+ You should have received a copy of the GNU Affero 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.
*
* Kern Sibbald, March 2000
*
- * Version $Id$
+ * Version $Id: sql_create.c 8407 2009-01-28 10:47:21Z ricozz $
*/
/* The following is necessary so that we do not include
static const int dbglevel = 100;
-#if HAVE_SQLITE3 || HAVE_MYSQL || HAVE_SQLITE || HAVE_POSTGRESQL || HAVE_DBI
+#if HAVE_SQLITE3 || HAVE_MYSQL || HAVE_SQLITE || HAVE_POSTGRESQL || HAVE_INGRES || HAVE_DBI
/* -----------------------------------------------------------------------
*
sr->StorageId = 0;
sr->created = false;
+ /* Check if it already exists */
if (QUERY_DB(jcr, mdb, mdb->cmd)) {
mdb->num_rows = sql_num_rows(mdb);
/* If more than one, report error, but return first row */
}
/* Must create it */
- Mmsg(mdb->cmd, "INSERT INTO Counters (Counter,MinValue,MaxValue,CurrentValue,"
+ Mmsg(mdb->cmd, "INSERT INTO Counters (Counter,\"MinValue\",\"MaxValue\",CurrentValue,"
"WrapCounter) VALUES ('%s','%d','%d','%d','%s')",
cr->Counter, cr->MinValue, cr->MaxValue, cr->CurrentValue,
cr->WrapCounter);
/* List of SQL commands to create temp table and indicies */
-const char *create_temp_basefile[4] = {
+const char *create_temp_basefile[5] = {
/* MySQL */
"CREATE TEMPORARY TABLE basefile%lld ("
// "CREATE TABLE basefile%lld ("
/* SQLite3 */
"CREATE TEMPORARY TABLE basefile%lld ("
"Path TEXT,"
- "Name TEXT)"
+ "Name TEXT)",
+
+ /* Ingres */
+ "DECLARE GLOBAL TEMPORARY TABLE basefile%lld ("
+ "Path TEXT NOT NULL,"
+ "Name TEXT NOT NULL)"
+ "ON COMMIT PRESERVE ROWS WITH NORECOVERY"
};
/*
if (!db_sql_query(mdb, mdb->cmd, NULL, NULL)) {
goto bail_out;
}
+ /* Quick and dirty fix for MySQL and Bacula 5.0.1 */
+#ifdef HAVE_MYSQL
+ Mmsg(mdb->cmd,
+ "CREATE INDEX basefile%lld_idx ON basefile%lld (Path(255), Name(255))",
+ (uint64_t) jcr->JobId, (uint64_t) jcr->JobId);
+ if (!db_sql_query(mdb, mdb->cmd, NULL, NULL)) {
+ goto bail_out;
+ }
+#endif
Mmsg(buf, select_recent_version[db_type], jobids, jobids);
Mmsg(mdb->cmd,
"CREATE TEMPORARY TABLE new_basefile%lld AS "
return ret;
}
-#endif /* HAVE_SQLITE3 || HAVE_MYSQL || HAVE_SQLITE || HAVE_POSTGRESQL || HAVE_DBI */
+#endif /* HAVE_SQLITE3 || HAVE_MYSQL || HAVE_SQLITE || HAVE_POSTGRESQL || HAVE_INGRES || HAVE_DBI */