cad98c6314
Files correlati : Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/branches/R_10_00@21603 c028cbd2-c16b-5b4b-a496-9718f37d4682
136 lines
3.3 KiB
C++
Executable File
136 lines
3.3 KiB
C++
Executable File
#ifndef __pl0002LIB_H
|
|
#define __pl0002LIB_H
|
|
|
|
#ifndef __CONFIG_H
|
|
#include <config.h>
|
|
#endif
|
|
|
|
#ifndef __DICTION_H
|
|
#include <diction.h>
|
|
#endif
|
|
|
|
#ifndef __ISAM_H
|
|
#include <isam.h>
|
|
#endif
|
|
|
|
#ifndef __ODBCRECSET_H
|
|
#include <odbcrset.h>
|
|
#endif
|
|
|
|
#ifndef __PROGIND_H
|
|
class TProgind;
|
|
#endif
|
|
|
|
#ifndef __MODAUT_H
|
|
#include <modaut.h>
|
|
#endif
|
|
|
|
#ifndef __REPUTILS_H
|
|
#include <reputils.h>
|
|
#endif
|
|
|
|
#ifndef __CLIFOR_H
|
|
#include "../ve/clifor.h"
|
|
#endif
|
|
|
|
#include "../ve/velib.h"
|
|
|
|
class TCache_th;
|
|
|
|
class TLif_log : public TLog_report
|
|
{
|
|
public:
|
|
TLif_log() : TLog_report("Conversione LIF") {}
|
|
};
|
|
|
|
class TLif_transfer : public TObject
|
|
{
|
|
TString _query_header;
|
|
TLif_log* _log;
|
|
TConfig _config;
|
|
|
|
TRecordset* _recset;
|
|
bool _write_enabled;
|
|
TODBC_recordset* _outset;
|
|
TCache_th* _tab;
|
|
|
|
protected:
|
|
const TString& build_insert_query(const char* table, const char* f, const char* v) const;
|
|
|
|
TRecordset& create_recordset(const char* query);
|
|
long odbc_exec(const char* command);
|
|
|
|
const TString& decode_value(const char* tab, const TString& field_value);
|
|
const TString& decode_field(const char* tab, const char* recset_field);
|
|
|
|
TLif_transfer();
|
|
virtual bool trasferisci() pure;
|
|
void aggiorna_record(TRectype& rec, const TString_array& lista_campi);
|
|
void aggiorna_ini(TConfig& conf, const TString_array& lista_campi);
|
|
|
|
public:
|
|
void init(const char* rh, const char* qh, TLif_log& log);
|
|
const TString& title() const;
|
|
TConfig& config() { return _config; }
|
|
const TString& query_header() const { return _query_header; }
|
|
|
|
void log(const char* msg, int sev = 0) const;
|
|
bool log_error(const char* msg);
|
|
bool log_cancelled();
|
|
const TRecordset& recordset() const;
|
|
TRecordset& recordset();
|
|
|
|
const TString& get_str(const char* campo) const; // Get string from current recordset
|
|
real get_real(const char* campo) const; // Get real from current recordset
|
|
const TString& get_real_str(const char* campo) const; // Get eventually empty string from numeric field
|
|
long get_long(const char* campo) const;
|
|
|
|
bool write_enabled() const { return _write_enabled; }
|
|
|
|
bool test_write(TBaseisamfile& file);
|
|
|
|
virtual ~TLif_transfer();
|
|
};
|
|
|
|
class TLif_iterator
|
|
{
|
|
TLif_transfer* _ht;
|
|
TProgind* _pi;
|
|
TRecnotype _rec;
|
|
|
|
public:
|
|
bool ok() const;
|
|
bool cancelled() const;
|
|
TLif_iterator& operator=(TRecnotype n);
|
|
TLif_iterator& operator++();
|
|
operator int() const { return ok(); }
|
|
|
|
TLif_iterator(TLif_transfer* ht);
|
|
~TLif_iterator();
|
|
};
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// Cache generica per il trasferimento
|
|
///////////////////////////////////////////////////////////
|
|
|
|
class TCache_th : public TCache
|
|
{
|
|
TLif_transfer* _ht;
|
|
|
|
protected:
|
|
void log(const char* msg, int sev) const { _ht->log(msg, sev); }
|
|
bool test_write(TBaseisamfile& file) const { return _ht->test_write(file); }
|
|
const TRecordset& recordset() const { return _ht->recordset(); }
|
|
TConfig& config() const { return _ht->config(); }
|
|
const TString& query_header() const { return _ht->query_header(); }
|
|
|
|
public:
|
|
const TString& get_str(const char* campo) const { return _ht->get_str(campo); }
|
|
const TString& get_real_str(const char* campo) const { return _ht->get_real_str(campo); }
|
|
long get_long(const char* campo) const { return _ht->get_long(campo); }
|
|
virtual const TString& decode(const TToken_string& tokens) pure;
|
|
|
|
TCache_th(TLif_transfer* ht) : _ht(ht) {}
|
|
};
|
|
|
|
#endif |