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 » sqlite3 plugin documentation
sqlite3 plugin documentation [message #3970] Tue, 11 July 2006 22:42 Go to next message
Ordog is currently offline  Ordog
Messages: 13
Registered: July 2006
Promising Member
hello, id love to read about all those usefull things you can do with that plugin.

My planned task is as follows:
id like to read in a .db file created by another sqlite db (what im coding is a external module for that project.).
I tried to get bihind the usage by looking at the example over and over, tweaking here and there but without sucess(my bad).
So before i rush into try n error or try to get behind it reading the code behind the plugin (which i am going to do now) im asking here for a solution covering all to enough odds that might hit me.
Thanks in advance.

edit: try n error luck Very Happy
now i have to dig into the syntax for reading stuff from it again the only help is assist++ first question is regarding sql.fetch(Fields)
how do i throw a field in there? sqlid style? would result in ambigius overloaded function call because of string is not within scope hm?

[Updated on: Wed, 12 July 2006 05:35]

Report message to a moderator

Re: sqlite3 plugin documentation [message #3972 is a reply to message #3970] Wed, 12 July 2006 05:40 Go to previous messageGo to next message
Ordog is currently offline  Ordog
Messages: 13
Registered: July 2006
Promising Member
Currently im trying to read data from the database using:
	Sqlite3Session sqlsession;
	sqlsession.LogErrors(true);
	if(!sqlsession.Open(fn)) {
		PromptOK("Can't create or open database file\n");
		return;
	}
	Sql sql(sqlsession);
	sql*Select("max(roundid)").From(Unit);
	
	while(sql.Fetch())
		PromptOK(Format("%s",sql[0]));


compiles without errors but leads to a failed assertion:
Sqlite3upp.cpp in Line 236 
NULL != current_stmt


wrong usage?
Re: sqlite3 plugin documentation [message #3973 is a reply to message #3972] Wed, 12 July 2006 09:20 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
I am not sure whether it is the problem, but should be

SqlId ROUNDID("ROUNDID");

sql * Select(SqlMax(ROUNDID)).From(Unit);


Aletnatively (and perhaps the right thing for start)

sql.Execute("select max(roundid) from Unit");


Mirek
Re: sqlite3 plugin documentation [message #3974 is a reply to message #3970] Wed, 12 July 2006 13:42 Go to previous messageGo to next message
Ordog is currently offline  Ordog
Messages: 13
Registered: July 2006
Promising Member
the assertion is at the beginning of Sqlite3Connection::Fetch()
current_stmt is the currently executed query. Im still lost 8/
Re: sqlite3 plugin documentation [message #3994 is a reply to message #3974] Thu, 13 July 2006 20:48 Go to previous messageGo to next message
Ordog is currently offline  Ordog
Messages: 13
Registered: July 2006
Promising Member
When i comment that Assertion out, table_list.GetCount() returns 0 as expected when theres no current_stmt (its 0 or NULL). current_smtm_string is set like it should though ("select tbl_name from sqlite_master where Type='table'").
If thats a bug in the plugin it would have occured to more people i guess so could somebody explain to me what i am doing wrong there?

I managed to get the SQlite3 reference example running but the only thing thats different is in the simple.h
#define SCHEMADIALECT <plugin/Sqlite3/Sqlite3Schema.h>
#define MODEL <SQL_Sqlite3/simple.sch>
#include "Sql/sch_header.h"

and in simple.cpp
#include <Sql/sch_source.h>

those are afaik only used to create the .db file so even using those isnt helping me 8/ can somebody tell me when current_stmt is NULL within a fetch() ? there must be a pretty simple reason...
i have attached the .db file im working with, apparently it has no tables when i use it with the sqlite example. Might be related to the MODEL define which isnt matching our build, which leads me to my next question:
do i need to define a MODEL when im just reading a db file?

[Updated on: Thu, 13 July 2006 21:23]

Report message to a moderator

Re: sqlite3 plugin documentation [message #4000 is a reply to message #3994] Fri, 14 July 2006 11:20 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Well, looks like sqlite plugin authors are not around now...

Anyway, of course, MODEL is not required.

If you can, please .zip your source package and post it here as well. I will try to investigate what is going wrong..

Mirek
Re: sqlite3 plugin documentation [message #4001 is a reply to message #4000] Fri, 14 July 2006 11:53 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

BTW: It would be nice to update sqlite to the newest version as well as sdl library. I'll take care about sdl but what about sqlite?
Re: sqlite3 plugin documentation [message #4023 is a reply to message #4001] Sat, 15 July 2006 14:11 Go to previous messageGo to next message
Ordog is currently offline  Ordog
Messages: 13
Registered: July 2006
Promising Member
Thank you for looking into it, i hope its just me and not a bug in the plugin Smile

[Updated on: Sat, 15 July 2006 20:22]

Report message to a moderator

Re: sqlite3 plugin documentation [message #4059 is a reply to message #4023] Wed, 19 July 2006 00:07 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Please remove "sqlite.lib" in package organizer. Sqlite is "totally embeded" in U++ (there are complete sqlite sources in plugin/sqlite) ... and even if it was not, standard is to interface with library in interace package, e.g. MySql library is added by MySql package - no need to add them into main project.

Without that lib your code seems to start...

Mirek
Re: sqlite3 plugin documentation [message #4073 is a reply to message #3970] Wed, 19 July 2006 14:10 Go to previous messageGo to next message
Ordog is currently offline  Ordog
Messages: 13
Registered: July 2006
Promising Member
uhm yes it starts, but even without it it wont fetch anything from the database.
I tried to use an SQLWrapper instead of the plugin thats why the lib was still there (forgot to remove it) when i remade the plugin using implmentation to post here.

[Updated on: Wed, 19 July 2006 14:15]

Report message to a moderator

Re: sqlite3 plugin documentation [message #4074 is a reply to message #4073] Wed, 19 July 2006 14:19 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Right now I have no sqlite database file around to test... Is yours short enough to post?

Mirek
Re: sqlite3 plugin documentation [message #4075 is a reply to message #3970] Wed, 19 July 2006 14:22 Go to previous messageGo to next message
Ordog is currently offline  Ordog
Messages: 13
Registered: July 2006
Promising Member
i posted one earlier in this thread as attachment Smile
Re: sqlite3 plugin documentation [message #4077 is a reply to message #4075] Wed, 19 July 2006 15:08 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Ordog wrote on Wed, 19 July 2006 08:22

i posted one earlier in this thread as attachment Smile



It seems that sqlllite returns "unsuported file format" error....

BTW, it pays off to add "session.SetTrace()" for debug mode...

Mirek
Re: sqlite3 plugin documentation [message #4078 is a reply to message #3970] Wed, 19 July 2006 16:05 Go to previous messageGo to next message
Ordog is currently offline  Ordog
Messages: 13
Registered: July 2006
Promising Member
uhm its a default sqlite3 .db file afaik
created on a ubuntu system i guess.
Might be an amd64 ... could that interfere?

[Updated on: Wed, 19 July 2006 16:08]

Report message to a moderator

Re: sqlite3 plugin documentation [message #4097 is a reply to message #4078] Wed, 19 July 2006 23:55 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
I have tried to wake up the author of plugin...

It is also possible that it is some newer format version - plugin is last updated year ago.

Meanwhile, in other thread, sqlite seems to work fine...

Mirek
Re: sqlite3 plugin documentation [message #4099 is a reply to message #4097] Thu, 20 July 2006 00:58 Go to previous messageGo to next message
rbmatt is currently offline  rbmatt
Messages: 90
Registered: July 2006
Location: Tennesse, USA
Member

luzr wrote on Wed, 19 July 2006 17:55

Meanwhile, in other thread, sqlite seems to work fine...

The database I am using was actually created by U++'s SqLite package. While I was testing it out, at one point I was using a SqLite db created elsewhere. I could not get it to work (may be due to version incompatability, may be something else) so I moved on to something different. I eventually ended up using the example program to create my tables in a new database.
Re: sqlite3 plugin documentation [message #4136 is a reply to message #3970] Mon, 24 July 2006 11:24 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
OK, I think the one possible cause is old Sqlite in plugin. We will try to update to latest version soon, most likely tomorrow.

Mirek
Re: sqlite3 plugin documentation [message #4142 is a reply to message #4099] Tue, 25 July 2006 10:34 Go to previous message
aroman is currently offline  aroman
Messages: 18
Registered: November 2005
Promising Member

rbmatt wrote on Wed, 19 July 2006 15:58


The database I am using was actually created by U++'s SqLite package. While I was testing it out, at one point I was using a SqLite db created elsewhere. I could not get it to work (may be due to version incompatability, may be something else) so I moved on to something different. I eventually ended up using the example program to create my tables in a new database.

It may be a versioning problem, but you should also be aware that there are two main versions of sqlite. Sqlite2 and Sqlite3, and the API and databases are not compatible between them. The UPP plugin code is Sqlite3, but an old version. If you want the newest version, see my recent post on updating the sqlite3 plugin.

EDIT: I downloaded your file and tested it out. The old sqlite plugin version was 3.2.7, I believe, which did not read your db file. The new version is 3.3.6 and does read your db file. So upgrade to the newer version and you should be fine.

- Augusto

[Updated on: Tue, 25 July 2006 10:40]

Report message to a moderator

Previous Topic: How to use Like() with SqlArray
Next Topic: Updated Sqlite3 plugin
Goto Forum:
  


Current Time: Sat May 04 18:24:34 CEST 2024

Total time taken to generate the page: 0.03862 seconds