Patch level : 2.2

Files correlati     : query e report
Ricompilazione Demo : [ ]
Commento            :
Aggiunto supporto ODBC alle query ed ai report
Aggiunta scelta tramite calendario ai campi data


git-svn-id: svn://10.65.10.50/trunk@13446 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2005-10-24 15:16:13 +00:00
parent e2f7e1c42d
commit 55f8095eaa
4 changed files with 31 additions and 28 deletions

View File

@ -4021,6 +4021,23 @@ bool TDate_field::on_key(KEY key)
} }
else else
{ {
if (key == K_F9 && browse() == NULL)
{
RCT rct; get_rect(rct);
const PNT pos = { rct.top, rct.right };
TDate olddate;
const TString& data = get_window_data();
if (TDate::isdate(data))
olddate = TDate(data);
long ansidate = olddate.date2ansi();
ansidate = xvt_dm_post_choose_date(parent(), pos, ansidate);
const TDate newdate(ansidate);
if (newdate != olddate)
set(newdate.string());
return true;
}
if (_ctl->is_edit_key(key)) if (_ctl->is_edit_key(key))
{ {
const bool ok = strchr("-0123456789ADEGILMNOPRSTUadegilmnoprstu", key) != NULL; const bool ok = strchr("-0123456789ADEGILMNOPRSTUadegilmnoprstu", key) != NULL;

View File

@ -1281,6 +1281,8 @@ TSQLite::~TSQLite()
void TSQL_recordset::reset() void TSQL_recordset::reset()
{ {
_items = 0; _items = 0;
_first_row = 0;
_current_row = -1;
_pagesize = 512; _pagesize = 512;
_page.destroy(); _page.destroy();
_column.destroy(); _column.destroy();
@ -1374,7 +1376,7 @@ const TRecordset_column_info& TSQL_recordset::column_info(unsigned int c) const
} }
// Funzione chiamata per riempire la pagina corrente delle righe della query // Funzione chiamata per riempire la pagina corrente delle righe della query
int TSQL_recordset::on_get_rows(int argc, char** values, char** columns) int TSQL_recordset::on_get_rows(int argc, char** values)
{ {
TArray* a = new TArray; TArray* a = new TArray;
for (int c = 0; c < argc; c++) for (int c = 0; c < argc; c++)
@ -1406,10 +1408,10 @@ int TSQL_recordset::on_get_rows(int argc, char** values, char** columns)
return SQLITE_OK; return SQLITE_OK;
} }
static int query_get_rows(void* jolly, int argc, char** values, char** columns) static int query_get_rows(void* jolly, int argc, char** values, char** /*columns*/)
{ {
TSQL_recordset* rs = (TSQL_recordset*)jolly; TSQL_recordset* rs = (TSQL_recordset*)jolly;
return rs->on_get_rows(argc, values, columns); return rs->on_get_rows(argc, values);
} }
bool TSQL_recordset::move_to(TRecnotype n) bool TSQL_recordset::move_to(TRecnotype n)

View File

@ -48,6 +48,7 @@ public: // Absolutely needed methods
virtual TRecnotype current_row() const pure; virtual TRecnotype current_row() const pure;
virtual void requery() pure; virtual void requery() pure;
bool empty() const { return items() == 0; } bool empty() const { return items() == 0; }
virtual const TString& query_text() const pure;
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); }
@ -65,7 +66,6 @@ public: // Absolutely needed methods
virtual bool set_var(const char* name, const TVariant& var, bool create = false); virtual bool set_var(const char* name, const TVariant& var, bool create = false);
virtual bool ask_variables(bool all); virtual bool ask_variables(bool all);
virtual const TString& query_text() const;
virtual int find_column(const char* column_name) const; virtual int find_column(const char* column_name) const;
virtual const TVariant& get(const char* column_name) const; virtual const TVariant& get(const char* column_name) const;
virtual const TToken_string& sheet_head() const; virtual const TToken_string& sheet_head() const;
@ -107,7 +107,7 @@ public:
// Internal use only // Internal use only
virtual int on_get_items(int argc, char** values, char** columns); virtual int on_get_items(int argc, char** values, char** columns);
virtual int on_get_rows(int argc, char** values, char** columns); virtual int on_get_rows(int argc, char** values);
const TArray* row(TRecnotype n); const TArray* row(TRecnotype n);
TSQL_recordset(const char* sql); TSQL_recordset(const char* sql);
@ -174,6 +174,7 @@ bool list_custom_files(const char* ext, const char* library, TString_array& file
bool select_custom_file(TFilename& path, const char* ext, const char* library = NULL); bool select_custom_file(TFilename& path, const char* ext, const char* library = NULL);
const TString& logic2table(int logic_num); const TString& logic2table(int logic_num);
int table2logic(const TString& name); int table2logic(const TString& name);
TRecordset* create_recordset(const TString& sql);
#endif #endif

View File

@ -815,17 +815,9 @@ bool TReport_section::set_recordset(TRecordset* rs)
bool TReport_section::set_recordset(const TString& sql) bool TReport_section::set_recordset(const TString& sql)
{ {
bool ok = !sql.blank(); TRecordset* rex = create_recordset(sql);
if (ok) set_recordset(rex);
{ return rex != NULL;
if (sql.compare("SELECT ", 7, true) == 0)
ok = set_recordset(new TSQL_recordset(sql));
else
ok = set_recordset(new TISAM_recordset(sql));
}
else
set_recordset(NULL);
return ok;
} }
bool TReport_section::get_record_field(const char* name, TVariant& var) const bool TReport_section::get_record_field(const char* name, TVariant& var) const
@ -1917,20 +1909,11 @@ bool TReport::set_recordset(TRecordset* rs)
return _recordset != NULL; return _recordset != NULL;
} }
bool TReport::set_recordset(const TString& sql) bool TReport::set_recordset(const TString& sql)
{ {
bool ok = !sql.blank(); TRecordset* rex = create_recordset(sql);
if (ok) set_recordset(rex);
{ return rex != NULL;
if (sql.compare("SELECT ", 7, true) == 0)
ok = set_recordset(new TSQL_recordset(sql));
else
ok = set_recordset(new TISAM_recordset(sql));
}
else
set_recordset(NULL);
return ok;
} }
TReport_section& TReport::section(char type, int level) TReport_section& TReport::section(char type, int level)