Patch level :10.0 954 in avanti

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
aggiunto metodo build_trc per raccattare il tracciato record di un csv recordset salvato in fmt_html se il recordset non ha delle column già esplicitamente definite (prima applicazione ve3800)


git-svn-id: svn://10.65.10.50/branches/R_10_00@21780 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2011-03-14 11:34:20 +00:00
parent ea36c4b0a6
commit 6bcba93538
3 changed files with 23 additions and 11 deletions

View File

@ -153,7 +153,8 @@ bool TRecordset::save_as_html(const char* path)
str << tok;
}
if (get_attr(c, attr, true))
out << " <th style=\"color : #" << format("%06x", attr.get_foreground() & 0xFFFFFF) << "; background-color : #" << format("%06x", attr.get_background() & 0xFFFFFF) << "\">" ;
out << " <th style=\"color : #" << format("%06x", attr.get_foreground() & 0xFFFFFF)
<< "; background-color : #" << format("%06x", attr.get_background() & 0xFFFFFF) << "\">" ;
else
out << " <th>";
@ -176,7 +177,8 @@ bool TRecordset::save_as_html(const char* path)
const TRecordset_column_info& ci = column_info(c);
if (get_attr(c, attr))
out << " <td style=\"color : #" << format("%06x", attr.get_foreground() & 0xFFFFFF) << "; background-color : #" << format("%06x", attr.get_background() & 0xFFFFFF) << "\">" ;
out << " <td style=\"color : #" << format("%06x", attr.get_foreground() & 0xFFFFFF)
<< "; background-color : #" << format("%06x", attr.get_background() & 0xFFFFFF) << "\">" ;
else
out << " <td>";
switch (ci._type)
@ -184,12 +186,13 @@ bool TRecordset::save_as_html(const char* path)
case _intfld:
case _longfld:
{
const long r = get(c).as_int();
const TVariant& var = get(c);
const long r = var.as_int();
val.cut(0);
if (r != 0)
val << r;
else
get(c).as_string(val);
var.as_string(val);
}
break;
case _realfld:

View File

@ -252,8 +252,10 @@ unsigned int TCSV_recordset::columns() const
unsigned int c = _trc.items();
if (c == 0)
{
const TRecnotype i = items();
const TRecnotype i = items(); //rilegge fai di testo e tenta di crearne il tracciato _trc
c = _trc.items();
if (c == 0 && i > 0)
c = ((TCSV_recordset*)this)->build_trc();
}
return c;
}
@ -286,11 +288,8 @@ void TCSV_recordset::create_column(const char * name, TFieldtypes type)
_trc.add(info);
}
bool TCSV_recordset::load_file(const TFilename& n)
unsigned int TCSV_recordset::build_trc()
{
if (!TText_recordset::load_file(n))
return false;
_trc.destroy();
int cols = 1;
int i;
@ -336,7 +335,16 @@ bool TCSV_recordset::load_file(const TFilename& n)
}
}
return true;
return _trc.items();
}
bool TCSV_recordset::load_file(const TFilename& n)
{
if (!TText_recordset::load_file(n))
return false;
return build_trc() > 0;
}
bool TCSV_recordset::set(unsigned int column, const TVariant& var)

View File

@ -71,6 +71,7 @@ protected:
char separator() const { return _separator; }
void set_separator(const char s) { CHECK(s != 0, "Invalid separator"); _separator = s; }
virtual TQuery_type parse_query(const char* query, TFilename& table);
unsigned int build_trc();
public:
virtual unsigned int columns() const;