Correzioni al programma di dump dei cespiti.
Porting a 32 bit del programma di scarico da ODBC. Tradotti in italiano alcuni messaggi di errore. Correzioni al programma di aggiornamento anagrafiche. Cambiata la sequenza di ricerca: prima cerca il driver e poi eventualmente la variabile d'ambiente SPPROOT. git-svn-id: svn://10.65.10.50/trunk@5189 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
e6cbc87af9
commit
edd8638c9a
31
ce/ce0.cpp
31
ce/ce0.cpp
@ -1,3 +1,4 @@
|
||||
#include <windows.h>
|
||||
#include <applicat.h>
|
||||
#include <filetext.h>
|
||||
#include <execp.h>
|
||||
@ -17,10 +18,20 @@ protected:
|
||||
virtual bool create();
|
||||
|
||||
public:
|
||||
bool is_sigla32() const;
|
||||
bool split_address(TString& addr, TString& civ) const;
|
||||
int write(TLocalisamfile& file, bool re);
|
||||
};
|
||||
|
||||
bool TSESA_anagr::is_sigla32() const
|
||||
{
|
||||
char szBuffer[80];
|
||||
GetPrivateProfileString("SIGLAPP",
|
||||
"Driver32",
|
||||
"", szBuffer, sizeof(szBuffer), "odbc.ini");
|
||||
return *szBuffer != '\0';
|
||||
}
|
||||
|
||||
bool TSESA_anagr::split_address(TString& addr, TString& civ) const
|
||||
{
|
||||
bool ok = FALSE;
|
||||
@ -41,7 +52,8 @@ bool TSESA_anagr::split_address(TString& addr, TString& civ) const
|
||||
}
|
||||
}
|
||||
}
|
||||
addr = addr.left(50);
|
||||
addr.ltrim();
|
||||
addr = addr.left(35);
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -56,20 +68,27 @@ int TSESA_anagr::write(TLocalisamfile& file, bool re)
|
||||
bool TSESA_anagr::menu(MENU_TAG mt)
|
||||
{
|
||||
TFilename tmp; tmp.tempdir();
|
||||
|
||||
TString cmdline(80);
|
||||
cmdline << "sesadump ditte " << tmp;
|
||||
cmdline = "dump";
|
||||
if (is_sigla32())
|
||||
cmdline << "32";
|
||||
else
|
||||
cmdline << "16";
|
||||
cmdline << " ditte " << tmp;
|
||||
TExternal_app app(cmdline);
|
||||
int err = app.run();
|
||||
int err = app.run(FALSE,3);
|
||||
if (err != 0)
|
||||
return error_box("Impossibile eseguire SesaDump.exe");
|
||||
return error_box("Impossibile eseguire il programma di scarico anagrafiche");
|
||||
|
||||
TFilename txt = tmp; txt.add("ditte.txt");
|
||||
TFilename ini = tmp; ini.add("ditte.ini");
|
||||
TFile_text file(txt, ini);
|
||||
err = file.open('r');
|
||||
if (err != 0)
|
||||
return error_box("Impossibile aprire il file ditte.txt");
|
||||
{
|
||||
remove(ini); // Lo rimuove in caso lo crei vuoto il TConfig di TFile_text
|
||||
return error_box("Aggiornamento anagrafiche non effettuato");
|
||||
}
|
||||
|
||||
TLocalisamfile ditte(LF_NDITTE);
|
||||
TLocalisamfile anag(LF_ANAG);
|
||||
|
@ -102,8 +102,13 @@ BOOL CColumns::Open(UINT nOpenType /* = snapshot */,
|
||||
if (!Check(nRetCode))
|
||||
{
|
||||
AfxThrowDBException(nRetCode, m_pDatabase, m_hstmt);
|
||||
}
|
||||
// load first record
|
||||
}
|
||||
#ifdef WIN32
|
||||
AllocStatusArrays();
|
||||
AllocAndCacheFieldInfo();
|
||||
AllocRowset();
|
||||
#endif
|
||||
// load first record
|
||||
MoveFirst();
|
||||
}
|
||||
CATCH_ALL(e)
|
||||
|
86
ce/sesa.cpp
86
ce/sesa.cpp
@ -9,11 +9,13 @@
|
||||
static CDatabase _db;
|
||||
static CString _strWorkDir;
|
||||
|
||||
#ifndef WIN32
|
||||
#define S4DLL
|
||||
#include <d4all.h>
|
||||
|
||||
static CODE4 _codebase;
|
||||
static DATA4 *_dbdata;
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// SESA field info
|
||||
@ -27,6 +29,7 @@ class SESA_Field : public CObject
|
||||
CString m_strValue;
|
||||
CTime m_tValue;
|
||||
double m_dValue;
|
||||
float m_fValue;
|
||||
BOOL m_bValue;
|
||||
|
||||
public:
|
||||
@ -36,6 +39,7 @@ public:
|
||||
CString& StrValue() { return m_strValue; }
|
||||
CTime& TimeValue() { return m_tValue; }
|
||||
double& DoubleValue() { return m_dValue; }
|
||||
float& FloatValue() { return m_fValue; }
|
||||
BOOL& BoolValue() { return m_bValue; }
|
||||
|
||||
SESA_Field(LPCSTR strName, int nType);
|
||||
@ -164,11 +168,11 @@ BOOL SESA_Recordset::Open(LPCSTR strTable)
|
||||
|
||||
if (ok)
|
||||
{
|
||||
ok = CRecordset::Open(CRecordset::snapshot, strTable, CRecordset::readOnly);
|
||||
ok = CRecordset::Open(CRecordset::forwardOnly, strTable, CRecordset::readOnly);
|
||||
if (!ok)
|
||||
{
|
||||
CString msg;
|
||||
msg = "Can't open table ";
|
||||
msg = "Impossibile aprire la tabella ";
|
||||
msg += strTable;
|
||||
AfxMessageBox(msg, MB_OK | MB_ICONEXCLAMATION);
|
||||
}
|
||||
@ -195,7 +199,12 @@ void SESA_Recordset::DoFieldExchange(CFieldExchange* pFX)
|
||||
RFX_Bool(pFX, fld.Name(), b);
|
||||
if (bLoad)
|
||||
{
|
||||
if (b == FALSE || IsFieldFlagNull(nField, CFieldExchange::outputColumn))
|
||||
if (b == FALSE ||
|
||||
#ifdef WIN32
|
||||
IsFieldNull(&b))
|
||||
#else
|
||||
IsFieldFlagNull(nField, CFieldExchange::outputColumn))
|
||||
#endif
|
||||
val.Empty();
|
||||
else
|
||||
val = "X";
|
||||
@ -224,13 +233,43 @@ void SESA_Recordset::DoFieldExchange(CFieldExchange* pFX)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SQL_REAL:
|
||||
{
|
||||
float& d = fld.FloatValue();
|
||||
RFX_Single(pFX, fld.Name(), d);
|
||||
if (bLoad)
|
||||
{
|
||||
if (d == 0.0 ||
|
||||
#ifdef WIN32
|
||||
IsFieldNull(&d))
|
||||
#else
|
||||
IsFieldFlagNull(nField, CFieldExchange::outputColumn))
|
||||
#endif
|
||||
{
|
||||
val.Empty();
|
||||
}
|
||||
else
|
||||
{
|
||||
char* buf = val.GetBuffer(32);
|
||||
sprintf(buf, "%.12g", d);
|
||||
val.ReleaseBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SQL_FLOAT:
|
||||
case SQL_DOUBLE:
|
||||
{
|
||||
double& d = fld.DoubleValue();
|
||||
RFX_Double(pFX, fld.Name(), d);
|
||||
if (bLoad)
|
||||
{
|
||||
if (d == 0.0 || IsFieldFlagNull(nField, CFieldExchange::outputColumn))
|
||||
if (d == 0.0 ||
|
||||
#ifdef WIN32
|
||||
IsFieldNull(&d))
|
||||
#else
|
||||
IsFieldFlagNull(nField, CFieldExchange::outputColumn))
|
||||
#endif
|
||||
{
|
||||
val.Empty();
|
||||
}
|
||||
@ -349,13 +388,15 @@ BOOL SESA_OpenDatabase(const char* lpszDSN, const char* lpszConnect)
|
||||
if (lpszDSN == NULL || *lpszDSN == '\0')
|
||||
lpszDSN = "SIGLAPP";
|
||||
if (lpszConnect == NULL || *lpszConnect == '\0')
|
||||
lpszConnect = "ODBC;";
|
||||
lpszConnect = "ODBC;"; //UID=sa;PWD=";
|
||||
|
||||
BOOL ok;
|
||||
TRY
|
||||
{
|
||||
// DataSrc Excl ReadOnly ConnectString
|
||||
ok = _db.Open(lpszDSN, FALSE, TRUE, lpszConnect);
|
||||
if (ok)
|
||||
_db.m_bStripTrailingSpaces = TRUE;
|
||||
}
|
||||
CATCH_ALL(e)
|
||||
{
|
||||
@ -366,9 +407,9 @@ BOOL SESA_OpenDatabase(const char* lpszDSN, const char* lpszConnect)
|
||||
if (!ok)
|
||||
{
|
||||
CString msg;
|
||||
msg = "Can't connect to database ";
|
||||
msg = "Impossibile connetersi al database ";
|
||||
msg += lpszDSN;
|
||||
msg += " using ";
|
||||
msg += " usando ";
|
||||
msg += lpszConnect;
|
||||
AfxMessageBox(msg, MB_OK | MB_ICONEXCLAMATION);
|
||||
}
|
||||
@ -426,7 +467,7 @@ BOOL SESA_DumpTableODBC(const char* lpszTableName)
|
||||
else
|
||||
{
|
||||
CString msg;
|
||||
msg = "Can't open table ";
|
||||
msg = "Impossibile aprire la tabella ";
|
||||
msg += lpszTableName;
|
||||
AfxMessageBox(msg, MB_OK | MB_ICONEXCLAMATION);
|
||||
}
|
||||
@ -439,7 +480,8 @@ BOOL SESA_DumpTableODBC(const char* lpszTableName)
|
||||
|
||||
BOOL SESA_DumpTableCODEBASE(const char* SIGLAPP, const char* lpszTableName)
|
||||
{
|
||||
BOOL ok;
|
||||
BOOL ok = TRUE;
|
||||
#ifndef WIN32
|
||||
CString filename;
|
||||
CString msg;
|
||||
|
||||
@ -512,7 +554,7 @@ BOOL SESA_DumpTableCODEBASE(const char* SIGLAPP, const char* lpszTableName)
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = "Can't get file header.";
|
||||
msg = "Impossibile reperire informazioni sulla testata del file";
|
||||
AfxMessageBox(msg, MB_OK | MB_ICONEXCLAMATION);
|
||||
ok = FALSE;
|
||||
}
|
||||
@ -561,7 +603,7 @@ BOOL SESA_DumpTableCODEBASE(const char* SIGLAPP, const char* lpszTableName)
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = "Can't get field ";
|
||||
msg = "Impossibile reperire il campo ";
|
||||
msg += fld_val;
|
||||
AfxMessageBox(msg, MB_OK | MB_ICONEXCLAMATION);
|
||||
ok = FALSE;
|
||||
@ -577,7 +619,7 @@ BOOL SESA_DumpTableCODEBASE(const char* SIGLAPP, const char* lpszTableName)
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = "Can't open file ";
|
||||
msg = "Impossibile aprire il file ";
|
||||
msg += filename;
|
||||
AfxMessageBox(msg, MB_OK | MB_ICONEXCLAMATION);
|
||||
ok = FALSE;
|
||||
@ -585,15 +627,31 @@ BOOL SESA_DumpTableCODEBASE(const char* SIGLAPP, const char* lpszTableName)
|
||||
|
||||
d4init_undo(&_codebase);
|
||||
|
||||
#endif
|
||||
return ok;
|
||||
}
|
||||
|
||||
BOOL SESA_DumpTable(const char* lpszTableName)
|
||||
{
|
||||
if (!SESA_DumpTableODBC(lpszTableName))
|
||||
char szBuffer[80];
|
||||
::GetPrivateProfileString("SIGLAPP",
|
||||
#ifndef WIN32
|
||||
"Driver",
|
||||
#else
|
||||
"Driver32",
|
||||
#endif
|
||||
"", szBuffer, sizeof(szBuffer), "odbc.ini");
|
||||
|
||||
if (*szBuffer == '\0' || !SESA_DumpTableODBC(lpszTableName))
|
||||
{
|
||||
const char *SIGLAPP = getenv("SPPROOT");
|
||||
return SIGLAPP ? SESA_DumpTableCODEBASE(SIGLAPP, lpszTableName) : FALSE;
|
||||
if (SIGLAPP)
|
||||
return SESA_DumpTableCODEBASE(SIGLAPP, lpszTableName);
|
||||
else
|
||||
{
|
||||
AfxMessageBox("Impossibile trovare la variabile d'ambiente SPPROOT", MB_OK | MB_ICONEXCLAMATION);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -17,10 +17,10 @@ static char BASED_CODE THIS_FILE[] = __FILE__;
|
||||
IMPLEMENT_DYNCREATE(CSesadumpDoc, CDocument)
|
||||
|
||||
BEGIN_MESSAGE_MAP(CSesadumpDoc, CDocument)
|
||||
//{{AFX_MSG_MAP(CSesadumpDoc)
|
||||
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code!
|
||||
//}}AFX_MSG_MAP
|
||||
//{{AFX_MSG_MAP(CSesadumpDoc)
|
||||
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code!
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -28,7 +28,7 @@ END_MESSAGE_MAP()
|
||||
|
||||
CSesadumpDoc::CSesadumpDoc()
|
||||
{
|
||||
// TODO: add one-time construction code here
|
||||
// TODO: add one-time construction code here
|
||||
}
|
||||
|
||||
CSesadumpDoc::~CSesadumpDoc()
|
||||
@ -37,13 +37,13 @@ CSesadumpDoc::~CSesadumpDoc()
|
||||
|
||||
BOOL CSesadumpDoc::OnNewDocument()
|
||||
{
|
||||
if (!CDocument::OnNewDocument())
|
||||
return FALSE;
|
||||
if (!CDocument::OnNewDocument())
|
||||
return FALSE;
|
||||
|
||||
// TODO: add reinitialization code here
|
||||
// (SDI documents will reuse this document)
|
||||
// TODO: add reinitialization code here
|
||||
// (SDI documents will reuse this document)
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -51,14 +51,14 @@ BOOL CSesadumpDoc::OnNewDocument()
|
||||
|
||||
void CSesadumpDoc::Serialize(CArchive& ar)
|
||||
{
|
||||
if (ar.IsStoring())
|
||||
{
|
||||
// TODO: add storing code here
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: add loading code here
|
||||
}
|
||||
if (ar.IsStoring())
|
||||
{
|
||||
// TODO: add storing code here
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: add loading code here
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -67,12 +67,12 @@ void CSesadumpDoc::Serialize(CArchive& ar)
|
||||
#ifdef _DEBUG
|
||||
void CSesadumpDoc::AssertValid() const
|
||||
{
|
||||
CDocument::AssertValid();
|
||||
CDocument::AssertValid();
|
||||
}
|
||||
|
||||
void CSesadumpDoc::Dump(CDumpContext& dc) const
|
||||
{
|
||||
CDocument::Dump(dc);
|
||||
// CDocument::Dump(dc);
|
||||
}
|
||||
#endif //_DEBUG
|
||||
|
||||
|
@ -65,6 +65,8 @@ BOOL CSesadumpApp::InitInstance()
|
||||
RUNTIME_CLASS(CMainFrame), // main SDI frame window
|
||||
RUNTIME_CLASS(CSesadumpView));
|
||||
AddDocTemplate(pDocTemplate);
|
||||
|
||||
OnFileNew();
|
||||
|
||||
if (m_lpCmdLine[0] != '\0')
|
||||
{
|
||||
|
@ -55,7 +55,7 @@ IDR_MAINFRAME ICON DISCARDABLE "SESADUMP.ICO"
|
||||
|
||||
IDR_MAINFRAME MENU PRELOAD DISCARDABLE
|
||||
BEGIN
|
||||
POPUP "&File"
|
||||
POPUP ""
|
||||
BEGIN
|
||||
MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN
|
||||
MENUITEM "&About Sesadump...", ID_APP_ABOUT
|
||||
@ -137,12 +137,12 @@ END
|
||||
|
||||
STRINGTABLE PRELOAD DISCARDABLE
|
||||
BEGIN
|
||||
IDR_MAINFRAME "Sesadump Windows Application\nSesadu\nSesadu Document\n\n\nSesadu.Document\nSesadu Document"
|
||||
IDR_MAINFRAME "Sesadump\nPRASSI\nSesadu Document\n\n\nSesadu.Document\nSesadu Document"
|
||||
END
|
||||
|
||||
STRINGTABLE PRELOAD DISCARDABLE
|
||||
BEGIN
|
||||
AFX_IDS_APP_TITLE "Sesadump Windows Application"
|
||||
AFX_IDS_APP_TITLE "Sesadump"
|
||||
AFX_IDS_IDLEMESSAGE "Ready"
|
||||
END
|
||||
|
||||
@ -225,7 +225,7 @@ END
|
||||
//
|
||||
#include "sesadump.rc2" // non-App Studio edited resources
|
||||
|
||||
#include "afxres.rc" // Standard components
|
||||
#include "afxres.rc" // Standard components
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
Loading…
x
Reference in New Issue
Block a user