Migliore gestione connessioni ODBC e mail
git-svn-id: svn://10.65.10.50/branches/R_10_00@23015 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									41dacc91a7
								
							
						
					
					
						commit
						d7b93c2169
					
				| @ -73,8 +73,5 @@ | ||||
| #define CLI_ENTE "ENTE" | ||||
| #define CLI_AUTORIZ "AUTORIZ" | ||||
| 
 | ||||
| #define CLI_PADESTIN "PADESTIN" | ||||
| #define CLI_PARIFAMM "PARIFAMM" | ||||
| 
 | ||||
| #endif | ||||
| 
 | ||||
|  | ||||
| @ -152,17 +152,26 @@ void TConfig_application::do_config(int m) | ||||
|     _parag.cut(2);  | ||||
| 
 | ||||
|   load_config(); | ||||
|   for (;;) | ||||
|   { | ||||
| 
 | ||||
|   TMask* mask = NULL; | ||||
|    | ||||
|   TFilename maskname = get_mask_name(); | ||||
|   maskname.ext("msk"); | ||||
|        | ||||
|     if (maskname.not_empty() && maskname.exist()) | ||||
|   if (maskname.custom_path()) | ||||
|   { | ||||
|       TMask* mask = get_mask(); | ||||
|     mask = get_mask(); | ||||
|     if (mask == NULL || mask != _m)  | ||||
|       mask = create_mask(maskname); | ||||
|   } | ||||
| 
 | ||||
|   if (mask == NULL) | ||||
|   { | ||||
|     cantread_box(maskname); | ||||
|     return; | ||||
|   } | ||||
| 
 | ||||
|   for (;;) | ||||
|   { | ||||
|       // carica campi
 | ||||
|       load_mask(); | ||||
|       // run mask
 | ||||
| @ -184,12 +193,6 @@ void TConfig_application::do_config(int m) | ||||
|       if (k == K_QUIT)  | ||||
|         break; | ||||
|   } | ||||
|     else  | ||||
|     { | ||||
|       warning_box("Nessun parametro da configurare"); | ||||
|       break; | ||||
|     } | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| void TConfig_application::on_firm_change() | ||||
|  | ||||
| @ -12,7 +12,7 @@ bool TConfig::add_line(const TString& l) | ||||
| { | ||||
|   const int ind = l.find('='); | ||||
|   if (ind < 0) | ||||
|     return FALSE; | ||||
|     return false; | ||||
|   | ||||
|   TString256 key = l.left(ind); key.trim(); | ||||
|   TString val = l.mid(ind+1); val.trim(); | ||||
| @ -34,7 +34,7 @@ bool TConfig::add_line(const TString& l) | ||||
|     } | ||||
|   } | ||||
|   // sostituzione abilitata
 | ||||
|   return _data.add(key,val,TRUE); | ||||
|   return _data.add(key,val,true); | ||||
| } | ||||
| 
 | ||||
| // @doc EXTERNAL
 | ||||
| @ -162,7 +162,7 @@ void TConfig::_write_file() | ||||
|   if (fexist(_file)) | ||||
|   { | ||||
|     while (xvt_fsys_access(_file, 02) != 0) | ||||
|       message_box("Il file %s e' gia' in uso", (const char*)_file); | ||||
|       message_box("Il file %s è già in uso", (const char*)_file); | ||||
|   } | ||||
|   fcopy(temp, _file);      // Copia dalla tempdir al nuovo .ini
 | ||||
|   ::remove(temp);          // Cancella file temporaneo
 | ||||
|  | ||||
| @ -98,6 +98,8 @@ | ||||
| #define DOC_CONTRATTO     "CONTRATTO" | ||||
| #define DOC_PAF           "PAF" | ||||
| #define DOC_MANDATO       "MANDATO" | ||||
| #define DOC_COMMPREL      "COMMPREL" | ||||
| #define DOC_FASEPREL      "FASEPREL" | ||||
| 
 | ||||
| // Virtuali
 | ||||
| 
 | ||||
|  | ||||
| @ -1099,7 +1099,21 @@ TMail_message::TMail_message(const char* recipient, const char* subject, | ||||
| { | ||||
|   add_recipient(recipient);   | ||||
|   if (text && *text) | ||||
|   { | ||||
|     const TFixed_string s(text); | ||||
|     if (s.find("=3D") > 0) | ||||
|     { | ||||
|       TString str(text); | ||||
|       for (int pos = str.find("=3D"); pos > 0; pos = str.find("=3D", pos+1)) | ||||
|       { | ||||
|         char *buf = str.get_buffer(); | ||||
|         strcpy_s(buf + pos + 1, str.size()-pos, buf + pos + 3); | ||||
|       } | ||||
|       add(str); | ||||
|     } | ||||
|     else | ||||
|       add(text); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| ///////////////////////////////////////////////////////////
 | ||||
|  | ||||
| @ -3034,7 +3034,7 @@ int TSystemisamfile::dump( | ||||
|                  t == _wordfld || t == _intzerofld || t == _longzerofld); | ||||
|     len[j++] = (t == _datefld) ? 10 : curr().length(fldname); | ||||
| 		if (fixedlen && t == _memofld) | ||||
| 			return error_box(TR("Non e' possibile scaricare a lunghezza fissa un file con campi memo")); | ||||
| 			return error_box(TR("Non č possibile scaricare a lunghezza fissa un file con campi memo")); | ||||
|   } | ||||
|   TRecnotype i = 0; | ||||
|   const TRecnotype nitems = items(); | ||||
|  | ||||
| @ -832,7 +832,7 @@ long TMask::handler(WINDOW w, EVENT* ep) | ||||
|     for (int f = fields()-1; f >= 0; f--) | ||||
|     {             | ||||
|       TMask_field& cur_fld = fld(f); | ||||
|       if (cur_fld.shown() && cur_fld.parent() == w)   | ||||
|       if (cur_fld.shown() && cur_fld.parent() == w && cur_fld.is_operable())   | ||||
|       {                              | ||||
|         RCT rct; cur_fld.get_rect(rct); | ||||
|         if (xvt_rect_has_point(&rct, ep->v.mouse.where)) | ||||
| @ -1911,6 +1911,13 @@ void TMask::autosave(TRelation& r) const | ||||
|     if (save) | ||||
|       ((TLoadable_field*)f)->autosave(r); | ||||
|   } | ||||
| 
 | ||||
|   TRectype& rec = r.curr(); | ||||
|   if (rec.exist("DATAAGG")) | ||||
|   { | ||||
|     rec.put("DATAAGG", TDate(TODAY)); | ||||
|     rec.put("UTENTE", user()); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| void TMask::on_firm_change() | ||||
|  | ||||
| @ -3162,7 +3162,7 @@ const char* TReal_field::reformat(const char* data) const | ||||
|     else | ||||
|     { | ||||
|       const real r(data);            // Gestione standard dei reali  
 | ||||
|       str = r.string(0, decimals()); | ||||
|       str = r.string(0, d); | ||||
|     } | ||||
|     if (_flags.zerofilled) | ||||
|     {   | ||||
|  | ||||
| @ -3337,7 +3337,6 @@ void TSheet_field::mask2row(int n, TToken_string & rec) | ||||
|           if (active() && s.active()) | ||||
|           { | ||||
|             const int col = cid2index(id); | ||||
|    | ||||
|             if (!s.column_disabled(col)) | ||||
|             { | ||||
|               const bool on = f.enabled(); | ||||
| @ -3349,7 +3348,14 @@ void TSheet_field::mask2row(int n, TToken_string & rec) | ||||
|       }   | ||||
| #ifdef DBG  | ||||
|       if (pos < 0 && s.cid2col(id) > 0) | ||||
|       { | ||||
|         static short _last_cid = 0; | ||||
|         if (id != _last_cid) | ||||
|         { | ||||
|           _last_cid = id; | ||||
|           yesnofatal_box("Mask2row: Non e' visibile il campo %d", id); | ||||
|         } | ||||
|       } | ||||
| #endif     | ||||
|     } | ||||
|     else | ||||
|  | ||||
| @ -388,6 +388,12 @@ void TODBC_recordset::parsed_text(TString& sql) const | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| bool TODBC_recordset::set_log_file(const char* fn) | ||||
| { | ||||
|   XVT_ODBC h = connection(); | ||||
|   return xvt_odbc_log_file(h, fn) != 0; | ||||
| } | ||||
| 
 | ||||
| void TODBC_recordset::set(const char* sql)  | ||||
| {  | ||||
|   reset();  | ||||
|  | ||||
| @ -44,6 +44,7 @@ public: | ||||
|   long exec(const char* sql); | ||||
| 
 | ||||
|   bool connect(const char* dsn, const char* usr = "", const char* pwd = "", const char* dir = ""); | ||||
|   bool set_log_file(const char* fn); | ||||
| 
 | ||||
|   const TString& dsn() const { return _dsn; } | ||||
| 
 | ||||
|  | ||||
| @ -188,7 +188,7 @@ bool TPrinter_setup_mask::on_field_event(TOperable_field& o, TField_event e, lon | ||||
|       const int fs = atoi(o.get()); | ||||
|       const int ls = 72 / get_int(MSK_LINES); | ||||
|       if (fs < ls/2 || fs > 4*ls/3) | ||||
|         ok = yesno_box(TR("La dimensione del carattere non e' adeguata all'interlinea\nSi desidera continuare ugualmente?")); | ||||
|         ok = yesno_box(TR("La dimensione del carattere non è adeguata all'interlinea\nSi desidera continuare ugualmente?")); | ||||
|     } | ||||
|     break; | ||||
|   case DLG_SETPRINT: | ||||
|  | ||||
| @ -1752,6 +1752,8 @@ bool TRelation_application::parse_command_line() | ||||
|     if ((ini[0] == '-' || ini[0] == '/') && (ini[1] == 'I' || ini[1] == 'i')) | ||||
|     { | ||||
|       ini.ltrim(2); | ||||
|       if (ini.starts_with("=")) | ||||
|         ini.ltrim(1); | ||||
|       CHECK(!ini.blank(),"Manca l'indicazione della transazione. Il nome va indicato di seguito al -i, senza interporre spaziatura."); | ||||
|       if (ini.find('*')>=0) | ||||
|       { | ||||
| @ -1759,7 +1761,12 @@ bool TRelation_application::parse_command_line() | ||||
|         list_files(ini, _trans_ini); | ||||
|       } | ||||
|       else | ||||
|       { | ||||
|         if (ini.exist()) | ||||
|           _trans_ini.add(ini); | ||||
|         else | ||||
|           cantread_box(ini); | ||||
|       } | ||||
|       break; | ||||
|     } | ||||
|   }  | ||||
|  | ||||
| @ -2940,7 +2940,7 @@ bool TReport_book::add(TReport& rep, bool progind) | ||||
|       for (int a = 0; a < all.items(); a++) | ||||
|       { | ||||
|         TFilename name = all.row(a); | ||||
|         if (name.find('#') >= 0) // Se puo' essere un'espressione
 | ||||
|         if (name.find('(') >= 0 || name.find('#') >= 0) // Se puo' essere un'espressione
 | ||||
|         { | ||||
|           TVariant var; | ||||
|           if (_report->evaluate(name, var, _alfafld)) | ||||
|  | ||||
| @ -325,7 +325,7 @@ public: | ||||
| //       si rimanda a tale classe per ulteriori spiegazioni.
 | ||||
| class TString4 : public TFixed_string | ||||
| { | ||||
|   char _str4[5]; | ||||
|   char _str4[8]; | ||||
| 
 | ||||
| public: | ||||
|   TString4(const char* s = "") : TFixed_string(_str4, 5) { set(s); } | ||||
| @ -349,7 +349,7 @@ public: | ||||
| //       si rimanda a tale classe per ulteriori spiegazioni.
 | ||||
| class TString8 : public TFixed_string | ||||
| { | ||||
|   char _str8[9]; | ||||
|   char _str8[12]; | ||||
| 
 | ||||
| public: | ||||
|   TString8(const char* s = "") : TFixed_string(_str8, 9) { set(s); } | ||||
| @ -372,7 +372,7 @@ class TString16 : public TFixed_string | ||||
|   // @access:(INTERNAL) Private member
 | ||||
| 
 | ||||
|   // @cmember:(INTERNAL) Stringa di 16 caratteri
 | ||||
|   char _str16[17]; | ||||
|   char _str16[20]; | ||||
| 
 | ||||
|   // @access Public Member
 | ||||
| public: | ||||
| @ -403,6 +403,29 @@ public: | ||||
|   //       gli stessi, la differenza e' solo nel numero di caratteri della stringa.
 | ||||
| }; | ||||
| 
 | ||||
| class TString20 : public TFixed_string | ||||
| { | ||||
|   char _str20[24]; | ||||
| 
 | ||||
| protected: | ||||
|   virtual TObject* dup() const { return new TString20(_str20); } | ||||
| 
 | ||||
| public: | ||||
|   TString20(const char* s = "") : TFixed_string(_str20, 21) | ||||
|   { set(s); } | ||||
|   TString20(const TString& s) : TFixed_string(_str20, 21) | ||||
|   { set(s); } | ||||
|   TString20(const TString20& s) : TFixed_string(_str20, 21) | ||||
|   { set(s); } | ||||
|   const TString& operator =(const char* s) | ||||
|   { return set(s); } | ||||
|   const TString& operator =(const TString& s) | ||||
|   { return set((const char*)s); } | ||||
|   const TString& operator =(const TString20& s) | ||||
|   { return set((const char*)s); } | ||||
| }; | ||||
| 
 | ||||
| 
 | ||||
| // @doc EXTERNAL
 | ||||
| 
 | ||||
| // @class TString80 | Definisce le stringhe di 80 caratteri
 | ||||
| @ -415,7 +438,7 @@ public: | ||||
| //       si rimanda a tale classe per ulteriori spiegazioni.
 | ||||
| class TString80 : public TFixed_string | ||||
| { | ||||
|   char _str80[81]; | ||||
|   char _str80[84]; | ||||
| 
 | ||||
| public: | ||||
|   // @cmember Duplica una stringa di 80 caratteri
 | ||||
| @ -441,7 +464,7 @@ public: | ||||
| //       si rimanda a tale classe per ulteriori spiegazioni.
 | ||||
| class TString256 : public TFixed_string | ||||
| { | ||||
|   char _str256[257]; | ||||
|   char _str256[260]; | ||||
| 
 | ||||
| public: | ||||
|   // @cmember Duplica una stringa di 256 caratteri
 | ||||
|  | ||||
| @ -10,25 +10,25 @@ const TString& TVariable_mask::get(short fld_id) const | ||||
| 
 | ||||
| void TVariable_mask::set_handler(short fld_id, CONTROL_HANDLER handler) | ||||
| { | ||||
|   if(present( fld_id )) | ||||
|   if (present(fld_id)) | ||||
|     TMask::set_handler( fld_id, handler ); | ||||
| }                | ||||
| 
 | ||||
| void TVariable_mask::set(short fld_id, const char* str, byte hit) | ||||
| { | ||||
|   if(present( fld_id )) | ||||
|     TMask::set( fld_id, str, hit ); | ||||
|   if (present(fld_id)) | ||||
|     TMask::set(fld_id, str, hit); | ||||
| } | ||||
| 
 | ||||
| void TVariable_mask::show(short fld_id, bool on ) | ||||
| { | ||||
|   if(fld_id < 0 || present( fld_id ) ) | ||||
|   if (fld_id < 0 || present( fld_id ) ) | ||||
|     TMask::show( fld_id, on ); | ||||
| } | ||||
|   | ||||
| void TVariable_mask::reset(short fld_id) | ||||
| { | ||||
|   if(fld_id <= 0 || present( fld_id ) ) | ||||
|   if (fld_id <= 0 || present( fld_id ) ) | ||||
|     TMask::reset( fld_id); | ||||
| } | ||||
|   | ||||
|  | ||||
| @ -294,7 +294,7 @@ const TString & TVariable_rectype::get_str(const char* fieldname) const | ||||
|           {  | ||||
|             if (TRectype::exist(s)) // Campo ex-virtuale ora diventato reale
 | ||||
|             { | ||||
|               CHECKS(TRectype::get(s).empty(), "Campo ex-virtuale pieno ", s); | ||||
|               //CHECKS(TRectype::get(s).empty(), "Campo ex-virtuale pieno ", s);
 | ||||
|               ((TRectype*)this)->TRectype::put(s, val);  | ||||
|             } | ||||
|             else | ||||
|  | ||||
| @ -579,7 +579,8 @@ TXmlItem* TXmlItem::FindFirst(const char* strTag) const | ||||
| 
 | ||||
| TXmlItem* TXmlItem::FindFirstChild(const char* strTag) const | ||||
| { | ||||
| 	for (int i = 0; i < GetChildren(); i++) | ||||
|   const int n = GetChildren(); | ||||
| 	for (int i = 0; i < n; i++) | ||||
|   { | ||||
|     TXmlItem* c = GetChild(i); | ||||
|     if (c->GetTag() == strTag) | ||||
| @ -588,7 +589,6 @@ TXmlItem* TXmlItem::FindFirstChild(const char* strTag) const | ||||
|   return NULL; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| TXmlItem::TXmlItem() | ||||
|         : m_strTag(15), m_strText(NULL), m_Attributes(NULL), m_Children(NULL) | ||||
| { } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user