Patch level : 12.0 no-patch
Files correlati : Commento : Aggiunte get_string(const char* field) get_string_zerofilled get_int get_long get_bool get_real get_date(const char* field) ai recordset zerofill alle stringhe
This commit is contained in:
parent
61f8fe1f76
commit
ba2c68bba4
@ -122,7 +122,11 @@ void fraction::build_fraction (const char *s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
n.strip(",.-+/[]");
|
n.strip(",.-+/[]");
|
||||||
|
#ifdef WIN32
|
||||||
sscanf_s(n, "%I64d", &_num);
|
sscanf_s(n, "%I64d", &_num);
|
||||||
|
#else
|
||||||
|
sscanf_s(n, "%Ld", &_num);
|
||||||
|
#endif
|
||||||
if (len_periodo > 0)
|
if (len_periodo > 0)
|
||||||
{
|
{
|
||||||
_den = 9;
|
_den = 9;
|
||||||
|
@ -549,6 +549,19 @@ const TVariant& TRecordset::get(const char* column_name) const
|
|||||||
return NULL_VARIANT;
|
return NULL_VARIANT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const TString& TRecordset::get_string_zerofilled(const char* field, const int zero_filled) const
|
||||||
|
{
|
||||||
|
if (zero_filled > 0)
|
||||||
|
{
|
||||||
|
TString & str = get_tmp_string(1024);
|
||||||
|
|
||||||
|
str = get_string(field);
|
||||||
|
str.zerofill(zero_filled);
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
return get_string(field);;
|
||||||
|
}
|
||||||
|
|
||||||
const TVariant& TRecordset::get_var(const char* name) const
|
const TVariant& TRecordset::get_var(const char* name) const
|
||||||
{
|
{
|
||||||
const TVariant* var = (const TVariant*)_var.objptr(name);
|
const TVariant* var = (const TVariant*)_var.objptr(name);
|
||||||
|
@ -101,6 +101,14 @@ public: // Absolutely needed methods
|
|||||||
virtual unsigned int columns() const pure;
|
virtual unsigned int columns() const pure;
|
||||||
virtual const TRecordset_column_info& column_info(unsigned int column) const pure;
|
virtual const TRecordset_column_info& column_info(unsigned int column) const pure;
|
||||||
virtual const TRecordset_column_info& add_column_info(const TRecordset_column_info& c) {return c; }
|
virtual const TRecordset_column_info& add_column_info(const TRecordset_column_info& c) {return c; }
|
||||||
|
const TString& get_string(const char* field) const { return get(find_column(field)).as_string(); };
|
||||||
|
const TString& get_string_zerofilled(const char* field, const int zero_filled) const;
|
||||||
|
int get_int(const char* field) const { return get(find_column(field)).as_int(); }
|
||||||
|
long get_long(const char* field) const { return get(find_column(field)).as_int(); }
|
||||||
|
bool get_bool(const char* field) const { return get(find_column(field)).as_bool(); }
|
||||||
|
real get_real(const char* field) const { return get(find_column(field)).as_real(); }
|
||||||
|
TDate get_date(const char* field) const { return get(find_column(field)).as_date(); }
|
||||||
|
|
||||||
virtual const TVariant& get(unsigned int column) const pure;
|
virtual const TVariant& get(unsigned int column) const pure;
|
||||||
|
|
||||||
virtual const TString_array& variables() const { return _varnames; }
|
virtual const TString_array& variables() const { return _varnames; }
|
||||||
|
@ -184,6 +184,8 @@ public:
|
|||||||
// @cmember Aggiunge spazi a destra fino alla dimensione indicata
|
// @cmember Aggiunge spazi a destra fino alla dimensione indicata
|
||||||
TString& rpad(const int n,const char c=' ');
|
TString& rpad(const int n,const char c=' ');
|
||||||
// @cmember Aggiunge spazi a sinistra fino alla dimensione indicata
|
// @cmember Aggiunge spazi a sinistra fino alla dimensione indicata
|
||||||
|
TString & zerofill(const int n) { return lpad(n, '0'); }
|
||||||
|
// @cmember Aggiunge spazi a sinistra fino alla dimensione indicata
|
||||||
TString& lpad(const int n,const char c=' ');
|
TString& lpad(const int n,const char c=' ');
|
||||||
|
|
||||||
// @cmember Giustifica l'oggetto stringa a destra
|
// @cmember Giustifica l'oggetto stringa a destra
|
||||||
|
Loading…
x
Reference in New Issue
Block a user