}
#ifdef HAVE_BATCH_FILE_INSERT
-char *my_mysql_batch_lock_path_query = "LOCK TABLES Path write, "
- " batch write, "
- " Path as p write ";
+char *my_mysql_batch_lock_path_query = "LOCK TABLES Path write,"
+ "batch write,"
+ "Path as p write";
-char *my_mysql_batch_lock_filename_query = "LOCK TABLES Filename write, "
- " batch write, "
- " Filename as f write ";
+char *my_mysql_batch_lock_filename_query = "LOCK TABLES Filename write,"
+ "batch write,"
+ "Filename as f write";
char *my_mysql_batch_unlock_tables_query = "UNLOCK TABLES";
-char *my_mysql_batch_fill_path_query = "INSERT INTO Path (Path) "
- " SELECT a.Path FROM "
- " (SELECT DISTINCT Path "
- " FROM batch) AS a "
- " WHERE NOT EXISTS "
- " (SELECT Path "
- " FROM Path AS p "
- " WHERE p.Path = a.Path) ";
-
-char *my_mysql_batch_fill_filename_query = "INSERT INTO Filename (Name) "
- " SELECT a.Name FROM "
- " (SELECT DISTINCT Name "
- " FROM batch) AS a "
- " WHERE NOT EXISTS "
- " (SELECT Name "
- " FROM Filename AS f "
- " WHERE f.Name = a.Name) ";
+char *my_mysql_batch_fill_path_query = "INSERT INTO Path (Path) "
+ "SELECT a.Path FROM "
+ "(SELECT DISTINCT Path "
+ "FROM batch) AS a "
+ "WHERE NOT EXISTS "
+ "(SELECT Path "
+ "FROM Path AS p "
+ "WHERE p.Path = a.Path)";
+
+char *my_mysql_batch_fill_filename_query = "INSERT INTO Filename (Name) "
+ "SELECT a.Name FROM "
+ "(SELECT DISTINCT Name "
+ "FROM batch) AS a "
+ "WHERE NOT EXISTS "
+ "(SELECT Name "
+ "FROM Filename AS f "
+ "WHERE f.Name = a.Name)";
#endif /* HAVE_BATCH_FILE_INSERT */
#endif /* HAVE_MYSQL */
Dmsg0(500, "my_postgresql_batch_start started\n");
if (my_postgresql_query(mdb,
- " CREATE TEMPORARY TABLE batch "
- " (fileindex int, "
- " jobid int, "
- " path varchar, "
- " name varchar, "
- " lstat varchar, "
- " md5 varchar)") == 1)
+ "CREATE TEMPORARY TABLE batch ("
+ "fileindex int,"
+ "jobid int,"
+ "path varchar,"
+ "name varchar,"
+ "lstat varchar,"
+ "md5 varchar)") == 1)
{
Dmsg0(500, "my_postgresql_batch_start failed\n");
return 1;
char *my_pg_batch_unlock_tables_query = "COMMIT";
-char *my_pg_batch_fill_path_query = "INSERT INTO Path (Path) "
- " SELECT a.Path FROM "
- " (SELECT DISTINCT Path FROM batch) AS a "
- " WHERE NOT EXISTS (SELECT Path FROM Path WHERE Path = a.Path) ";
+char *my_pg_batch_fill_path_query = "INSERT INTO Path (Path) "
+ "SELECT a.Path FROM "
+ "(SELECT DISTINCT Path FROM batch) AS a "
+ "WHERE NOT EXISTS (SELECT Path FROM Path WHERE Path = a.Path) ";
-char *my_pg_batch_fill_filename_query = "INSERT INTO Filename (Name) "
- " SELECT a.Name FROM "
- " (SELECT DISTINCT Name FROM batch) as a "
- " WHERE NOT EXISTS "
- " (SELECT Name FROM Filename WHERE Name = a.Name)";
+char *my_pg_batch_fill_filename_query = "INSERT INTO Filename (Name) "
+ "SELECT a.Name FROM "
+ "(SELECT DISTINCT Name FROM batch) as a "
+ "WHERE NOT EXISTS "
+ "(SELECT Name FROM Filename WHERE Name = a.Name)";
#endif /* HAVE_BATCH_FILE_INSERT */
#endif /* HAVE_POSTGRESQL */
db_lock(mdb);
ok = db_sql_query(mdb,
- " CREATE TEMPORARY TABLE batch "
- " (fileindex integer, "
- " jobid integer, "
- " path blob, "
- " name blob, "
- " lstat tinyblob, "
- " md5 tinyblob) ",NULL, NULL);
+ "CREATE TEMPORARY TABLE batch ("
+ "FileIndex integer,"
+ "JobId integer,"
+ "Path blob,"
+ "Name blob,"
+ "LStat tinyblob,"
+ "MD5 tinyblob)",NULL, NULL);
db_unlock(mdb);
return ok;
}
}
if (!db_sql_query(jcr->db_batch,
- " INSERT INTO File (FileIndex, JobId, PathId, FilenameId, LStat, MD5)"
- " SELECT batch.FileIndex, batch.JobId, Path.PathId, "
- " Filename.FilenameId,batch.LStat, batch.MD5 "
- " FROM batch "
- " JOIN Path ON (batch.Path = Path.Path) "
- " JOIN Filename ON (batch.Name = Filename.Name) ",
+ "INSERT INTO File (FileIndex, JobId, PathId, FilenameId, LStat, MD5)"
+ "SELECT batch.FileIndex, batch.JobId, Path.PathId, "
+ "Filename.FilenameId,batch.LStat, batch.MD5 "
+ "FROM batch "
+ "JOIN Path ON (batch.Path = Path.Path) "
+ "JOIN Filename ON (batch.Name = Filename.Name)",
NULL,NULL))
{
Jmsg(jcr, M_FATAL, 0, "Can't fill File table %s\n", jcr->db_batch->errmsg);
General:
24Sep07
+ebl Cleanup batch code.
kes Back out one small change to the reservation system (reserving a volume).
kes Rework how a Volume is mounted. It is now much more intelligent and
will always attempt to use any mounted volume if possible and reduces