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
Re: Schema File [message #5957 is a reply to message #5948] Thu, 26 October 2006 01:02 Go to previous message
mirek is currently offline  mirek
Messages: 14267
Registered: November 2005
Ultimate Member
(1) No, that is misunderstanding. .sch file is your description of database shema (what tables you want to have in database). Those lines of code take this schema, create .sql script (containing DDL statements like 'create table...') from them and execute them to have you schema realized in the table.

More specifically, the script executed is so called "upgrade script" - it creates the schema by adding single columns to the table - that way you can add columns to tables without loosing your database data.

(2) SQL is "global default session", so you should be able to get to your database using it. Almost every U++ SQL related interface defaults to this session, so as long as you are accessing only this one, you should be OK.

The likely cause of segfault is (1) - your tables do not exist in database.

BTW

	SqlId username("username");
	SqlId user_list("user_list");
	
	ldap_array.SetTable("user_list");
	ldap_array.AddColumn("username","username",3);


you should rather use SqlId constants in SetTable and AddColumn:

	ldap_array.SetTable(user_list);
	ldap_array.AddColumn(username,"username",3);


Those constants can also get defined by .sch file too. In U++ we tend to uppercase all database names too. E.g.

mydb.sch:

TABLE_(MYTABLE)
    INT_(COLUMN)
END_TABLE

.cpp:

ldap_array.SetTable(MYTABLE);
ldap_array.AddColumn(COLUMN, "column");


See examples/SQLApp for fairly complete SQL app skeleton.

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


Current Time: Thu Aug 28 19:03:51 CEST 2025

Total time taken to generate the page: 0.07994 seconds