Patch level :10.0

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
la save_as deve ritornare false se non riesce il salvataggio


git-svn-id: svn://10.65.10.50/branches/R_10_00@22205 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2011-06-01 14:19:19 +00:00
parent 80e9fd0938
commit 7c26664d17
2 changed files with 30 additions and 10 deletions

View File

@ -98,8 +98,12 @@ const TToken_string& TRecordset::sheet_head() const
bool TRecordset::save_as_html(const char* path)
{
TProgind pi(items(), TR("Esportazione in corso..."), true, true);
ofstream out(path);
if (out.fail())
return false;
TProgind pi(items(), TR("Esportazione in corso..."), true, true);
out << "<html>" << endl;
save_html_head(out, main_app().title());
out << "<body>" << endl;
@ -231,9 +235,12 @@ bool TRecordset::save_as_html(const char* path)
bool TRecordset::save_as_text(const char* path)
{
ofstream out(path);
if (out.fail())
return false;
TProgind pi(items(), TR("Esportazione in corso..."), true, true);
ofstream out(path);
TString val;
const char sep = text_separator();
const bool as400 = (sep == ' ');
@ -288,9 +295,12 @@ bool TRecordset::save_as_text(const char* path)
bool TRecordset::save_as_campo(const char* path)
{
TProgind pi(items(), TR("Esportazione in corso..."), true, true);
ofstream out(path);
if (out.fail())
return false;
TProgind pi(items(), TR("Esportazione in corso..."), true, true);
out << "[Head]" << endl;
out << "Version=0";

View File

@ -186,14 +186,19 @@ bool TText_recordset::exec(const char* query)
bool TText_recordset::save_as_text(const char* path)
{
bool ok = path && *path;
if (ok)
bool valid = path && *path;
if (valid)
{
ofstream out(path);
for (bool ok = move_first(); ok; ok = move_next())
out << row() << endl;
if (out.good())
{
for (bool ok = move_first(); ok; ok = move_next())
out << row() << endl;
}
else
valid = false;
}
return ok;
return valid;
}
bool TText_recordset::save_as(const char* path, TRecordsetExportFormat fmt)
@ -685,8 +690,13 @@ bool TAS400_recordset::save_as_text(const char* path)
if (valid)
{
ofstream out(path, ios::binary);
for (bool ok = move_first(); ok; ok = move_next())
out << row(); // NON mettere << endl
if (out.good())
{
for (bool ok = move_first(); ok; ok = move_next())
out << row(); // NON mettere << endl
}
else
valid = false;
}
return valid;
}