*
* 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.
*/
jr->JobId = 0;
stat = 0;
} else {
- jr->JobId = sql_insert_id(mdb, _("Job"));
+ jr->JobId = sql_insert_id(mdb, NT_("Job"));
stat = 1;
}
db_unlock(mdb);
db_lock(mdb);
/* Now get count for VolIndex */
- Mmsg(mdb->cmd, "SELECT count(*) from JobMedia");
+ Mmsg(mdb->cmd, "SELECT count(*) from JobMedia WHERE JobId=%s",
+ edit_int64(jm->JobId, ed1));
count = get_sql_record_max(jcr, mdb);
if (count < 0) {
count = 0;
pr->PoolId = 0;
stat = false;
} else {
- pr->PoolId = sql_insert_id(mdb, _("Pool"));
+ pr->PoolId = sql_insert_id(mdb, NT_("Pool"));
stat = true;
}
db_unlock(mdb);
dr->DeviceId = 0;
ok = false;
} else {
- dr->DeviceId = sql_insert_id(mdb, _("Device"));
+ dr->DeviceId = sql_insert_id(mdb, NT_("Device"));
ok = true;
}
db_unlock(mdb);
Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
ok = false;
} else {
- sr->StorageId = sql_insert_id(mdb, _("Storage"));
+ sr->StorageId = sql_insert_id(mdb, NT_("Storage"));
sr->created = true;
ok = true;
}
mr->MediaTypeId = 0;
stat = false;
} else {
- mr->MediaTypeId = sql_insert_id(mdb, _("MediaType"));
+ mr->MediaTypeId = sql_insert_id(mdb, NT_("MediaType"));
stat = true;
}
db_unlock(mdb);
db_lock(mdb);
Mmsg(mdb->cmd, "SELECT MediaId FROM Media WHERE VolumeName='%s'",
mr->VolumeName);
- Dmsg1(300, "selectpool: %s\n", mdb->cmd);
+ Dmsg1(500, "selectpool: %s\n", mdb->cmd);
if (QUERY_DB(jcr, mdb, mdb->cmd)) {
mdb->num_rows = sql_num_rows(mdb);
"VolStatus,Slot,VolBytes,InChanger,VolReadTime,VolWriteTime,VolParts,"
"EndFile,EndBlock,LabelType,StorageId) "
"VALUES ('%s','%s',%u,%s,%s,%d,%s,%s,%u,%u,'%s',%d,%s,%d,%s,%s,%d,0,0,%d,%s)",
- mr->VolumeName,
- mr->MediaType, mr->PoolId,
- edit_uint64(mr->MaxVolBytes,ed1),
- edit_uint64(mr->VolCapacityBytes, ed2),
- mr->Recycle,
- edit_uint64(mr->VolRetention, ed3),
- edit_uint64(mr->VolUseDuration, ed4),
- mr->MaxVolJobs,
- mr->MaxVolFiles,
- mr->VolStatus,
- mr->Slot,
- edit_uint64(mr->VolBytes, ed5),
- mr->InChanger,
- edit_uint64(mr->VolReadTime, ed6),
- edit_uint64(mr->VolWriteTime, ed7),
- mr->VolParts,
- mr->LabelType,
- edit_int64(mr->StorageId, ed8)
- );
+ mr->VolumeName,
+ mr->MediaType, mr->PoolId,
+ edit_uint64(mr->MaxVolBytes,ed1),
+ edit_uint64(mr->VolCapacityBytes, ed2),
+ mr->Recycle,
+ edit_uint64(mr->VolRetention, ed3),
+ edit_uint64(mr->VolUseDuration, ed4),
+ mr->MaxVolJobs,
+ mr->MaxVolFiles,
+ mr->VolStatus,
+ mr->Slot,
+ edit_uint64(mr->VolBytes, ed5),
+ mr->InChanger,
+ edit_uint64(mr->VolReadTime, ed6),
+ edit_uint64(mr->VolWriteTime, ed7),
+ mr->VolParts,
+ mr->LabelType,
+ edit_int64(mr->StorageId, ed8)
+ );
Dmsg1(500, "Create Volume: %s\n", mdb->cmd);
mdb->cmd, sql_strerror(mdb));
stat = 0;
} else {
- mr->MediaId = sql_insert_id(mdb, _("Media"));
+ mr->MediaId = sql_insert_id(mdb, NT_("Media"));
stat = 1;
if (mr->set_label_date) {
char dt[MAX_TIME_LENGTH];
cr->ClientId = 0;
stat = 0;
} else {
- cr->ClientId = sql_insert_id(mdb, _("Client"));
+ cr->ClientId = sql_insert_id(mdb, NT_("Client"));
stat = 1;
}
db_unlock(mdb);
fsr->FileSetId = 0;
stat = false;
} else {
- fsr->FileSetId = sql_insert_id(mdb, _("FileSet"));
+ fsr->FileSetId = sql_insert_id(mdb, NT_("FileSet"));
fsr->created = true;
stat = true;
}
*/
if (!(ar->Stream == STREAM_UNIX_ATTRIBUTES ||
ar->Stream == STREAM_UNIX_ATTRIBUTES_EX)) {
- Mmsg0(&mdb->errmsg, _("Attempt to put non-attributes into catalog\n"));
+ Mmsg1(&mdb->errmsg, _("Attempt to put non-attributes into catalog. Stream=%d\n"),
+ ar->Stream);
Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
goto bail_out;
}
static int db_create_file_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
{
int stat;
+ static char *no_sig = "0";
+ char *sig;
ASSERT(ar->JobId);
ASSERT(ar->PathId);
ASSERT(ar->FilenameId);
+ if (ar->Sig == NULL || ar->Sig[0] == 0) {
+ sig = no_sig;
+ } else {
+ sig = ar->Sig;
+ }
+
/* Must create it */
Mmsg(mdb->cmd,
"INSERT INTO File (FileIndex,JobId,PathId,FilenameId,"
- "LStat,MD5) VALUES (%u,%u,%u,%u,'%s','0')",
+ "LStat,MD5) VALUES (%u,%u,%u,%u,'%s','%s')",
ar->FileIndex, ar->JobId, ar->PathId, ar->FilenameId,
- ar->attr);
+ ar->attr, sig);
if (!INSERT_DB(jcr, mdb, mdb->cmd)) {
Mmsg2(&mdb->errmsg, _("Create db File record %s failed. ERR=%s"),
ar->FileId = 0;
stat = 0;
} else {
- ar->FileId = sql_insert_id(mdb, _("File"));
+ ar->FileId = sql_insert_id(mdb, NT_("File"));
stat = 1;
}
return stat;
ar->PathId = 0;
stat = 0;
} else {
- ar->PathId = sql_insert_id(mdb, _("Path"));
+ ar->PathId = sql_insert_id(mdb, NT_("Path"));
stat = 1;
}
Jmsg(jcr, M_FATAL, 0, "%s", mdb->errmsg);
ar->FilenameId = 0;
} else {
- ar->FilenameId = sql_insert_id(mdb, _("Filename"));
+ ar->FilenameId = sql_insert_id(mdb, NT_("Filename"));
}
return ar->FilenameId > 0;
}