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 » Schema File
Schema File [message #5948] Wed, 25 October 2006 18:25 Go to previous message
kevind is currently offline  kevind
Messages: 1
Registered: October 2006
Junior Member
First of all, I am very happy with U++. I found it last week and am very impressed with the increase in development speed.

Although, I've hit a road block and don't fully understand a few things.

1. I've created a sqlite3 database with a number of tables. It seems that running the standard code included:

	#ifdef _DEBUG
	SqlSchema sch(SQLITE3);
	StdStatementExecutor se(session);
	session.SetTrace();
	All_Tables(sch);
	if(sch.ScriptChanged(SqlSchema::UPGRADE))
		Sqlite3PerformScript(sch.Upgrade(),se);
	if(sch.ScriptChanged(SqlSchema::ATTRIBUTES)) {
		Sqlite3PerformScript(sch.Attributes(),se);
	}
	if(sch.ScriptChanged(SqlSchema::CONFIG)) {
		Sqlite3PerformScript(sch.ConfigDrop(),se);
		Sqlite3PerformScript(sch.Config(),se);
	}
	sch.SaveNormal();
	session.SetTrace();
	#endif


should create the sch file. But if the file (.sch) doesn't exist at compile time (as specified by MODEL) my program doesn't compile. And if it already existed it doesn't change. I saw the explanation of this code in another thread but it doesn't seem to be behaving as per my expectations.

2. Are there any suggestions on the way to manage a sql session and best practices? If I create a session in one class how do I access it in another?

More concretely: If have my MainClass and I initiate Sqlite3Session in it, I can't access it in any obvious (to me) way from SomeOtherClass. (Could I possibly see a small code example as well?) All the examples I’ve seen have all the queries in a single class. I am trying to make an app with a different class for each tab and don't want to create a new connection for each tab.

3. Finally, I am trying to create a SqlArray and running into the following problem:

MainClass:
	SQL;
	Sqlite3Session session;

	session.LogErrors(true);
	if(!session.Open(ConfigFile("C:\\MyApps\\testapp\\gsm.db"))) {
		LOG("Can't create or open database file\n");
		return;
	}
	SQL = session;

AnotherClass
	CtrlLayout(*this);
	SizePos();
	CtrlLayout(auth);
	
	SqlId username("username");
	SqlId user_list("user_list");
	
	ldap_array.SetTable("user_list");
	ldap_array.AddColumn("username","username",3);
	ldap_array.SetOrderBy("username");
	ldap_array.Query();


At the last line I get a seg fault. This is a reproducible event if I try to do a session.Open(ConfigFile("")). I wish I could give you more on this but I don't fully understand my error.

I am running 610-dev3 on win32, here is the gdb output:

Program received signal SIGSEGV, Segmentation fault.
0x0074468b in Sql::GetSession() const (this=0x879c90)
    at C:/upp/uppsrc/Sql/Sqls.h:174
174             SqlSession& GetSession() const                     { return cn->
GetSession(); }
Current language:  auto; currently c++
(gdb)


Problem 3 is probably due to my lack of understanding of 1 & 2.

Thanks for your help.

-Kevin

[Updated on: Wed, 25 October 2006 18:35]

Report message to a moderator

 
Read Message
Read Message
Previous Topic: Postgres Support
Next Topic: IMHO strange Files for SQL Schema
Goto Forum:
  


Current Time: Mon Apr 28 18:24:43 CEST 2025

Total time taken to generate the page: 0.03854 seconds