Patch level : 12.0 nopatch
Files correlati : Commento:
This commit is contained in:
parent
f655fd3b10
commit
176f259322
@ -108,6 +108,8 @@ bool TTable_application::user_create()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
_tabname = argv(2);
|
_tabname = argv(2);
|
||||||
|
if (_tabname == "ĘU")
|
||||||
|
_tabname = "%CAU";
|
||||||
_tabname.upper();
|
_tabname.upper();
|
||||||
_rel = new TRelation(_tabname);
|
_rel = new TRelation(_tabname);
|
||||||
|
|
||||||
|
@ -26,28 +26,35 @@ const real SSimple_query::sq_get_real(const char * field)
|
|||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
TString SSimple_query::sq_get(const char* field, bool rtrim)
|
const TString & SSimple_query::sq_get(const char* field, const bool rtrim)
|
||||||
{
|
{
|
||||||
TString fld = _rec.get(field);
|
TString & fld = get_tmp_string(1024);
|
||||||
|
|
||||||
|
fld = _rec.get(field);
|
||||||
if (rtrim)
|
if (rtrim)
|
||||||
fld.rtrim();
|
fld.rtrim();
|
||||||
|
|
||||||
return fld;
|
return fld;
|
||||||
}
|
}
|
||||||
|
|
||||||
TString SSimple_query::sq_get(const string& field, const bool rtrim)
|
const TString & SSimple_query::sq_get(const string& field, const bool rtrim)
|
||||||
{
|
{
|
||||||
return sq_get(field.c_str(), rtrim);
|
return sq_get(field.c_str(), rtrim);
|
||||||
}
|
}
|
||||||
|
|
||||||
TString SSimple_query::sq_get(TString& field, bool rtrim)
|
const TString & SSimple_query::sq_get(TString& field, const bool rtrim)
|
||||||
{
|
{
|
||||||
return sq_get(static_cast<const char*>(field), rtrim);
|
return sq_get((const char *)field, rtrim);
|
||||||
}
|
}
|
||||||
|
|
||||||
TString SSimple_query::sq_get(unsigned int column, bool rtrim)
|
const TString & SSimple_query::sq_get(unsigned int column, const bool rtrim)
|
||||||
{
|
{
|
||||||
return _rec.get(column);
|
TString & val = get_tmp_string(1024);
|
||||||
|
|
||||||
|
val << _rec.get(column);
|
||||||
|
if (rtrim)
|
||||||
|
val.rtrim();
|
||||||
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned SSimple_query::sq_get_num_fields() const
|
unsigned SSimple_query::sq_get_num_fields() const
|
||||||
@ -55,9 +62,12 @@ unsigned SSimple_query::sq_get_num_fields() const
|
|||||||
return _rec.get_num_fields();
|
return _rec.get_num_fields();
|
||||||
}
|
}
|
||||||
|
|
||||||
TString SSimple_query::sq_get_name_field(const unsigned column) const
|
const TString & SSimple_query::sq_get_name_field(const unsigned column) const
|
||||||
{
|
{
|
||||||
return _rec.get_name_field(column);
|
TString & name = get_tmp_string();
|
||||||
|
|
||||||
|
name = _rec.get_name_field(column);
|
||||||
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SSimple_query::sq_get_width_field(const unsigned column) const
|
int SSimple_query::sq_get_width_field(const unsigned column) const
|
||||||
@ -75,6 +85,8 @@ TFieldtypes SSimple_query::sq_get_type_field(const unsigned column) const
|
|||||||
return _boolfld;
|
return _boolfld;
|
||||||
if (type == "dtShort")
|
if (type == "dtShort")
|
||||||
return _intfld;
|
return _intfld;
|
||||||
|
if (type == "dtLong")
|
||||||
|
return _longfld;
|
||||||
if (type == "dtULong")
|
if (type == "dtULong")
|
||||||
return _longfld;
|
return _longfld;
|
||||||
if (type == "dtDouble")
|
if (type == "dtDouble")
|
||||||
|
@ -40,29 +40,22 @@
|
|||||||
|
|
||||||
#ifndef __STRINGS_H
|
#ifndef __STRINGS_H
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#endif // !__STRINGS_H
|
#endif //
|
||||||
|
|
||||||
#ifndef __DATE_H
|
#ifndef __DATE_H
|
||||||
#include <date.h>
|
#include <date.h>
|
||||||
#endif // !__DATE_H
|
#endif //
|
||||||
|
|
||||||
#ifndef __REAL_H
|
#ifndef __REAL_H
|
||||||
#include <real.h>
|
#include <real.h>
|
||||||
#endif // !__REAL_H
|
#endif //
|
||||||
|
|
||||||
#define CHIAVE_ID_ "_ID_"
|
|
||||||
#include "recset.h"
|
#include "recset.h"
|
||||||
|
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* SSimpleQuery (Sirio Simple Query) *
|
* SSimpleQuery (Sirio Simple Query) *
|
||||||
* "Wrapper" di TXvt_recordset, implementa OGNI funzione in modo tale da *
|
* "Wrapper" di TXvt_recordset, implementa OGNI funzione in modo tale da *
|
||||||
* poterlo sostituire brutalmente in qualsiasi momento così da non aver *
|
* poterlo sostituire brutalmente in qualsiasi momento così da non aver *
|
||||||
* problemi come durante il passaggio da ISAM a SQL (spero). *
|
* problemi come durante il passaggio da ISAM a SQL (spero). che cazzata da riscrivere *
|
||||||
* Se ti stai domandando perchè non è stata usata l'ereditarietà (magari con *
|
|
||||||
* un bel ": private TXvt_recordset" così da bloccare il tutto) è per bloccare *
|
|
||||||
* qualsiasi riferimento a questa classe in eventuali reimplementazioni future. *
|
|
||||||
* Preferisco scrivere un po' di codice ridondante adesso che andare a fare *
|
|
||||||
* salti mortali dopo *
|
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
class SSimple_query
|
class SSimple_query
|
||||||
{
|
{
|
||||||
@ -160,19 +153,19 @@ public:
|
|||||||
/**< Ritorna il valore nel campo (field) in formato (SADateTime), Campo non gestisce le ore */
|
/**< Ritorna il valore nel campo (field) in formato (SADateTime), Campo non gestisce le ore */
|
||||||
//SADateTime sqGetDateTime(const char* field) { get_short(field); }
|
//SADateTime sqGetDateTime(const char* field) { get_short(field); }
|
||||||
/**< Ritorna il valore nel campo (field) passato come (const char *) in formato (const char *) */
|
/**< Ritorna il valore nel campo (field) passato come (const char *) in formato (const char *) */
|
||||||
TString sq_get(const char* field, bool rtrim = true);
|
const TString & sq_get(const char* field, bool rtrim = true);
|
||||||
/**< Ritorna il valore nel campo (field) passato come (string) in formato (const char *) */
|
/**< Ritorna il valore nel campo (field) passato come (string) in formato (const char *) */
|
||||||
TString sq_get(const string& field, bool rtrim = true);
|
const TString & sq_get(const string& field, bool rtrim = true);
|
||||||
/**< Ritorna il valore nel campo (field) passato come (TString) in formato (const char *) */
|
/**< Ritorna il valore nel campo (field) passato come (TString) in formato (const char *) */
|
||||||
TString sq_get(TString& field, bool rtrim = true);
|
const TString & sq_get(TString& field, bool rtrim = true);
|
||||||
/**< Ritorna il valore della colonna numero (column) passato come (unsigned int) */
|
/**< Ritorna il valore della colonna numero (column) passato come (unsigned int) */
|
||||||
TString sq_get(unsigned int column, bool rtrim = true);
|
const TString & sq_get(unsigned int column, bool rtrim = true);
|
||||||
/**< Ritorna il valore nel campo (field) in formato (char) */
|
/**< Ritorna il valore nel campo (field) in formato (char) */
|
||||||
const char sq_get_char(const char* field) { return _rec.get_char(field); }
|
const char sq_get_char(const char* field) { return _rec.get_char(field); }
|
||||||
/**< Ritorna il numero di campi dopo l'ultimo comando di esecuzione effettuato; se il risultato esiste */
|
/**< Ritorna il numero di campi dopo l'ultimo comando di esecuzione effettuato; se il risultato esiste */
|
||||||
unsigned int sq_get_num_fields() const;
|
unsigned int sq_get_num_fields() const;
|
||||||
/**< Ritorna il nome del campo numero (column) in formato (TString= */
|
/**< Ritorna il nome del campo numero (column) in formato (TString) = */
|
||||||
TString sq_get_name_field(unsigned column) const;
|
const TString & sq_get_name_field(unsigned column) const;
|
||||||
/**< Ritorna la grandezza del campo numero (column) */
|
/**< Ritorna la grandezza del campo numero (column) */
|
||||||
int sq_get_width_field(unsigned column) const;
|
int sq_get_width_field(unsigned column) const;
|
||||||
/**< Ritorna il tipo del campo numero (column) in formato (TFieldtypes) */
|
/**< Ritorna il tipo del campo numero (column) in formato (TFieldtypes) */
|
||||||
@ -198,12 +191,12 @@ public:
|
|||||||
void defrost() { _rec.defrost(); }
|
void defrost() { _rec.defrost(); }
|
||||||
|
|
||||||
/**< Costruttore, non inizializza nulla, da caricare successivamente */
|
/**< Costruttore, non inizializza nulla, da caricare successivamente */
|
||||||
SSimple_query() = default;
|
SSimple_query() {};
|
||||||
/**< Costruttore, Accetta in ingresso dei parametri per la connessione, volendo è anche possibile impostare una query ed eseguirla. Attenzione! Non risponde se la query ha avuto un esito positivo o negativo! */
|
/**< Costruttore, Accetta in ingresso dei parametri per la connessione, volendo è anche possibile impostare una query ed eseguirla. Attenzione! Non risponde se la query ha avuto un esito positivo o negativo! */
|
||||||
SSimple_query(const char* db, const char* user, const char* pass, const TT_driver tipo_db, const char * query = "", const bool ex = false, const bool freezed = false) : _rec(db, user, pass, tipo_db, query, ex, freezed) {}
|
SSimple_query(const char* db, const char* user, const char* pass, const TT_driver tipo_db, const char * query = "", const bool ex = false, const bool freezed = false) : _rec(db, user, pass, tipo_db, query, ex, freezed) {}
|
||||||
//SSimpleQuery(const TString& db, const TString& user, const TString& pass, TT_driver tipoDb, const char * query = "", const bool ex = false, const bool freezed = false) : _rec(db, user, pass, tipoDb, query, ex, freezed) {}
|
//SSimpleQuery(const TString& db, const TString& user, const TString& pass, TT_driver tipoDb, const char * query = "", const bool ex = false, const bool freezed = false) : _rec(db, user, pass, tipoDb, query, ex, freezed) {}
|
||||||
/**< Distruttore */
|
/**< Distruttore */
|
||||||
virtual ~SSimple_query() = default;
|
virtual ~SSimple_query() {};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
x
Reference in New Issue
Block a user