|
|
Home » U++ Library support » U++ SQL » sqlapp example
sqlapp example [message #16061] |
Mon, 26 May 2008 14:49 |
toneranger33
Messages: 7 Registered: March 2008
|
Promising Member |
|
|
Hi, I cannot get the example enclosed with the download of ultimateapp to run. Generates various errors.
I have converted an old dbf to sqlite and now need an app to read and edit the new database.
Actually it would need just perform searches on 4 fields and return the results. Any editing can be completed in a sqlite database browser already available. Though if we did include this function it would also need password protection for admin users only.
Total newbie so all help appreiated.
Kind regards toneranger33
|
|
|
|
|
|
|
Re: sqlapp example [message #16113 is a reply to message #16112] |
Wed, 28 May 2008 13:35 |
toneranger33
Messages: 7 Registered: March 2008
|
Promising Member |
|
|
Hi unodgs. I am running version 712 dev 1 on windows XP.
Kind regards toneranger33
btw: i have tried coding a simple app just to open the databse as starters.
Here is the code:
#include <CtrlLib/CtrlLib.h>
#include <DropGrid/DropGrid.h>
#include <GridCtrl/GridCtrl.h>
#include <plugin/sqlite3/lib/sqlite3.h>
#include <plugin/sqlite3/Sqlite3.h>
using namespace Upp;
GUI_APP_MAIN
{
bool nodb = false;
Sqlite3Session db;
db.LogErrors(true);
#ifdef flagDEBUG
db.SetTrace();
nodb = true;
#endif
FileIn fi("reclib.db");
if(fi.IsError() || fi.GetSize() <= 0)
nodb = true;
fi.Close();
if(!db.Open(ConfigFile("reclib.db")))
{
Exclamation(t_("Can't create or open database file"));
return;
}}
This crashes on execute. No erors reported.
[Updated on: Wed, 28 May 2008 13:37] Report message to a moderator
|
|
|
Re: sqlapp example [message #16150 is a reply to message #16113] |
Thu, 29 May 2008 15:25 |
toneranger33
Messages: 7 Registered: March 2008
|
Promising Member |
|
|
Reverted back to using the address book example. So instead of openning an xml file to search, how Do I change the file format to tab delimited txt?
No need to open the file - just need to search and then display the results, its for a music libray so the column names are Name, Artist, Title, Genre, Notes.
Would be helpful also to change the modify function to include password proctection for admin.
Kind Regards Toneranger33
[Updated on: Thu, 29 May 2008 15:25] Report message to a moderator
|
|
|
Re: sqlapp example [message #16151 is a reply to message #16150] |
Thu, 29 May 2008 15:39 |
toneranger33
Messages: 7 Registered: March 2008
|
Promising Member |
|
|
Found part of the answer, use the simple address book.
Now all I need to do is specify the file to search without it displaying the contents before performing a search.
Any ideas?
toneranger 33
no 1 entry per line not good enough either the format is:
Number Artist Title Genre Notes
all as a single line (tab delimited)
[Updated on: Thu, 29 May 2008 16:44] Report message to a moderator
|
|
|
Re: sqlapp example [message #16168 is a reply to message #16061] |
Fri, 30 May 2008 09:54 |
mr_ped
Messages: 825 Registered: November 2005 Location: Czech Republic - Praha
|
Experienced Contributor |
|
|
Why dev712 version?
The (not really) stable 2007 is more fresh, 2008.1 beta2 is probably even more stable now or problems are reported in forum, and if you want to be on development edge, there are SVN builds too.
About opening file. To have them all at 1 line is a bit unfortunate, as the UPP::Stream does have "String GetLine();" function.
So for you the solution is probably to read char by char ( int UPP::Stream::Get() ) and react properly on tab (\t) or -1 and build the strings/arrays from this.
As long as you are 100% sure about validity of input file this piece of code can be quite short and clean, but in real world it will probably take a bit more effort.
Maybe there are some additional functions in UPP to help with parsing text files, but I'm not aware of them, sorry.
|
|
|
Goto Forum:
Current Time: Wed May 15 04:49:00 CEST 2024
Total time taken to generate the page: 0.03093 seconds
|
|
|