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:
alex 2010-08-24 17:53:24 +00:00
parent 623b930fbf
commit db2c12c1d5
6 changed files with 68 additions and 22 deletions

View File

@ -215,6 +215,8 @@ bool TRecordset::save_as_text(const char* path)
ofstream out(path); ofstream out(path);
TString val; TString val;
const char sep = text_separator();
const bool as400 = (sep == ' ');
const unsigned int cols = columns(); const unsigned int cols = columns();
for (bool ok = move_first(); ok; ok = move_next()) for (bool ok = move_first(); ok; ok = move_next())
@ -225,8 +227,22 @@ bool TRecordset::save_as_text(const char* path)
if (var.is_null() && c >= cols) if (var.is_null() && c >= cols)
break; break;
if (c > 0) if (c > 0 && !as400)
out << '\t'; out << sep;
if (as400)
{
var.as_string(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()) if (!var.is_empty())
{ {
var.as_string(val); var.as_string(val);
@ -241,6 +257,7 @@ bool TRecordset::save_as_text(const char* path)
} }
} }
} }
}
out << endl; out << endl;
if (!pi.addstatus(1)) if (!pi.addstatus(1))
break; break;
@ -412,6 +429,12 @@ bool TRecordset::save_as(const char* path, TRecordsetExportFormat fmt, int mode)
ext.lower(); ext.lower();
if (ext == "htm" || ext == "html" || ext == "xml" || ext == "xls") if (ext == "htm" || ext == "html" || ext == "xml" || ext == "xls")
fmt = fmt_html; fmt = fmt_html;
else
if (ext == "dbf")
fmt = fmt_dbf;
else
if (ext == "csv")
fmt = fmt_csv;
} }
bool ok = false; bool ok = false;
switch (fmt) switch (fmt)
@ -419,6 +442,8 @@ bool TRecordset::save_as(const char* path, TRecordsetExportFormat fmt, int mode)
case fmt_html : ok = save_as_html(path); break; case fmt_html : ok = save_as_html(path); break;
case fmt_campo : ok = save_as_campo(path); break; case fmt_campo : ok = save_as_campo(path); break;
case fmt_dbf : ok = save_as_dbf(path, mode); 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; default : ok = save_as_text(path); break;
} }
@ -673,7 +698,7 @@ bool TRecordset::ask_variables(bool all)
const TString& TRecordset::driver_version() const const TString& TRecordset::driver_version() const
{ return EMPTY_STRING; } { return EMPTY_STRING; }
TRecordset::TRecordset() : _parentset(NULL) TRecordset::TRecordset() : _parentset(NULL), _text_separator('\t')
{ } { }
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////

View File

@ -19,6 +19,10 @@ struct TRecordset_column_info : public TObject
int _width, _pos; int _width, _pos;
TFieldtypes _type; 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) {} TRecordset_column_info() : _width(0), _pos(0), _type(_alfafld) {}
}; };
@ -26,18 +30,21 @@ struct TRecordset_column_info : public TObject
// TRecordset // 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 class TRecordset : public TObject
{ {
TAssoc_array _var; TAssoc_array _var;
TString_array _varnames; TString_array _varnames;
const TRecordset* _parentset; const TRecordset* _parentset;
char _text_separator;
protected: protected:
bool save_as_html(const char* path); bool save_as_html(const char* path);
bool save_as_silk(const char* path); bool save_as_silk(const char* path);
bool save_as_text(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_campo(const char* path);
bool save_as_dbf(const char* table, int mode); 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& query_text() const pure;
virtual const TString& driver_version() const; 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_first() { return move_to(0); }
virtual bool move_prev() { return move_to(current_row()-1); } virtual bool move_prev() { return move_to(current_row()-1); }
virtual bool move_next() { 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 unsigned int columns() const pure;
virtual const TRecordset_column_info& column_info(unsigned int column) 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 TVariant& get(unsigned int column) const pure;
virtual const TString_array& variables() const { return _varnames; } virtual const TString_array& variables() const { return _varnames; }
@ -113,6 +124,7 @@ public:
virtual TRecnotype current_row() const; virtual TRecnotype current_row() const;
virtual unsigned int columns() const; virtual unsigned int columns() const;
virtual const TRecordset_column_info& column_info(unsigned int c) 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(unsigned int column) const;
virtual const TVariant& get(const char* column_name) 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);} virtual const TVariant& get(int logic, const char* field) const { return get_field(logic, field);}

6
include/riclpdc.h Executable file
View 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"

View File

@ -62,7 +62,7 @@ TString& TTable_application::get_mask_name(TString& t) const
TTable& tab = (TTable&) _rel->lfile(); TTable& tab = (TTable&) _rel->lfile();
TString16 m = _tabname; TString16 m = _tabname;
if (m[0] == '%') m.ltrim(1); if (m[0] == '%' || m[0] == '&') m.ltrim(1);
t = tab.module(); t = tab.module();
t << "tb" << m; t << "tb" << m;

View File

@ -571,7 +571,7 @@ long daytime()
static bool is_aga_station(const char* hostname) static bool is_aga_station(const char* hostname)
{ {
const char* const ranger[] = { "ANTARES", "ARCHIMEDE", "BATMOBILE", "KIRK", 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++) for (int i = 0; ranger[i]; i++)
if (xvt_str_compare_ignoring_case(hostname, ranger[i]) == 0) if (xvt_str_compare_ignoring_case(hostname, ranger[i]) == 0)
return true; return true;

View File

@ -9,6 +9,9 @@
#include <../xvaga/incstr.h> #include <../xvaga/incstr.h>
#endif #endif
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
class TPerformance_profiler : public TObject class TPerformance_profiler : public TObject
{ {
TString _desc; TString _desc;