bonjour,
Je suis sur un descripteur (comme DSPFFD AS400 display File Field Despcrition) avec sqlite
mon r
WXDB or DATABASELAYER Help Topic is solved
-
- Earned some good credits
- Posts: 131
- Joined: Fri Dec 09, 2005 4:58 pm
WXDB or DATABASELAYER Help
apprendre et developper en C++ des sub routine interfac� HIM et BD pour validation acquis
Jean-Pierre
project define DB descripteur idem IBM400
http://www.ombrebleu.com/wxsrc/src/
Jean-Pierre
project define DB descripteur idem IBM400
http://www.ombrebleu.com/wxsrc/src/
-
- Super wx Problem Solver
- Posts: 267
- Joined: Mon Oct 18, 2004 10:55 am
wxDB uses ODBC to talk to the database, so you will need to use the SQLite ODBC driver if you go with wxDB. For SQLite it's most likely easier to go with wxSQLite3 or DatabaseLayer.
wxSQLite3 provides access to most (if not all) of SQLite's API. Here's a snippet from the sample (http://wxcode.cvs.sourceforge.net/wxcod ... iew=markup):
DatabaseLayer was written to hide the database details so it doesn't provide access to the SQLite3 API. Here's a snippet from the functionality summary page (http://wxcode.sourceforge.net/docs/data ... mmary.html):
wxSQLite3 provides access to most (if not all) of SQLite's API. Here's a snippet from the sample (http://wxcode.cvs.sourceforge.net/wxcod ... iew=markup):
Code: Select all
try
{
wxSQLite3Database db;
db.Open(_T("test.db"));
wxSQLite3ResultSet q1 = db.ExecuteQuery("select empname from emp order by 1;");
while (q1.NextRow())
{
cout << (const char*)(q1.GetString(0).mb_str()) << endl;
}
}
catch (wxSQLite3Exception& e)
{
cerr << e.GetErrorCode() << ":" << e.GetMessage().mb_str() << endl;
}
DatabaseLayer was written to hide the database details so it doesn't provide access to the SQLite3 API. Here's a snippet from the functionality summary page (http://wxcode.sourceforge.net/docs/data ... mmary.html):
Code: Select all
DatabaseLayer* pDatabase = NULL;
try
{
pDatabase = new SqliteDatabaseLayer(_("mydb.db"));
DatabaseResultSet* pResults = pDatabaseLayer->RunQueryWithResults(_("SELECT * FROM table1"));
if (pResults)
{
while (pResults->Next())
{
wxString strOne = pResults->GetResultString(_("column1"));
}
pDatabase->CloseResultSet(pResults);
}
}
catch (DatabaseLayerException& e)
{
wxLogError(wxString::Format(_("Error (%d): %s"), e.GetErrorCode(), e.GetErrorMessage().c_str()));
}
if (pDatabase)
delete pDatabase;
-
- Earned some good credits
- Posts: 131
- Joined: Fri Dec 09, 2005 4:58 pm
je vois that gives me an idea
I see I understand that gives me an idea of how I go put to take I think to use wxsqlite3 for the definitions
etr wxDB for accesses to the basis of data AS400
I had already taken the orentation and put some places the definitions with wxSlqite3 and you confirmed me one choices
thank-you for message
etr wxDB for accesses to the basis of data AS400
I had already taken the orentation and put some places the definitions with wxSlqite3 and you confirmed me one choices
thank-you for message
apprendre et developper en C++ des sub routine interfac� HIM et BD pour validation acquis
Jean-Pierre
project define DB descripteur idem IBM400
http://www.ombrebleu.com/wxsrc/src/
Jean-Pierre
project define DB descripteur idem IBM400
http://www.ombrebleu.com/wxsrc/src/
-
- Super wx Problem Solver
- Posts: 267
- Joined: Mon Oct 18, 2004 10:55 am
I hadn't thought about it earlier, but you could probably get away with one less pointer to deal with in the DatabaseLayer code using the following code:
(Sorry if this is a little off topic. I just felt the need to clean up that code sample a little.)
Code: Select all
try
{
SqliteDatabaseLayer db(_("mydb.db"));
DatabaseResultSet* pResults = db.RunQueryWithResults(_("SELECT * FROM table1"));
if (pResults)
{
while (pResults->Next())
{
wxString strOne = pResults->GetResultString(_("column1"));
}
db.CloseResultSet(pResults);
}
}
catch (DatabaseLayerException& e)
{
wxLogError(wxString::Format(_("Error (%d): %s"), e.GetErrorCode(), e.GetErrorMessage().c_str()));
}