Patch level : 2.2

Files correlati     : ba8
Ricompilazione Demo : [ ]
Commento            :
Usate classi di supporto ODBC in generatore query e report


git-svn-id: svn://10.65.10.50/trunk@13455 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2005-10-25 16:53:27 +00:00
parent 099c9bc2f2
commit 7fcf9ccfb4
2 changed files with 25 additions and 28 deletions

View File

@ -5,6 +5,7 @@
#include <defmask.h> #include <defmask.h>
#include <extcdecl.h> #include <extcdecl.h>
#include <modaut.h> #include <modaut.h>
#include <odbcrset.h>
#include <prefix.h> #include <prefix.h>
#include <progind.h> #include <progind.h>
#include <recset.h> #include <recset.h>
@ -863,23 +864,22 @@ bool TQuery_mask::ask_vars(const char* maskname, TRecordset& recset) const
TRecordset* TQuery_mask::new_recordset() const TRecordset* TQuery_mask::new_recordset() const
{ {
const TString& sql = get(F_SQL); const TString& sql = get(F_SQL);
TRecordset* rex = NULL; TRecordset* rex = create_recordset(sql);
if (sql.starts_with("SELECT "))
rex = new TSQL_recordset(sql);
else
rex = new TISAM_recordset(sql);
if (!ask_vars(get(F_CODICE), *rex)) if (rex != NULL)
{ {
delete rex; if (!ask_vars(get(F_CODICE), *rex))
rex = NULL; {
} delete rex;
rex = NULL;
}
if (rex != NULL && rex->columns() == 0) if (rex != NULL && rex->items() == 0)
{ {
warning_box(TR("Nessuna riga risultato")); warning_box(TR("Nessuna riga risultato"));
delete rex; delete rex;
rex = NULL; rex = NULL;
}
} }
return rex; return rex;

View File

@ -6,6 +6,7 @@
#include <defmask.h> #include <defmask.h>
#include <execp.h> #include <execp.h>
#include <modaut.h> #include <modaut.h>
#include <odbcrset.h>
#include <prefix.h> #include <prefix.h>
#include <printer.h> #include <printer.h>
#include <reprint.h> #include <reprint.h>
@ -953,23 +954,19 @@ bool TReport_mask::on_field_event(TOperable_field& o, TField_event e, long jolly
case F_SHOW_QRY: case F_SHOW_QRY:
if (e == fe_button) if (e == fe_button)
{ {
TRecordset* rex = NULL;
const TString& sql = get(F_SQL); const TString& sql = get(F_SQL);
if (sql.starts_with("SELECT ")) TRecordset* rex = create_recordset(sql);
rex = new TSQL_recordset(sql); if (rex != NULL)
else
rex = new TISAM_recordset(sql);
if (rex->columns() > 0)
{ {
TRecordset_sheet sht(*rex); if (rex->items() > 0)
sht.run(); {
TRecordset_sheet sht(*rex);
sht.run();
}
else
warning_box(TR("Nessuna riga risultato"));
delete rex;
} }
else
warning_box(TR("Nessuna riga risultato"));
delete rex;
} }
break; break;
case DLG_PRINT: case DLG_PRINT: