Patch level : 2.1 nopatch
Files correlati : ba1.exe ba8.exe Ricompilazione Demo : [ ] Commento : ba1* Allineati a destra i campi numerici dello sheet principale ba8* Nuovi miglioramenti alla generazione query (Hidden, Group by e Order by) git-svn-id: svn://10.65.10.50/trunk@11808 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
e78b03e4da
commit
c633e5ca52
@ -37,7 +37,7 @@ public:
|
|||||||
void add();
|
void add();
|
||||||
void rebuild() { _items = _dir->items();}
|
void rebuild() { _items = _dir->items();}
|
||||||
|
|
||||||
TDir_sheet(const char* title,byte buttons=0x8,const char* col = "N.@5|Nome@20|EOD@7|EOX@7|Lung. |Descrizione@43|Formula@33|Flags@7");
|
TDir_sheet(const char* title,byte buttons=0x8,const char* col = "N.@3R|Nome@20|EOD@R7|EOX@R7|Lung.@R7|Descrizione@43|Formula@33|Flags@R7");
|
||||||
virtual ~TDir_sheet();
|
virtual ~TDir_sheet();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ void TDir_sheet::get_row(long n, TToken_string& l)
|
|||||||
{
|
{
|
||||||
n++;
|
n++;
|
||||||
_dir->get ((int)n,_nolock,_nordir,_sysdirop);
|
_dir->get ((int)n,_nolock,_nordir,_sysdirop);
|
||||||
l.format("%3d", n); // Numero progressivo del file
|
l.format("%d", n); // Numero progressivo del file
|
||||||
l.add(_dir->name());
|
l.add(_dir->name());
|
||||||
l.add(_dir->eod());
|
l.add(_dir->eod());
|
||||||
l.add(_dir->eox());
|
l.add(_dir->eox());
|
||||||
|
@ -164,9 +164,6 @@ void TTest_application::test4()
|
|||||||
message_box(msg);
|
message_box(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void TTest_application::main_loop()
|
void TTest_application::main_loop()
|
||||||
{
|
{
|
||||||
test1();
|
test1();
|
||||||
|
@ -18,14 +18,10 @@
|
|||||||
#include "ba1500b.h"
|
#include "ba1500b.h"
|
||||||
#include "ba1600.h"
|
#include "ba1600.h"
|
||||||
|
|
||||||
#define USERADR 26952
|
|
||||||
#define AGAADR 26953
|
|
||||||
#define PRASSIADR 26954
|
|
||||||
#define K1 0x4500
|
#define K1 0x4500
|
||||||
#define LBYTEMASK 0x00FF
|
#define LBYTEMASK 0x00FF
|
||||||
#define UBYTEMASK 0xFF00
|
#define UBYTEMASK 0xFF00
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
TInformazione_moduli::TInformazione_moduli()
|
TInformazione_moduli::TInformazione_moduli()
|
||||||
|
@ -122,8 +122,8 @@ protected:
|
|||||||
bool do_process(TToken_string& commands) const;
|
bool do_process(TToken_string& commands) const;
|
||||||
bool pre_process(TInstall_ini& ini, const char* module) const;
|
bool pre_process(TInstall_ini& ini, const char* module) const;
|
||||||
bool post_process(TInstall_ini& ini, const char* module) const;
|
bool post_process(TInstall_ini& ini, const char* module) const;
|
||||||
bool get_internet_path(TFilename& ininame);
|
bool get_internet_path(TFilename& ininame) const;
|
||||||
void parse_internet_path(TString& http_server, TFilename& http_path);
|
void parse_internet_path(TString& http_server, TFilename& http_path) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool installed() { return _installed;}
|
bool installed() { return _installed;}
|
||||||
@ -201,10 +201,10 @@ bool TInstaller_mask::has_module(int modnumber) const
|
|||||||
if (modnumber == SRAUT)
|
if (modnumber == SRAUT)
|
||||||
{
|
{
|
||||||
char s[16];
|
char s[16];
|
||||||
if (CGetCampoStpValue("Servers", s, sizeof(s)))
|
if (xvt_fsys_get_campo_stp_value("Servers", s, sizeof(s)))
|
||||||
return atoi(s) > 0;
|
return atoi(s) > 0;
|
||||||
}
|
}
|
||||||
return main_app().has_module(modnumber,CHK_DONGLE);
|
return main_app().has_module(modnumber, CHK_DONGLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int TInstaller_mask::precheck_modules(bool only_newer)
|
int TInstaller_mask::precheck_modules(bool only_newer)
|
||||||
@ -221,12 +221,11 @@ int TInstaller_mask::precheck_modules(bool only_newer)
|
|||||||
currrelease = rigar.get(C_CURRRELEASE);
|
currrelease = rigar.get(C_CURRRELEASE);
|
||||||
currpatch = rigar.get_int(C_CURRPATCH);
|
currpatch = rigar.get_int(C_CURRPATCH);
|
||||||
modnumber=get_module_number(rigar.get(C_CODE));
|
modnumber=get_module_number(rigar.get(C_CODE));
|
||||||
if (modnumber >= 0 &&
|
if (modnumber >= 0 && has_module(modnumber) &&
|
||||||
!release.blank() &&
|
!release.blank() &&
|
||||||
((release > currrelease) ||
|
((release > currrelease) ||
|
||||||
(release == currrelease
|
(release == currrelease && (only_newer ? patchlevel>currpatch: patchlevel>=currpatch) ))
|
||||||
&& (only_newer ? patchlevel>currpatch: patchlevel>=currpatch) ))
|
)
|
||||||
&& has_module(modnumber) )
|
|
||||||
{
|
{
|
||||||
// checca il modulo o la patch se ho installata la stessa versione
|
// checca il modulo o la patch se ho installata la stessa versione
|
||||||
const bool chk = rigar.get_char(C_ISPATCH) != 'X' || release == currrelease;
|
const bool chk = rigar.get_char(C_ISPATCH) != 'X' || release == currrelease;
|
||||||
@ -987,7 +986,7 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TInstaller_mask::get_internet_path(TFilename &ininame )
|
bool TInstaller_mask::get_internet_path(TFilename &ininame) const
|
||||||
{
|
{
|
||||||
ininame = get(F_PATH);
|
ininame = get(F_PATH);
|
||||||
if (is_internet_path(ininame))
|
if (is_internet_path(ininame))
|
||||||
@ -999,7 +998,7 @@ bool TInstaller_mask::get_internet_path(TFilename &ininame )
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TInstaller_mask::parse_internet_path(TString & http_server, TFilename &http_path )
|
void TInstaller_mask::parse_internet_path(TString & http_server, TFilename &http_path) const
|
||||||
{
|
{
|
||||||
http_server = get(F_PATH);
|
http_server = get(F_PATH);
|
||||||
if (http_server.compare("http://", 7, TRUE) == 0)
|
if (http_server.compare("http://", 7, TRUE) == 0)
|
||||||
@ -1017,9 +1016,6 @@ void TInstaller_mask::parse_internet_path(TString & http_server, TFilename &http
|
|||||||
http_path = http_default_path;
|
http_path = http_default_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool TInstaller_mask::install_patches(const TString& module, const TString& lastrelease, int lastpatch, bool only_newer)
|
bool TInstaller_mask::install_patches(const TString& module, const TString& lastrelease, int lastpatch, bool only_newer)
|
||||||
{
|
{
|
||||||
bool ok = TRUE;
|
bool ok = TRUE;
|
||||||
|
172
ba/ba8200.cpp
172
ba/ba8200.cpp
@ -348,8 +348,9 @@ protected:
|
|||||||
void fill_fields();
|
void fill_fields();
|
||||||
void enable_sql_button();
|
void enable_sql_button();
|
||||||
void enable_field_buttons();
|
void enable_field_buttons();
|
||||||
|
void move_curr_field(int dir);
|
||||||
|
|
||||||
void tree2sql(TString& str);
|
void tree2sql(TString& from, TString& where);
|
||||||
void sheet2sql();
|
void sheet2sql();
|
||||||
void edit_query();
|
void edit_query();
|
||||||
|
|
||||||
@ -360,7 +361,7 @@ protected:
|
|||||||
|
|
||||||
bool save_tables_tree(TXmlItem& xml);
|
bool save_tables_tree(TXmlItem& xml);
|
||||||
bool save_fields_sheet(TXmlItem& xml);
|
bool save_fields_sheet(TXmlItem& xml);
|
||||||
void export(const char* ext);
|
void export(TQueryExportFormat fmt);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool load_query();
|
bool load_query();
|
||||||
@ -597,72 +598,111 @@ void TQuery_mask::enable_field_buttons()
|
|||||||
enable(F_ASTERISK, ok);
|
enable(F_ASTERISK, ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TQuery_mask::move_curr_field(int dir)
|
||||||
|
{
|
||||||
|
TSheet_field& s = sfield(F_SHEET);
|
||||||
|
const int sel = s.selected();
|
||||||
|
if (sel >= 0 && sel < s.items())
|
||||||
|
{
|
||||||
|
const int des = sel+dir;
|
||||||
|
if (des >= 0 && des < s.items())
|
||||||
|
{
|
||||||
|
s.rows_array().swap(sel, des);
|
||||||
|
s.select(des);
|
||||||
|
s.force_update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static bool sql_tree_handler(TTree& tree, void* jolly, word flags)
|
static bool sql_tree_handler(TTree& tree, void* jolly, word flags)
|
||||||
{
|
{
|
||||||
TRelation_node* rn = (TRelation_node*)tree.curr_node();
|
TRelation_node* rn = (TRelation_node*)tree.curr_node();
|
||||||
TString& sql = *(TString*)jolly;
|
TPointer_array& arr = *(TPointer_array*)jolly;
|
||||||
|
TString& from = *(TString*)arr.objptr(0);
|
||||||
|
TString& where = *(TString*)arr.objptr(1);
|
||||||
TString_array& join = rn->join();
|
TString_array& join = rn->join();
|
||||||
TString str;
|
TString str;
|
||||||
FOR_EACH_ARRAY_ROW(join, i, row)
|
|
||||||
|
if (from.find(rn->id()) < 0)
|
||||||
{
|
{
|
||||||
if (sql.find(*row) < 0)
|
if (from.not_empty())
|
||||||
|
from << ',';
|
||||||
|
from << rn->id();
|
||||||
|
|
||||||
|
FOR_EACH_ARRAY_ROW(join, i, row)
|
||||||
{
|
{
|
||||||
if (sql.empty())
|
if (where.find(*row) < 0)
|
||||||
sql << "WHERE ";
|
{
|
||||||
else
|
if (where.not_empty())
|
||||||
sql << "AND";
|
where << "AND";
|
||||||
sql << '(' << rn->id() << '.' << row->get(0) << '=';
|
where << '(' << rn->id() << '.' << row->get(0) << '=';
|
||||||
str = row->get();
|
str = row->get();
|
||||||
if (isalpha(str[0]))
|
if (isalpha(str[0]))
|
||||||
sql << rn->father()->id() << '.';
|
where << rn->father()->id() << '.';
|
||||||
sql << str << ')';
|
where << str << ')';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false; // Don't stop search
|
return false; // Don't stop search
|
||||||
}
|
}
|
||||||
|
|
||||||
// Riempie una stringa SQL con la relazione tra le tabelle
|
// Riempie una stringa SQL con la relazione tra le tabelle
|
||||||
void TQuery_mask::tree2sql(TString& str)
|
void TQuery_mask::tree2sql(TString& from, TString& where)
|
||||||
{
|
{
|
||||||
if (_tree.goto_root())
|
if (_tree.goto_root())
|
||||||
_tree.scan_depth_first(sql_tree_handler, &str);
|
{
|
||||||
|
TPointer_array a;
|
||||||
|
a.add(&from);
|
||||||
|
a.add(&where);
|
||||||
|
_tree.scan_depth_first(sql_tree_handler, &a);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Genera una query SQL a partire dallo spreadsheet F_SHEET
|
// Genera una query SQL a partire dallo spreadsheet F_SHEET
|
||||||
void TQuery_mask::sheet2sql()
|
void TQuery_mask::sheet2sql()
|
||||||
{
|
{
|
||||||
const TSheet_field& sheet = sfield(F_SHEET);
|
const TSheet_field& sheet = sfield(F_SHEET);
|
||||||
TAssoc_array tables;
|
TToken_string select(50, ',');
|
||||||
TToken_string select(50, ','), from(50, ',');
|
|
||||||
|
|
||||||
|
_tree.goto_root();
|
||||||
|
const bool multiple = _tree.has_son();
|
||||||
|
|
||||||
|
TToken_string from(50, ','), groupby(50, ','), orderby(50, ',');
|
||||||
|
TString where;
|
||||||
|
|
||||||
|
TString field;
|
||||||
FOR_EACH_SHEET_ROW(sheet, i, row)
|
FOR_EACH_SHEET_ROW(sheet, i, row)
|
||||||
{
|
{
|
||||||
const TString8 table = row->get(0);
|
field = row->get(1);
|
||||||
const TString16 field = row->get();
|
const bool hidden = *row->get(2) > ' ';
|
||||||
if (!table.blank() && !field.blank())
|
if (!field.blank() && !hidden)
|
||||||
{
|
{
|
||||||
if (!tables.is_key(table))
|
if (multiple)
|
||||||
{
|
{
|
||||||
tables.add(table);
|
field.insert(".");
|
||||||
from.add(table);
|
field.insert(row->get(0)); // Table name
|
||||||
}
|
}
|
||||||
select.add(table);
|
select.add(field); // Column name only
|
||||||
select << '.' << field;
|
|
||||||
|
if (*row->get(3) > ' ')
|
||||||
|
orderby.add(field);
|
||||||
|
if (*row->get(4) > ' ')
|
||||||
|
groupby.add(field);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tables.items() == 1)
|
|
||||||
{
|
tree2sql(from, where);
|
||||||
select.cut(0);
|
|
||||||
FOR_EACH_SHEET_ROW(sheet, i, row)
|
|
||||||
select.add(row->get(1));
|
|
||||||
}
|
|
||||||
|
|
||||||
TString sql;
|
TString sql;
|
||||||
sql << "SELECT " << select << '\n';
|
sql << "SELECT " << select << '\n';
|
||||||
sql << "FROM " << from << '\n';
|
sql << "FROM " << from << '\n';
|
||||||
|
sql << "WHERE " << where << '\n';
|
||||||
TString where; tree2sql(where);
|
if (groupby.not_empty())
|
||||||
sql << where << ";";
|
sql << "GROUP BY " << groupby << '\n';
|
||||||
|
if (orderby.not_empty())
|
||||||
|
sql << "ORDER BY " << orderby << '\n';
|
||||||
|
sql << ";";
|
||||||
|
|
||||||
set(F_SQL, sql);
|
set(F_SQL, sql);
|
||||||
}
|
}
|
||||||
@ -680,15 +720,28 @@ static int select_callback(void* jolly, int argc, char** value, char** field)
|
|||||||
void TQuery_mask::edit_query()
|
void TQuery_mask::edit_query()
|
||||||
{
|
{
|
||||||
TSQL_query qry(get(F_SQL));
|
TSQL_query qry(get(F_SQL));
|
||||||
TQuery_sheet sht(qry);
|
if (qry.columns() > 0)
|
||||||
sht.run();
|
{
|
||||||
|
TQuery_sheet sht(qry);
|
||||||
|
sht.run();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
warning_box(TR("Nessuna riga risultato"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TQuery_mask::export(const char* ext)
|
void TQuery_mask::export(TQueryExportFormat fmt)
|
||||||
{
|
{
|
||||||
xvt_fsys_save_dir();
|
xvt_fsys_save_dir();
|
||||||
TFilename path; path.tempdir();
|
TFilename path; path.tempdir();
|
||||||
|
|
||||||
|
const char* ext = "txt";
|
||||||
|
switch (fmt)
|
||||||
|
{
|
||||||
|
case fmt_html: ext = "html"; break;
|
||||||
|
case fmt_slk : ext = "xls"; break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
FILE_SPEC fs;
|
FILE_SPEC fs;
|
||||||
xvt_fsys_convert_str_to_dir(path, &fs.dir);
|
xvt_fsys_convert_str_to_dir(path, &fs.dir);
|
||||||
strcpy(fs.type, ext);
|
strcpy(fs.type, ext);
|
||||||
@ -703,7 +756,7 @@ void TQuery_mask::export(const char* ext)
|
|||||||
path.add(fs.name);
|
path.add(fs.name);
|
||||||
|
|
||||||
TSQL_query qry(get(F_SQL));
|
TSQL_query qry(get(F_SQL));
|
||||||
if (qry.save_as(path))
|
if (qry.save_as(path, fmt))
|
||||||
xvt_sys_goto_url(path, "open");
|
xvt_sys_goto_url(path, "open");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -804,8 +857,11 @@ bool TQuery_mask::save_fields_sheet(TXmlItem& xml)
|
|||||||
{
|
{
|
||||||
TXmlItem& field = fields.AddChild("field");
|
TXmlItem& field = fields.AddChild("field");
|
||||||
field.SetAttr("Table", row->get(0));
|
field.SetAttr("Table", row->get(0));
|
||||||
field.SetAttr("Name", row->get());
|
field.SetAttr("Name", row->get(1));
|
||||||
const char* str = row->get();
|
field.SetAttr("Hidden", *row->get(2) > ' ');
|
||||||
|
field.SetAttr("Sort", *row->get(3) > ' ');
|
||||||
|
field.SetAttr("Group", *row->get(4) > ' ');
|
||||||
|
const char* str = row->get(5);
|
||||||
if (str && *str > ' ')
|
if (str && *str > ' ')
|
||||||
field.SetAttr("Expr", str);
|
field.SetAttr("Expr", str);
|
||||||
}
|
}
|
||||||
@ -907,9 +963,12 @@ bool TQuery_mask::load_fields_sheet(TXmlItem& xml)
|
|||||||
{
|
{
|
||||||
const TXmlItem& field = *fields->GetChild(i);
|
const TXmlItem& field = *fields->GetChild(i);
|
||||||
TToken_string& row = sheet.row(-1);
|
TToken_string& row = sheet.row(-1);
|
||||||
row.add(field.GetAttr("Table"));
|
row.add(field.GetAttr("Table"),0);
|
||||||
row.add(field.GetAttr("Name"));
|
row.add(field.GetAttr("Name"),1);
|
||||||
row.add(field.GetAttr("Expr"));
|
row.add(field.GetBoolAttr("Hidden") ? "X" : "",2);
|
||||||
|
row.add(field.GetBoolAttr("Sort") ? "X" : "",3);
|
||||||
|
row.add(field.GetBoolAttr("Group") ? "X" : "",4);
|
||||||
|
row.add(field.GetAttr("Expr"),5);
|
||||||
}
|
}
|
||||||
sheet.force_update();
|
sheet.force_update();
|
||||||
}
|
}
|
||||||
@ -1037,21 +1096,37 @@ bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|||||||
if (e == fe_button)
|
if (e == fe_button)
|
||||||
edit_query();
|
edit_query();
|
||||||
break;
|
break;
|
||||||
|
case F_SQL:
|
||||||
|
if (e == fe_modify)
|
||||||
|
_is_dirty = true;
|
||||||
|
break;
|
||||||
case F_EXPORT_HTML:
|
case F_EXPORT_HTML:
|
||||||
if (e == fe_button)
|
if (e == fe_button)
|
||||||
export("html");
|
export(fmt_html);
|
||||||
break;
|
break;
|
||||||
case F_EXPORT_EXCEL:
|
case F_EXPORT_EXCEL:
|
||||||
if (e == fe_button)
|
if (e == fe_button)
|
||||||
export("xls");
|
export(fmt_slk);
|
||||||
break;
|
break;
|
||||||
case F_EXPORT_TXT:
|
case F_EXPORT_TXT:
|
||||||
if (e == fe_button)
|
if (e == fe_button)
|
||||||
export("txt");
|
export(fmt_txt);
|
||||||
|
break;
|
||||||
|
case F_EXPORT_CAMPO:
|
||||||
|
if (e == fe_button)
|
||||||
|
export(fmt_campo);
|
||||||
break;
|
break;
|
||||||
case F_SHEET:
|
case F_SHEET:
|
||||||
enable_sql_button();
|
enable_sql_button();
|
||||||
break;
|
break;
|
||||||
|
case F_MOVEUP:
|
||||||
|
if (e == fe_button)
|
||||||
|
move_curr_field(-1);
|
||||||
|
break;
|
||||||
|
case F_MOVEDN:
|
||||||
|
if (e == fe_button)
|
||||||
|
move_curr_field(+1);
|
||||||
|
break;
|
||||||
case DLG_NEWREC:
|
case DLG_NEWREC:
|
||||||
if (e == fe_button)
|
if (e == fe_button)
|
||||||
{
|
{
|
||||||
@ -1073,6 +1148,9 @@ bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|||||||
return false; // Do not exit!
|
return false; // Do not exit!
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case DLG_QUIT:
|
||||||
|
save_if_needed();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#define F_SQL 152
|
#define F_SQL 152
|
||||||
#define F_TABLES 200
|
#define F_TABLES 200
|
||||||
#define F_FIELDS 300
|
#define F_FIELDS 300
|
||||||
#define F_SHEET 400
|
|
||||||
#define F_ADDFILE 301
|
#define F_ADDFILE 301
|
||||||
#define F_EDITFILE 302
|
#define F_EDITFILE 302
|
||||||
#define F_ASTERISK 303
|
#define F_ASTERISK 303
|
||||||
@ -12,6 +11,10 @@
|
|||||||
#define F_EXPORT_HTML 306
|
#define F_EXPORT_HTML 306
|
||||||
#define F_EXPORT_EXCEL 307
|
#define F_EXPORT_EXCEL 307
|
||||||
#define F_EXPORT_TXT 308
|
#define F_EXPORT_TXT 308
|
||||||
|
#define F_EXPORT_CAMPO 309
|
||||||
|
#define F_SHEET 400
|
||||||
|
#define F_MOVEUP 401
|
||||||
|
#define F_MOVEDN 402
|
||||||
|
|
||||||
#define F_FATHER 201
|
#define F_FATHER 201
|
||||||
#define F_FATHER_ALIAS 202
|
#define F_FATHER_ALIAS 202
|
||||||
|
@ -56,7 +56,7 @@ BEGIN
|
|||||||
PROMPT 1 1 ""
|
PROMPT 1 1 ""
|
||||||
END
|
END
|
||||||
|
|
||||||
SPREADSHEET F_FIELDS 30 10
|
SPREADSHEET F_FIELDS 40 10
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 34 1 ""
|
PROMPT 34 1 ""
|
||||||
ITEM "Nome@12F"
|
ITEM "Nome@12F"
|
||||||
@ -68,38 +68,53 @@ END
|
|||||||
|
|
||||||
BUTTON F_ADDFILE 10 2
|
BUTTON F_ADDFILE 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -16 11 "~Tabella"
|
PROMPT -15 11 "~Tabella"
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON F_EDITFILE 10 2
|
BUTTON F_EDITFILE 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -26 11 "~Edit"
|
PROMPT -25 11 "~Edit"
|
||||||
PICTURE BMP_EDIT
|
PICTURE BMP_EDIT
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON DLG_USER 10 2
|
BUTTON DLG_USER 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -46 11 "~Campo"
|
PROMPT -35 11 "~Campo"
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON F_ASTERISK 10 2
|
BUTTON F_ASTERISK 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -56 11 "Campo ~*"
|
PROMPT -45 11 "Campo ~*"
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON F_GENSQL 10 2
|
BUTTON F_GENSQL 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -66 11 "~SQL"
|
PROMPT -55 11 "~SQL"
|
||||||
END
|
END
|
||||||
|
|
||||||
SPREADSHEET F_SHEET
|
SPREADSHEET F_SHEET -5
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 0 13 ""
|
PROMPT 0 13 ""
|
||||||
ITEM "Tabella@12F"
|
ITEM "Tabella@12F"
|
||||||
ITEM "Colonna@32F"
|
ITEM "Colonna@32F"
|
||||||
|
ITEM "Nas.@3"
|
||||||
|
ITEM "Ord.@3"
|
||||||
|
ITEM "Grp.@3"
|
||||||
ITEM "Condizione@50"
|
ITEM "Condizione@50"
|
||||||
END
|
END
|
||||||
|
|
||||||
|
BUTTON F_MOVEUP 2 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -1 15 "Up"
|
||||||
|
PICTURE 1662
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON F_MOVEDN 2 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -1 18 "Dn"
|
||||||
|
PICTURE 1663
|
||||||
|
END
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
PAGE "Sql" -1 -1 78 23
|
PAGE "Sql" -1 -1 78 23
|
||||||
@ -130,6 +145,12 @@ BEGIN
|
|||||||
PROMPT -45 -1 "~Testo+Tab"
|
PROMPT -45 -1 "~Testo+Tab"
|
||||||
END
|
END
|
||||||
|
|
||||||
|
BUTTON F_EXPORT_CAMPO 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -55 -1 "~Scarica"
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
ENDMASK
|
ENDMASK
|
||||||
@ -180,19 +201,34 @@ PAGE "CampiQuery" -1 -1 60 13
|
|||||||
|
|
||||||
STRING 101 12
|
STRING 101 12
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 1 "Tabella "
|
PROMPT 1 0 "Tabella "
|
||||||
CHECKTYPE REQUIRED
|
CHECKTYPE REQUIRED
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING 102 32
|
STRING 102 50
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 31 1 "Colonna "
|
PROMPT 1 1 "Colonna "
|
||||||
CHECKTYPE REQUIRED
|
CHECKTYPE REQUIRED
|
||||||
END
|
END
|
||||||
|
|
||||||
MEMO 103 54 8
|
BOOELAN 103
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 2 "Condizione "
|
PROMPT 1 2 "Nascosto"
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOELAN 104
|
||||||
|
BEGIN
|
||||||
|
PROMPT 18 2 "Ordina"
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOELAN 105
|
||||||
|
BEGIN
|
||||||
|
PROMPT 35 2 "Raggruppa"
|
||||||
|
END
|
||||||
|
|
||||||
|
MEMO 106 58 8
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 3 "Condizione "
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON DLG_CANCEL 10 2
|
BUTTON DLG_CANCEL 10 2
|
||||||
|
@ -619,13 +619,58 @@ bool TSQL_query::save_as_text(const TFilename& path)
|
|||||||
const int last = arr != NULL ? arr->last() : 0;
|
const int last = arr != NULL ? arr->last() : 0;
|
||||||
for (int c = 0; c <= last; c++)
|
for (int c = 0; c <= last; c++)
|
||||||
{
|
{
|
||||||
|
if (c > 0)
|
||||||
|
out << '\t';
|
||||||
|
TString* val = (TString*)arr->objptr(c);
|
||||||
|
if (val && !val->blank())
|
||||||
|
{
|
||||||
|
val->rtrim();
|
||||||
|
out << *val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out << endl;
|
||||||
|
pi.addstatus(1);
|
||||||
|
if (pi.iscancelled())
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return !pi.iscancelled();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TSQL_query::save_as_campo(const TFilename& path)
|
||||||
|
{
|
||||||
|
TProgind pi(items(), TR("Esportazione in corso..."), true, true);
|
||||||
|
|
||||||
|
ofstream out(path);
|
||||||
|
|
||||||
|
out << "[Head]" << endl;
|
||||||
|
out << "Version=0";
|
||||||
|
|
||||||
|
for (unsigned int c = 0; c < columns(); c++)
|
||||||
|
{
|
||||||
|
const TSQL_column_info& ci = column_info(c);
|
||||||
|
if ((c % 8) == 0)
|
||||||
|
out << endl << "Fields=";
|
||||||
|
else
|
||||||
|
out << '|';
|
||||||
|
out << ci._name;
|
||||||
|
}
|
||||||
|
out << endl << endl << "[Data]" << endl;
|
||||||
|
|
||||||
|
for (TRecnotype n = 0; n < items(); n++)
|
||||||
|
{
|
||||||
|
const TString_array* arr = row(n);
|
||||||
|
const int last = arr != NULL ? arr->last() : 0;
|
||||||
|
for (int c = 0; c <= last; c++)
|
||||||
|
{
|
||||||
|
if (c > 0)
|
||||||
|
out << '|';
|
||||||
TString* val = (TString*)arr->objptr(c);
|
TString* val = (TString*)arr->objptr(c);
|
||||||
if (val && !val->blank())
|
if (val && !val->blank())
|
||||||
{
|
{
|
||||||
val->rtrim();
|
val->rtrim();
|
||||||
out << *val;
|
out << *val;
|
||||||
}
|
}
|
||||||
out << '\t';
|
|
||||||
}
|
}
|
||||||
out << endl;
|
out << endl;
|
||||||
pi.addstatus(1);
|
pi.addstatus(1);
|
||||||
@ -652,9 +697,10 @@ bool TSQL_query::save_as(const char* fn, TQueryExportFormat fmt)
|
|||||||
bool ok = fmt != fmt_unknown;
|
bool ok = fmt != fmt_unknown;
|
||||||
switch (fmt)
|
switch (fmt)
|
||||||
{
|
{
|
||||||
case fmt_html: ok = save_as_html(path); break;
|
case fmt_html : ok = save_as_html(path); break;
|
||||||
case fmt_slk: ok = save_as_silk(path); break;
|
case fmt_slk : ok = save_as_silk(path); break;
|
||||||
case fmt_txt: ok = save_as_text(path); break;
|
case fmt_txt : ok = save_as_text(path); break;
|
||||||
|
case fmt_campo: ok = save_as_campo(path); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
|
@ -16,7 +16,7 @@ struct TSQL_column_info : public TObject
|
|||||||
bool _numeric;
|
bool _numeric;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum TQueryExportFormat { fmt_unknown, fmt_html, fmt_txt, fmt_slk };
|
enum TQueryExportFormat { fmt_unknown, fmt_html, fmt_txt, fmt_slk, fmt_campo };
|
||||||
|
|
||||||
class TSQL_query : public TObject
|
class TSQL_query : public TObject
|
||||||
{
|
{
|
||||||
@ -31,6 +31,7 @@ protected:
|
|||||||
bool save_as_html(const TFilename& path);
|
bool save_as_html(const TFilename& path);
|
||||||
bool save_as_silk(const TFilename& path);
|
bool save_as_silk(const TFilename& path);
|
||||||
bool save_as_text(const TFilename& path);
|
bool save_as_text(const TFilename& path);
|
||||||
|
bool save_as_campo(const TFilename& path);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void set(const char* sql);
|
void set(const char* sql);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user