Patch level : 12.0 1214
Files correlati : fp0.exe Archiviazione cartacei
This commit is contained in:
parent
8e27155893
commit
1e16e6d4f5
@ -45,6 +45,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
void reset();
|
void reset();
|
||||||
bool log(int severity, const char* msg); // severity: 0=normal; 1=warning; 2=error
|
bool log(int severity, const char* msg); // severity: 0=normal; 1=warning; 2=error
|
||||||
|
bool line() { return log(0, ""); }
|
||||||
void set_title(const char* title);
|
void set_title(const char* title);
|
||||||
void kill_duplicates(bool k = true) { _kill_duplicates = k; }
|
void kill_duplicates(bool k = true) { _kill_duplicates = k; }
|
||||||
const TString& title() const { return _title; }
|
const TString& title() const { return _title; }
|
||||||
|
@ -7,32 +7,58 @@
|
|||||||
* Classe per esecuzioni di query temporanee (wrapper semplice per SACommand) *
|
* Classe per esecuzioni di query temporanee (wrapper semplice per SACommand) *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
const bool SSimple_query::sq_set_exec(const char* query, const bool auto_f)
|
||||||
|
{
|
||||||
|
bool ok = false;
|
||||||
|
|
||||||
|
if (sq_is_connect())
|
||||||
|
{
|
||||||
|
ok = _rec.set(query);
|
||||||
|
if (ok)
|
||||||
|
_rec.exec(auto_f);
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
const TDate SSimple_query::sq_get_date(const char * field)
|
const TDate SSimple_query::sq_get_date(const char * field)
|
||||||
{
|
{
|
||||||
TDate date(_rec.get_date(field));
|
TDate date;
|
||||||
if(!date.ok() || date == 19000100)
|
|
||||||
|
if (sq_is_connect())
|
||||||
{
|
{
|
||||||
TString dt_str = _rec.get(field);
|
date = _rec.get_date(field);
|
||||||
if (dt_str.len() > 10)
|
|
||||||
dt_str = dt_str.left(10);
|
if (!date.ok() || date == 19000100)
|
||||||
date = dt_str;
|
{
|
||||||
|
TString dt_str = _rec.get(field);
|
||||||
|
|
||||||
|
if (dt_str.len() > 10)
|
||||||
|
dt_str = dt_str.left(10);
|
||||||
|
date = dt_str;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return date;
|
return date;
|
||||||
}
|
}
|
||||||
|
|
||||||
const real SSimple_query::sq_get_real(const char * field)
|
const real SSimple_query::sq_get_real(const char * field)
|
||||||
{
|
{
|
||||||
const real app(_rec.get(field));
|
real r;
|
||||||
return app;
|
|
||||||
|
if (sq_is_connect())
|
||||||
|
r = _rec.get(field);
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TString & SSimple_query::sq_get(const char* field, const bool rtrim)
|
const TString & SSimple_query::sq_get(const char* field, const bool rtrim)
|
||||||
{
|
{
|
||||||
TString & fld = get_tmp_string(1024);
|
TString & fld = get_tmp_string(1024);
|
||||||
|
|
||||||
fld = _rec.get(field);
|
if (sq_is_connect())
|
||||||
if (rtrim)
|
{
|
||||||
fld.rtrim();
|
fld = _rec.get(field);
|
||||||
|
if (rtrim)
|
||||||
|
fld.rtrim();
|
||||||
|
}
|
||||||
|
|
||||||
return fld;
|
return fld;
|
||||||
}
|
}
|
||||||
@ -51,15 +77,18 @@ const TString & SSimple_query::sq_get(unsigned int column, const bool rtrim)
|
|||||||
{
|
{
|
||||||
TString & val = get_tmp_string(1024);
|
TString & val = get_tmp_string(1024);
|
||||||
|
|
||||||
val << _rec.get(column);
|
if (sq_is_connect())
|
||||||
if (rtrim)
|
{
|
||||||
val.rtrim();
|
val << _rec.get(column);
|
||||||
|
if (rtrim)
|
||||||
|
val.rtrim();
|
||||||
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned SSimple_query::sq_get_num_fields() const
|
unsigned SSimple_query::sq_get_num_fields() const
|
||||||
{
|
{
|
||||||
return _rec.get_num_fields();
|
return sq_is_connect() ? _rec.get_num_fields() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TString & SSimple_query::sq_get_name_field(const unsigned column) const
|
const TString & SSimple_query::sq_get_name_field(const unsigned column) const
|
||||||
|
@ -1,30 +1,3 @@
|
|||||||
/**********************************************************************************
|
|
||||||
* ######\ *
|
|
||||||
* ## __##\ *
|
|
||||||
* ## / \__| ######\ ######\####\ ######\ ######\ *
|
|
||||||
* ## | \____##\ ## _## _##\ ## __##\ ## __##\ *
|
|
||||||
* ## | ####### |## / ## / ## |## / ## |## / ## | *
|
|
||||||
* ## | ##\ ## __## |## | ## | ## |## | ## |## | ## | *
|
|
||||||
* \###### |\####### |## | ## | ## |####### |\###### | *
|
|
||||||
* \______/ \_______|\__| \__| \__|## ____/ \______/ *
|
|
||||||
* ## | *
|
|
||||||
* ## | *
|
|
||||||
* \__| *
|
|
||||||
**********************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************************************************************************
|
|
||||||
* TSDB.H *
|
|
||||||
* Inizio sviluppo: 13.10.2016 *
|
|
||||||
* Autore: Tolla *
|
|
||||||
* Descrizione: *
|
|
||||||
* La seguente libreria ha due scopi: *
|
|
||||||
* - Implementare una serie di funzioni che emulino interamente il funzionamento attuale di campo in Visual FoxPro su MSQL *
|
|
||||||
* - Creare delle nuove API per gestire il database in MSSQL con cui verranno riscritti i programmi *
|
|
||||||
* Librerie esterne utilizzate: *
|
|
||||||
* - SQLAPI++ (Permette la gestione dei più famosi DB attualmente esistenti) *
|
|
||||||
********************************************************************************************************************************/
|
|
||||||
|
|
||||||
#ifndef __TSDB_H
|
#ifndef __TSDB_H
|
||||||
#define __TSDB_H
|
#define __TSDB_H
|
||||||
|
|
||||||
@ -51,12 +24,6 @@
|
|||||||
|
|
||||||
#include "recset.h"
|
#include "recset.h"
|
||||||
|
|
||||||
/********************************************************************************
|
|
||||||
* SSimpleQuery (Sirio Simple Query) *
|
|
||||||
* "Wrapper" di TXvt_recordset, implementa OGNI funzione in modo tale da *
|
|
||||||
* poterlo sostituire brutalmente in qualsiasi momento così da non aver *
|
|
||||||
* problemi come durante il passaggio da ISAM a SQL (spero). che cazzata da riscrivere *
|
|
||||||
********************************************************************************/
|
|
||||||
class SSimple_query
|
class SSimple_query
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
@ -108,44 +75,44 @@ public:
|
|||||||
|
|
||||||
// Configuration
|
// Configuration
|
||||||
/**< Imposta la query ricevuta come (const char *) nel recordset */
|
/**< Imposta la query ricevuta come (const char *) nel recordset */
|
||||||
const bool sq_set(const char* query) { return _rec.set(query); }
|
const bool sq_set(const char* query) { return sq_is_connect() && _rec.set(query); }
|
||||||
/**< Imposta la query ricevuta come (string) nel recordset */
|
/**< Imposta la query ricevuta come (string) nel recordset */
|
||||||
const bool sq_set(const string& query) { return _rec.set(query.c_str()); }
|
const bool sq_set(const string& query) { return sq_is_connect() && _rec.set(query.c_str()); }
|
||||||
/**< Imposta la query ricevuta come (TString) nel recordset */
|
/**< Imposta la query ricevuta come (TString) nel recordset */
|
||||||
const bool sq_set(TString& query) { return _rec.set(static_cast<const char *>(query)); }
|
const bool sq_set(TString& query) { return sq_is_connect() && _rec.set(static_cast<const char *>(query)); }
|
||||||
/**< Esegue la query impostata nel recordset, se viene passato autoF == true esegue anche un comando sqNext() */
|
/**< Esegue la query impostata nel recordset, se viene passato autoF == true esegue anche un comando sqNext() */
|
||||||
const bool sq_exec(bool autoF = true) { return _rec.exec(autoF); }
|
const bool sq_exec(bool autoF = true) { return sq_is_connect() && _rec.exec(autoF); }
|
||||||
/**< Unisce le funzioni sqSet e sqExec, riceve la query come (const char *) */
|
/**< Unisce le funzioni sqSet e sqExec, riceve la query come (const char *) */
|
||||||
const bool sq_set_exec(const char* query, const bool auto_f = true) { _rec.set(query); return _rec.exec(auto_f); }
|
const bool sq_set_exec(const char* query, const bool auto_f = true);
|
||||||
/**< Unisce le funzioni sqSet e sqExec, riceve la query come (string) */
|
/**< Unisce le funzioni sqSet e sqExec, riceve la query come (string) */
|
||||||
const bool sq_set_exec(const string& query, const bool auto_f = true) { _rec.set(query.c_str()); return _rec.exec(auto_f); }
|
const bool sq_set_exec(const string& query, const bool auto_f = true) { _rec.set(query.c_str()); return _rec.exec(auto_f); }
|
||||||
/**< Unisce le funzioni sqSet e sqExec, riceve la query come (TString) */
|
/**< Unisce le funzioni sqSet e sqExec, riceve la query come (TString) */
|
||||||
const bool sq_set_exec(TString& query, const bool auto_f = true) { return sq_set_exec(static_cast<const char*>(query), auto_f); }
|
const bool sq_set_exec(TString& query, const bool auto_f = true) { return sq_set_exec(static_cast<const char*>(query), auto_f); }
|
||||||
/**< Si sposta avanti di un record, in caso di esito negativo valorizza _stringError e _codeError */
|
/**< Si sposta avanti di un record, in caso di esito negativo valorizza _stringError e _codeError */
|
||||||
const bool sq_next() { return _rec.next(); }
|
const bool sq_next() { return sq_is_connect() && _rec.next(); }
|
||||||
/**< Si sposta indietro di un record, in caso di esito negativo valorizza _stringError e _codeError */
|
/**< Si sposta indietro di un record, in caso di esito negativo valorizza _stringError e _codeError */
|
||||||
const bool sq_prev() { return _rec.prev(); }
|
const bool sq_prev() { return sq_is_connect() && _rec.prev(); }
|
||||||
/**< Si sposta al primo record, in caso di esito negativo valorizza _stringError e _codeError */
|
/**< Si sposta al primo record, in caso di esito negativo valorizza _stringError e _codeError */
|
||||||
const bool sq_first() { return _rec.first(); }
|
const bool sq_first() { return sq_is_connect() && _rec.first(); }
|
||||||
/**< Si sposta all'ultimo record, in caso di esito negativo valorizza _stringError e _codeError */
|
/**< Si sposta all'ultimo record, in caso di esito negativo valorizza _stringError e _codeError */
|
||||||
const bool sq_last() { return _rec.last(); }
|
const bool sq_last() { return sq_is_connect() && _rec.last(); }
|
||||||
/**< Si sposta alla posizione n, in caso di esito negativo valorizza _stringError e _codeError */
|
/**< Si sposta alla posizione n, in caso di esito negativo valorizza _stringError e _codeError */
|
||||||
const bool sq_go(const int new_pos) { return _rec.go(new_pos); }
|
const bool sq_go(const int new_pos) { return sq_is_connect() && _rec.go(new_pos); }
|
||||||
/**< Ritorna il numero di righe affette dall'ultima query */
|
/**< Ritorna il numero di righe affette dall'ultima query */
|
||||||
const int sq_rows_affected() const { return _rec.rows_affected(); }
|
const int sq_rows_affected() const { return sq_is_connect() ? _rec.rows_affected() : 0; }
|
||||||
|
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
/**< Ritorna il valore nel campo (field) in formato (int) */
|
/**< Ritorna il valore nel campo (field) in formato (int) */
|
||||||
const int sq_get_int(const char* field) { return _rec.get_int(field); }
|
const int sq_get_int(const char* field) { return sq_is_connect() ? _rec.get_int(field) : 0; }
|
||||||
/**< Ritorna il valore nel campo (field) in formato (short) */
|
/**< Ritorna il valore nel campo (field) in formato (short) */
|
||||||
const short sq_get_short(const char* field) { return _rec.get_short(field); }
|
const short sq_get_short(const char* field) { return sq_is_connect() ? _rec.get_short(field) : 0; }
|
||||||
/**< Ritorna il valore nel campo (field) in formato (long) */
|
/**< Ritorna il valore nel campo (field) in formato (long) */
|
||||||
const long sq_get_long(const char* field) { return _rec.get_long(field); }
|
const long sq_get_long(const char* field) { return sq_is_connect() ? _rec.get_long(field) : 0L; }
|
||||||
/**< Ritorna il valore nel campo (field) in formato (double) */
|
/**< Ritorna il valore nel campo (field) in formato (double) */
|
||||||
const double sq_get_double(const char* field) { return _rec.get_double(field); }
|
const double sq_get_double(const char* field) { return sq_is_connect() ? _rec.get_double(field) : 0.0; }
|
||||||
/**< Ritorna il valore nel campo (field) in formato (bool) */
|
/**< Ritorna il valore nel campo (field) in formato (bool) */
|
||||||
const bool sq_get_bool(const char* field) { return _rec.get_bool(field); }
|
const bool sq_get_bool(const char* field) { return sq_is_connect() && _rec.get_bool(field); }
|
||||||
/**< Ritorna il valore nel campo (field) in formato (TDate) */
|
/**< Ritorna il valore nel campo (field) in formato (TDate) */
|
||||||
const TDate sq_get_date(const char* field);
|
const TDate sq_get_date(const char* field);
|
||||||
/**< Ritorna il valore nel campo (field) in formato (real) */
|
/**< Ritorna il valore nel campo (field) in formato (real) */
|
||||||
@ -161,7 +128,7 @@ public:
|
|||||||
/**< Ritorna il valore della colonna numero (column) passato come (unsigned int) */
|
/**< Ritorna il valore della colonna numero (column) passato come (unsigned int) */
|
||||||
const 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 sq_is_connect() && _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) = */
|
||||||
@ -171,7 +138,7 @@ public:
|
|||||||
/**< Ritorna il tipo del campo numero (column) in formato (TFieldtypes) */
|
/**< Ritorna il tipo del campo numero (column) in formato (TFieldtypes) */
|
||||||
TFieldtypes sq_get_type_field(unsigned column) const;
|
TFieldtypes sq_get_type_field(unsigned column) const;
|
||||||
/**< Ritorna la posizione attuale */
|
/**< Ritorna la posizione attuale */
|
||||||
const long sq_pos() const { return _rec.pos(); }
|
const long sq_pos() const { return sq_is_connect() ? _rec.pos() : 0; }
|
||||||
|
|
||||||
// Error Getters
|
// Error Getters
|
||||||
/**< Ritorno l'ultimo codice errore segnalato in formato /int) */
|
/**< Ritorno l'ultimo codice errore segnalato in formato /int) */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user