Patch level : 2.1 nopatch

Files correlati     : ba8
Ricompilazione Demo : [ ]
Commento            :

Corretta gestione attributo Hidden


git-svn-id: svn://10.65.10.50/trunk@11809 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2004-03-05 11:37:01 +00:00
parent c633e5ca52
commit 8e02f3d7cf
3 changed files with 14 additions and 11 deletions

View File

@ -618,16 +618,14 @@ static bool sql_tree_handler(TTree& tree, void* jolly, word flags)
{
TRelation_node* rn = (TRelation_node*)tree.curr_node();
TPointer_array& arr = *(TPointer_array*)jolly;
TString& from = *(TString*)arr.objptr(0);
TToken_string& from = *(TToken_string*)arr.objptr(0);
TString& where = *(TString*)arr.objptr(1);
TString_array& join = rn->join();
TString str;
if (from.find(rn->id()) < 0)
{
if (from.not_empty())
from << ',';
from << rn->id();
from.add(rn->id());
FOR_EACH_ARRAY_ROW(join, i, row)
{
@ -659,6 +657,12 @@ void TQuery_mask::tree2sql(TString& from, TString& where)
}
}
inline bool tok_get_bool(TToken_string& tok, int pos)
{
const char* str = tok.get(pos);
return str && *str > ' ';
}
// Genera una query SQL a partire dallo spreadsheet F_SHEET
void TQuery_mask::sheet2sql()
{
@ -675,19 +679,18 @@ void TQuery_mask::sheet2sql()
FOR_EACH_SHEET_ROW(sheet, i, row)
{
field = row->get(1);
const bool hidden = *row->get(2) > ' ';
if (!field.blank() && !hidden)
if (!field.blank() && !tok_get_bool(*row, 2)) // Campo valido e visibile
{
if (multiple)
{
field.insert(".");
field.insert(row->get(0)); // Table name
}
select.add(field); // Column name only
select.add(field); // Column name only
if (*row->get(3) > ' ')
if (tok_get_bool(*row, 3)) // Sort
orderby.add(field);
if (*row->get(4) > ' ')
if (tok_get_bool(*row, 4)) // Group
groupby.add(field);
}
}

View File

@ -121,7 +121,7 @@ PAGE "Sql" -1 -1 78 23
MEMO F_SQL 78 -3
BEGIN
PROMPT 1 1 "SQL query"
PROMPT 1 0 "SQL query"
END
BUTTON F_EDITQUERY 10 2

View File

@ -43,7 +43,7 @@ public:
unsigned int columns() const;
const TSQL_column_info& column_info(unsigned int c) const;
const TToken_string& sheet_head() const;
const TToken_string& sheet_head() const; // Used by TQuery_sheet
bool save_as(const char* filename, TQueryExportFormat = fmt_unknown);