Patch level : 10,0 nopatch
Files correlati : ri0.exe Ricompilazione Demo : [ ] Commento : Riclassificazioni git-svn-id: svn://10.65.10.50/branches/R_10_00@20792 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
623b930fbf
commit
db2c12c1d5
@ -215,6 +215,8 @@ bool TRecordset::save_as_text(const char* path)
|
||||
|
||||
ofstream out(path);
|
||||
TString val;
|
||||
const char sep = text_separator();
|
||||
const bool as400 = (sep == ' ');
|
||||
|
||||
const unsigned int cols = columns();
|
||||
for (bool ok = move_first(); ok; ok = move_next())
|
||||
@ -225,20 +227,35 @@ bool TRecordset::save_as_text(const char* path)
|
||||
if (var.is_null() && c >= cols)
|
||||
break;
|
||||
|
||||
if (c > 0)
|
||||
out << '\t';
|
||||
if (!var.is_empty())
|
||||
{
|
||||
if (c > 0 && !as400)
|
||||
out << sep;
|
||||
if (as400)
|
||||
{
|
||||
var.as_string(val);
|
||||
val.rtrim();
|
||||
if (val.find('\n') >= 0 || val.find('\t') >= 0)
|
||||
out << unesc(val); // Evitiamo doppi separatori di campo e record
|
||||
else
|
||||
{
|
||||
if (var.type() == _realfld || (cols == 0 && is_numeric(val)))
|
||||
num_reformat(val);
|
||||
out << val;
|
||||
}
|
||||
if (var.type() == _realfld || (cols == 0 && is_numeric(val)))
|
||||
{
|
||||
num_reformat(val);
|
||||
val.lpad(column_info(c)._width);
|
||||
}
|
||||
else
|
||||
val.rpad(column_info(c)._width);
|
||||
out << val;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!var.is_empty())
|
||||
{
|
||||
var.as_string(val);
|
||||
val.rtrim();
|
||||
if (val.find('\n') >= 0 || val.find('\t') >= 0)
|
||||
out << unesc(val); // Evitiamo doppi separatori di campo e record
|
||||
else
|
||||
{
|
||||
if (var.type() == _realfld || (cols == 0 && is_numeric(val)))
|
||||
num_reformat(val);
|
||||
out << val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
out << endl;
|
||||
@ -412,14 +429,22 @@ bool TRecordset::save_as(const char* path, TRecordsetExportFormat fmt, int mode)
|
||||
ext.lower();
|
||||
if (ext == "htm" || ext == "html" || ext == "xml" || ext == "xls")
|
||||
fmt = fmt_html;
|
||||
else
|
||||
if (ext == "dbf")
|
||||
fmt = fmt_dbf;
|
||||
else
|
||||
if (ext == "csv")
|
||||
fmt = fmt_csv;
|
||||
}
|
||||
bool ok = false;
|
||||
switch (fmt)
|
||||
{
|
||||
case fmt_html : ok = save_as_html(path); break;
|
||||
case fmt_campo: ok = save_as_campo(path); break;
|
||||
case fmt_dbf : ok = save_as_dbf(path, mode); break;
|
||||
default : ok = save_as_text(path); break;
|
||||
case fmt_html : ok = save_as_html(path); break;
|
||||
case fmt_campo : ok = save_as_campo(path); break;
|
||||
case fmt_dbf : ok = save_as_dbf(path, mode); break;
|
||||
case fmt_as400 : ok = save_as_as400(path); break;
|
||||
case fmt_csv : ok = save_as_csv(path); break;
|
||||
default : ok = save_as_text(path); break;
|
||||
}
|
||||
|
||||
return ok;
|
||||
@ -673,7 +698,7 @@ bool TRecordset::ask_variables(bool all)
|
||||
const TString& TRecordset::driver_version() const
|
||||
{ return EMPTY_STRING; }
|
||||
|
||||
TRecordset::TRecordset() : _parentset(NULL)
|
||||
TRecordset::TRecordset() : _parentset(NULL), _text_separator('\t')
|
||||
{ }
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
@ -19,6 +19,10 @@ struct TRecordset_column_info : public TObject
|
||||
int _width, _pos;
|
||||
TFieldtypes _type;
|
||||
|
||||
void copy(const TRecordset_column_info & i) { _name = i._name; _width = i._width; _pos = i._pos; _type = i._type; }
|
||||
virtual TObject* dup() const { return new TRecordset_column_info(*this); }
|
||||
|
||||
TRecordset_column_info(const TRecordset_column_info & i) {copy(i);}
|
||||
TRecordset_column_info() : _width(0), _pos(0), _type(_alfafld) {}
|
||||
};
|
||||
|
||||
@ -26,18 +30,21 @@ struct TRecordset_column_info : public TObject
|
||||
// TRecordset
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
enum TRecordsetExportFormat { fmt_unknown, fmt_html, fmt_text, fmt_campo, fmt_dbf };
|
||||
enum TRecordsetExportFormat { fmt_unknown, fmt_html, fmt_text, fmt_campo, fmt_dbf, fmt_as400, fmt_csv };
|
||||
|
||||
class TRecordset : public TObject
|
||||
{
|
||||
TAssoc_array _var;
|
||||
TString_array _varnames;
|
||||
const TRecordset* _parentset;
|
||||
char _text_separator;
|
||||
|
||||
protected:
|
||||
bool save_as_html(const char* path);
|
||||
bool save_as_silk(const char* path);
|
||||
bool save_as_text(const char* path);
|
||||
bool save_as_as400(const char* path) { set_text_separator(' '); return save_as_text(path);}
|
||||
bool save_as_csv(const char* path) { set_text_separator(';'); return save_as_text(path);}
|
||||
bool save_as_campo(const char* path);
|
||||
bool save_as_dbf(const char* table, int mode);
|
||||
|
||||
@ -55,6 +62,9 @@ public: // Absolutely needed methods
|
||||
virtual const TString& query_text() const pure;
|
||||
virtual const TString& driver_version() const;
|
||||
|
||||
virtual char text_separator() const { return _text_separator;}
|
||||
virtual void set_text_separator(char sep) { _text_separator = sep;}
|
||||
|
||||
virtual bool move_first() { return move_to(0); }
|
||||
virtual bool move_prev() { return move_to(current_row()-1); }
|
||||
virtual bool move_next() { return move_to(current_row()+1); }
|
||||
@ -64,6 +74,7 @@ public: // Absolutely needed methods
|
||||
|
||||
virtual unsigned int columns() const pure;
|
||||
virtual const TRecordset_column_info& column_info(unsigned int column) const pure;
|
||||
virtual const TRecordset_column_info& add_column_info(const TRecordset_column_info& c) {return c; }
|
||||
virtual const TVariant& get(unsigned int column) const pure;
|
||||
|
||||
virtual const TString_array& variables() const { return _varnames; }
|
||||
@ -101,7 +112,7 @@ protected:
|
||||
virtual void reset();
|
||||
virtual const TVariant& get_field(int logic, const char* field) const;
|
||||
virtual void set_custom_filter(TCursor& cursor) const { }
|
||||
|
||||
|
||||
|
||||
public:
|
||||
bool valid_cursor() const { return _cursor != NULL; }
|
||||
@ -113,6 +124,7 @@ public:
|
||||
virtual TRecnotype current_row() const;
|
||||
virtual unsigned int columns() const;
|
||||
virtual const TRecordset_column_info& column_info(unsigned int c) const;
|
||||
virtual const TRecordset_column_info& add_column_info(const TRecordset_column_info& c) { _column.add(c); return c; }
|
||||
virtual const TVariant& get(unsigned int column) const;
|
||||
virtual const TVariant& get(const char* column_name) const;
|
||||
virtual const TVariant& get(int logic, const char* field) const { return get_field(logic, field);}
|
||||
|
6
include/riclpdc.h
Executable file
6
include/riclpdc.h
Executable file
@ -0,0 +1,6 @@
|
||||
#define RICLPDC_TIPORIC "TIPORIC"
|
||||
#define RICLPDC_GRUPPO "GRUPPO"
|
||||
#define RICLPDC_CONTO "CONTO"
|
||||
#define RICLPDC_SOTTOCONTO "SOTTOCONTO"
|
||||
#define RICLPDC_CODICE "CODICE"
|
||||
#define RICLPDC_DESCRIZ "DESCRIZ"
|
@ -62,7 +62,7 @@ TString& TTable_application::get_mask_name(TString& t) const
|
||||
TTable& tab = (TTable&) _rel->lfile();
|
||||
|
||||
TString16 m = _tabname;
|
||||
if (m[0] == '%') m.ltrim(1);
|
||||
if (m[0] == '%' || m[0] == '&') m.ltrim(1);
|
||||
|
||||
t = tab.module();
|
||||
t << "tb" << m;
|
||||
|
@ -571,7 +571,7 @@ long daytime()
|
||||
static bool is_aga_station(const char* hostname)
|
||||
{
|
||||
const char* const ranger[] = { "ANTARES", "ARCHIMEDE", "BATMOBILE", "KIRK",
|
||||
"MOBILE", "PICARD", "SPOCK", "SULU", "UHURA", NULL };
|
||||
"MOBILE", "PICARD", "SPOCK", "SULU", "UHURA", "ARCHIMEDE1", NULL };
|
||||
for (int i = 0; ranger[i]; i++)
|
||||
if (xvt_str_compare_ignoring_case(hostname, ranger[i]) == 0)
|
||||
return true;
|
||||
|
@ -9,6 +9,9 @@
|
||||
#include <../xvaga/incstr.h>
|
||||
#endif
|
||||
|
||||
#define STRINGIFY(x) #x
|
||||
#define TOSTRING(x) STRINGIFY(x)
|
||||
|
||||
class TPerformance_profiler : public TObject
|
||||
{
|
||||
TString _desc;
|
||||
|
Loading…
x
Reference in New Issue
Block a user