Patch level : 10.0 270
Files correlati : ca2.exe ca2500a.msk Ricompilazione Demo : [ ] Commento : Aggiunto programma di invio a Board. Ripristinate funzioni di visualizzazione e salvataggio ripartizione temporale delle righe nella modifica movimenti analitici git-svn-id: svn://10.65.10.50/branches/R_10_00@23201 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									7078caba13
								
							
						
					
					
						commit
						8a7486d866
					
				| @ -192,7 +192,7 @@ static int query_get_items(void* jolly, int argc, char** values, char** columns) | ||||
| 
 | ||||
| TRecnotype TODBC_recordset::items() const | ||||
| { | ||||
|   if (_items == 0) | ||||
|   if (!_loaded && _items == 0) | ||||
|   { | ||||
|     TString sql; parsed_text(sql); | ||||
|     XVT_ODBC oc = connection(); | ||||
| @ -246,7 +246,7 @@ int TODBC_recordset::on_get_rows(int argc, char** values, char** columns) | ||||
|   if (!_columns_loaded) | ||||
|     on_get_columns(argc, values, columns); | ||||
| 
 | ||||
|   if (_page.items() >= _pagesize) | ||||
|   if (!_freezed && _page.items() >= _pagesize) | ||||
|     return -1; | ||||
| 
 | ||||
|   if (_cursor_pos++ < _first_row) | ||||
| @ -291,7 +291,17 @@ static int query_get_rows(void* jolly, int argc, char** values, char** columns) | ||||
| bool TODBC_recordset::move_to(TRecnotype n) | ||||
| { | ||||
|   const TRecnotype tot = items(); | ||||
| 
 | ||||
|   _current_row = n; | ||||
| 	if (_freezed && _loaded) | ||||
| 	{ | ||||
| 	  if (n < 0) | ||||
| 			_current_row = 0L; | ||||
| 		if (n >= tot) | ||||
| 			_current_row = tot - 1L; | ||||
| 		return true; | ||||
| 	} | ||||
| 
 | ||||
|   if (n < 0 || n >= tot) | ||||
|   { | ||||
|     _page.destroy(); // Forza rilettura la prossima volta
 | ||||
| @ -299,7 +309,7 @@ bool TODBC_recordset::move_to(TRecnotype n) | ||||
|     return false; | ||||
|   } | ||||
| 
 | ||||
|   if (n < _first_row || n >= _first_row+_page.items()) | ||||
|   if ((n < _first_row || n >= _first_row+_page.items()) || _freezed && !_loaded) | ||||
|   { | ||||
|     TString sql; parsed_text(sql); | ||||
|     XVT_ODBC oc = connection(); | ||||
| @ -313,6 +323,9 @@ bool TODBC_recordset::move_to(TRecnotype n) | ||||
|         sql.cut(semicolon); | ||||
|       sql.trim(); | ||||
|       _page.destroy(); | ||||
|       if (_freezed) | ||||
|         _first_row = 0; | ||||
| 			else | ||||
| 				if (n >= _pagesize) | ||||
| 					_first_row = n-32; // Prendo qualche riga dalla pagina precedente, per velocizzare il pagina su
 | ||||
| 				else | ||||
| @ -323,6 +336,7 @@ bool TODBC_recordset::move_to(TRecnotype n) | ||||
|     _cursor_pos = 0; | ||||
|     xvt_odbc_execute(oc, sql, query_get_rows, this); | ||||
|      | ||||
|     _loaded = _freezed; | ||||
| 		if (!_columns_loaded) | ||||
|       _columns_loaded = true;  // Brutto posto ma necessario
 | ||||
|   } | ||||
| @ -536,13 +550,11 @@ int TODBC_recordset::create_rec(const TISAM_recordset& dbfset) | ||||
|     } | ||||
|   } | ||||
|   query << ");"; | ||||
| 	// END;";
 | ||||
| 	TODBC_recordset upd(""); | ||||
| 	int err = 0; | ||||
| 
 | ||||
| 	TRecnotype row = current_row(); | ||||
| 	const int err = exec(query); | ||||
| 
 | ||||
| 	move_to(row); | ||||
| //	while (compare_key(dbfset) != 0 && move_next());
 | ||||
| 	if (upd.connect(dsn())) | ||||
| 		err = upd.exec(query); | ||||
| 	return err; | ||||
| } | ||||
| 
 | ||||
| @ -610,11 +622,10 @@ void TODBC_recordset::update_rec(const TISAM_recordset& dbfset) | ||||
|     else | ||||
|       query << curr.get(fname); | ||||
|   } | ||||
| 	TRecnotype row = current_row(); | ||||
| 	const int err = exec(query); | ||||
| 	TODBC_recordset upd(""); | ||||
| 
 | ||||
| 	move_to(row); | ||||
| //	while (compare_key(dbfset) != 0 && move_next());
 | ||||
| 	if (upd.connect(dsn())) | ||||
| 		upd.exec(query); | ||||
| } | ||||
| 
 | ||||
| void TODBC_recordset::remove_rec(const TISAM_recordset& dbfset) | ||||
| @ -659,19 +670,23 @@ void TODBC_recordset::remove_rec(const TISAM_recordset& dbfset) | ||||
|     } | ||||
|   } | ||||
|   query << ';'; | ||||
|   exec(query); | ||||
| 
 | ||||
| 	TODBC_recordset upd(""); | ||||
| 
 | ||||
| 	if (upd.connect(dsn())) | ||||
| 		upd.exec(query); | ||||
| } | ||||
|   | ||||
| void TODBC_recordset::set(const char* sql)  | ||||
| {  | ||||
| 	if (!_freezed || !_loaded || _sql != sql) | ||||
| 		reset();  | ||||
|   _sql = sql; | ||||
|   if (_sql.find("SELECT") >= 0 || _sql.find("select") >= 0) | ||||
|     find_and_reset_vars(); | ||||
| } | ||||
| 
 | ||||
| TODBC_recordset::TODBC_recordset(const char* sql) | ||||
| TODBC_recordset::TODBC_recordset(const char* sql, const bool freezed) : _freezed(freezed), _loaded(false) | ||||
| { | ||||
|   set(sql); | ||||
| } | ||||
|  | ||||
| @ -21,6 +21,8 @@ class TODBC_recordset : public TRecordset | ||||
| 
 | ||||
|   TArray _column; | ||||
|   bool _columns_loaded; | ||||
| 	bool  _freezed; | ||||
| 	bool _loaded; | ||||
| 
 | ||||
| 
 | ||||
| protected: | ||||
| @ -39,6 +41,7 @@ public: | ||||
|   virtual void requery(); | ||||
|   virtual const TString& query_text() const; | ||||
|   virtual const TString& driver_version() const; | ||||
| 	virtual void freeze(const bool on) { _freezed = on; } | ||||
| 
 | ||||
|   virtual const TVariant& get(unsigned int c) const; | ||||
|   virtual const TVariant& get(const char* name) const; | ||||
| @ -65,7 +68,7 @@ public: | ||||
| 		 | ||||
| 	const TString& dsn() const { return _dsn; } | ||||
| 
 | ||||
|   TODBC_recordset(const char* sql); | ||||
|   TODBC_recordset(const char* sql, const bool freezed = false); | ||||
|   virtual ~TODBC_recordset(); | ||||
| }; | ||||
| 
 | ||||
|  | ||||
| @ -87,6 +87,7 @@ public: // Absolutely needed methods | ||||
| 	virtual char text_separator() const { return _text_separator;} | ||||
| 	virtual void set_text_separator(char sep) { _text_separator = sep;} | ||||
| 
 | ||||
| 	virtual void freeze() {} | ||||
| 	virtual bool move_first() { return move_to(0); } | ||||
|   virtual bool move_prev() { return move_to(current_row()-1); } | ||||
|   virtual bool move_next() { return move_to(current_row()+1); } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user