Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » sqlapp example
sqlapp example [message #16061] Mon, 26 May 2008 14:49 Go to next message
toneranger33 is currently offline  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 #16086 is a reply to message #16061] Tue, 27 May 2008 14:24 Go to previous messageGo to next message
toneranger33 is currently offline  toneranger33
Messages: 7
Registered: March 2008
Promising Member
Changed to trying to create a database using the addressbook xml2 app enclosed in the distribution.

Perfected the layout, just need now to open a sql database and search through it in a similar fashion to the address book.

50,000+ entries in or current databse so too much time to convert to exact xml format addressbook uses unless some-one can help.

Prefer the sqlite option as it may be that several databases could then be used.

Any ideas?

toneranger33
Re: sqlapp example [message #16099 is a reply to message #16086] Tue, 27 May 2008 23:25 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 697
Registered: December 2005
Location: Budapest, Hungary
Contributor
There is a lot of sql examples. Just see one of them as an example.
Re: sqlapp example [message #16110 is a reply to message #16099] Wed, 28 May 2008 13:09 Go to previous messageGo to next message
toneranger33 is currently offline  toneranger33
Messages: 7
Registered: March 2008
Promising Member
Hi, started to examine the HomeBudget example. This fails to now run - the error message is:

Assertion failed in upp\uppsrc\plugin\sqllite3\sqllite3upp.cpp line 194
NULL ! current_stmt

Any ideas.

Kind Regards toneranger33
Re: sqlapp example [message #16112 is a reply to message #16110] Wed, 28 May 2008 13:26 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

Which version of upp do you use? I'll try to find what's going on.
Re: sqlapp example [message #16113 is a reply to message #16112] Wed, 28 May 2008 13:35 Go to previous messageGo to next message
toneranger33 is currently offline  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 Go to previous messageGo to next message
toneranger33 is currently offline  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 Go to previous messageGo to next message
toneranger33 is currently offline  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 Go to previous message
mr_ped is currently offline  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.
Previous Topic: Newbie help with PostgreSQL example
Next Topic: MySQL easy guide
Goto Forum:
  


Current Time: Mon Apr 29 06:28:57 CEST 2024

Total time taken to generate the page: 0.03383 seconds