Work continues...
This commit is contained in:
parent
a5454cb537
commit
c32475c8ac
@ -52,12 +52,12 @@ bool ZRCola::DBSource::Open(const wxString& filename)
|
||||
// Database open and ready.
|
||||
return true;
|
||||
} else {
|
||||
wxLogMessage(_("Could not open database %s (%x)."), filename.c_str(), hr);
|
||||
wxLogMessage(wxT("Could not open database %s (0x%x)."), filename.c_str(), hr);
|
||||
LogErrors();
|
||||
}
|
||||
m_db.Release();
|
||||
} else
|
||||
wxLogMessage(_("Creating ADOConnection object failed (%x)."), hr);
|
||||
wxLogMessage(wxT("Creating ADOConnection object failed (0x%x)."), hr);
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -72,7 +72,7 @@ void ZRCola::DBSource::LogErrors() const
|
||||
if (SUCCEEDED(m_db->get_Errors(&errors))) {
|
||||
// Get number of errors.
|
||||
long n = 0;
|
||||
errors->get_Count(&n);
|
||||
wxVERIFY(SUCCEEDED(errors->get_Count(&n)));
|
||||
|
||||
// Iterate the errors.
|
||||
for (long i = 0; i < n; i++) {
|
||||
@ -80,12 +80,12 @@ void ZRCola::DBSource::LogErrors() const
|
||||
if (SUCCEEDED(errors->get_Item(ATL::CComVariant(i), &err))) {
|
||||
// Write error number and description to the log.
|
||||
long num = 0;
|
||||
err->get_Number(&num);
|
||||
wxVERIFY(SUCCEEDED(err->get_Number(&num)));
|
||||
|
||||
ATL::CComBSTR desc;
|
||||
err->get_Description(&desc);
|
||||
wxVERIFY(SUCCEEDED(err->get_Description(&desc)));
|
||||
|
||||
wxLogMessage(_("ADO Error 0x%x: %ls"), num, (BSTR)desc);
|
||||
wxLogMessage(wxT("ADO Error 0x%x: %ls"), num, (BSTR)desc);
|
||||
|
||||
err->Release();
|
||||
}
|
||||
@ -94,3 +94,19 @@ void ZRCola::DBSource::LogErrors() const
|
||||
errors->Release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool ZRCola::DBSource::SelectCompositions(ATL::CComPtr<ADORecordset> &rs) const
|
||||
{
|
||||
// Create a new recordset.
|
||||
if (rs) rs.Release();
|
||||
wxCHECK(SUCCEEDED(::CoCreateInstance(CLSID_CADORecordset, NULL, CLSCTX_ALL, IID_IADORecordset, (LPVOID*)&rs)), false);
|
||||
|
||||
// Open it.
|
||||
if (FAILED(rs->Open(ATL::CComVariant(L"SELECT [komb], [znak] FROM [VRS_ReplChar] WHERE [rang_komb]=1 ORDER BY [komb] ASC"), ATL::CComVariant(m_db), adOpenForwardOnly, adLockReadOnly, adCmdText))) {
|
||||
LogErrors();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -51,6 +51,17 @@ namespace ZRCola {
|
||||
///
|
||||
void LogErrors() const;
|
||||
|
||||
///
|
||||
/// Returns ordered decomposed to composed character translations
|
||||
///
|
||||
/// \param[out] rs Recordset with results
|
||||
///
|
||||
/// \returns
|
||||
/// - true when query succeeds
|
||||
/// - false otherwise
|
||||
///
|
||||
bool SelectCompositions(ATL::CComPtr<ADORecordset> &rs) const;
|
||||
|
||||
protected:
|
||||
ATL::CComPtr<ADOConnection> m_db; ///< the database
|
||||
};
|
||||
|
@ -1,8 +1,8 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: ZRColaCompile\n"
|
||||
"POT-Creation-Date: 2016-02-25 15:12+0100\n"
|
||||
"PO-Revision-Date: 2016-02-25 15:13+0100\n"
|
||||
"POT-Creation-Date: 2016-02-26 14:22+0100\n"
|
||||
"PO-Revision-Date: 2016-02-26 14:23+0100\n"
|
||||
"Last-Translator: Simon Rozman <simon.rozman@amebis.si>\n"
|
||||
"Language-Team: Amebis, d. o. o., Kamnik <info@amebis.si>\n"
|
||||
"Language: sl_SI\n"
|
||||
@ -17,21 +17,53 @@ msgstr ""
|
||||
"X-Poedit-KeywordsList: _\n"
|
||||
"X-Poedit-SearchPath-0: .\n"
|
||||
|
||||
#: main.cpp:44
|
||||
#: main.cpp:51
|
||||
msgid "Show this help message"
|
||||
msgstr "Pokaži to sporočilo pomoči"
|
||||
|
||||
#: main.cpp:45
|
||||
#: main.cpp:52
|
||||
msgid "input file"
|
||||
msgstr "vhodna datoteka"
|
||||
|
||||
#: main.cpp:46
|
||||
#: main.cpp:53
|
||||
msgid "output file"
|
||||
msgstr "izhodna datoteka"
|
||||
|
||||
#: main.cpp:61
|
||||
msgid "Syntax error detected, aborting."
|
||||
msgstr "Zaznana napaka v sintaksi, prekinjam."
|
||||
#: main.cpp:75
|
||||
msgid "Error initializing COM.\n"
|
||||
msgstr "Napaka pri vzpostavitvi COM.\n"
|
||||
|
||||
#: main.cpp:82
|
||||
#, c-format
|
||||
msgid "Error opening %s input file.\n"
|
||||
msgstr "Pri odpiranju vhodne datoteke %s je prišlo do napake.\n"
|
||||
|
||||
#: main.cpp:89
|
||||
#, c-format
|
||||
msgid "Error opening %s output file.\n"
|
||||
msgstr "Pri odpiranju izhodne datoteke %s je prišlo do napake.\n"
|
||||
|
||||
#: main.cpp:95
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Error loading compositions from %s input file. Please make sure the input "
|
||||
"file is ZRCola.zrc compatible.\n"
|
||||
msgstr ""
|
||||
"Pri nalaganju sestavljank iz vhodne datoteke %s je prišlo do napake. "
|
||||
"Preverite, ali je vhodna datoteka res združljiva z ZRCola.zrc.\n"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Could not open database %s (0x%x)."
|
||||
#~ msgstr "Ne morem odpreti podatkovne baze %s (%x)."
|
||||
|
||||
#~ msgid "Creating ADOConnection object failed (0x%x)."
|
||||
#~ msgstr "Stvaritev objekta ADOConnection ni uspela (0x%x)."
|
||||
|
||||
#~ msgid "ADO Error 0x%x: %ls"
|
||||
#~ msgstr "Napaka ADO 0x%x: %ls"
|
||||
|
||||
#~ msgid "Syntax error detected, aborting."
|
||||
#~ msgstr "Zaznana napaka v sintaksi, prekinjam."
|
||||
|
||||
#~ msgid "Help was given, terminating."
|
||||
#~ msgstr "Pomoč prikazana, zaključujem."
|
||||
|
@ -65,14 +65,14 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
break;
|
||||
|
||||
default:
|
||||
wxLogMessage(_("Syntax error detected, aborting."));
|
||||
wxLogMessage(wxT("Syntax error detected, aborting."));
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Initialize COM (CoInitialize).
|
||||
wxCoInitializer initializerOLE(COINIT_MULTITHREADED | COINIT_SPEED_OVER_MEMORY);
|
||||
if (!initializerOLE) {
|
||||
_ftprintf(stderr, _("Error initializing OLE.\n"));
|
||||
_ftprintf(stderr, _("Error initializing COM.\n"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -83,5 +83,18 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
wxFile dst;
|
||||
const wxString& filenameOut = parser.GetParam(1);
|
||||
if (!dst.Create(filenameOut, true, wxS_IRUSR | wxS_IWUSR | wxS_IRGRP | wxS_IWGRP | wxS_IROTH)) {
|
||||
_ftprintf(stderr, _("Error opening %s output file.\n"), filenameOut.fn_str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
ATL::CComPtr<ADORecordset> rs_comp;
|
||||
if (!src.SelectCompositions(rs_comp)) {
|
||||
_ftprintf(stderr, _("Error loading compositions from %s input file. Please make sure the input file is ZRCola.zrc compatible.\n"), filenameIn.fn_str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include <wx/app.h>
|
||||
#include <wx/cmdline.h>
|
||||
#include <wx/file.h>
|
||||
#include <wx/intl.h>
|
||||
|
||||
#include <wxex/common.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user