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 » Please help me understand u++ schemas  () 1 Vote
icon9.gif  Please help me understand u++ schemas [message #1573] Thu, 09 March 2006 03:48 Go to next message
santiago is currently offline  santiago
Messages: 13
Registered: March 2006
Location: C�rdoba, Argentina
Promising Member
I really don't get how to use schemas, please excuse me, I've been looking at the code for a while, but i'm not an c++ expert and since it's not documented or commented, it's been really hard for me. So i'm asking for help here.
My problem is that i don't get how to make schemas work, i think i get the idea, created a .sch include it, called it, and i think everyhing is fine, i even get the idea for querys, but can't create a table.
Can someone please give me a hint i'll appreciate it.
Thanks in advance.
Re: Please help me understand u++ schemas [message #1576 is a reply to message #1573] Thu, 09 March 2006 04:08 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
santiago wrote on Thu, 09 March 2006 02:48

I really don't get how to use schemas, please excuse me, ...



You don't need to feel sorry for asking questions here on Ultimate++ forums (unlike some other forums). But maybe you should better post some of your code and name the topic "Can't create a table with schemas"? Smile
Re: Please help me understand u++ schemas [message #1580 is a reply to message #1576] Thu, 09 March 2006 05:30 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
fudadmin wrote on Wed, 08 March 2006 22:08

santiago wrote on Thu, 09 March 2006 02:48

I really don't get how to use schemas, please excuse me, ...



You don't need to feel sorry for asking questions here on Ultimate++ forums (unlike some other forums). But maybe you should better post some of your code and name the topic "Can't create a table with schemas"? Smile


Agree, this is way too generic question. The simple way is to zip your test package and post here.

Mirek
Re: Please help me understand u++ schemas [message #1581 is a reply to message #1580] Thu, 09 March 2006 05:45 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
Off topic: When do you sleep, Mirek ? Shocked Smile
Re: Please help me understand u++ schemas [message #1582 is a reply to message #1581] Thu, 09 March 2006 05:50 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
fudadmin wrote on Wed, 08 March 2006 23:45

Off topic: When do you sleep, Mirek ? Shocked Smile


And you? Smile

Mirek
Re: Please help me understand u++ schemas [message #1594 is a reply to message #1573] Thu, 09 March 2006 13:31 Go to previous messageGo to next message
santiago is currently offline  santiago
Messages: 13
Registered: March 2006
Location: C�rdoba, Argentina
Promising Member
Thank you for the really quick answers.

Here's the code of the SQL_Sqlite3 example that i don't understand.

SQL = sqlite3;

SqlSchema sch(SQLD_SQLITE3);
StdStatementExecutor se(sqlite3);

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();


The "SQL = sqlite3;" line even has a comment above saying "What does this do?"

Thanks again for the help.
Re: Please help me understand u++ schemas [message #1598 is a reply to message #1594] Thu, 09 March 2006 15:20 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
SQL is "default SQL cursor" - one main cursor, useful for apps dealing with just one database. That line in fact defines that this default cursor will refer to created SqlLite session.

Now those scripts. U++ is able to generate a couple of database scripts from the .sch files:

* script that creates schems tables by adding individual columns

"adding individual columns" is quite imporant, as that way you are able to "upgrade" existing database schema in most cases - you just run the script, statements for existing columns will fail, but those that are not there yet will succed and upgrade schema

* script to add "attributes" to columns - attributes here are constraints or indexes

* script to drop "attributes" - note that this is often useful and harmless to stored data to recreate attributes (drop + add).

* script to wipe the schema out - seldom used and not present in the example

* script to perform initial setting of table content - for configuration tables etc...

All_Tables here creates those scripts - they are stored in Strings inside "sch".

Now performing script can be quite long operation, something you do not want to do each time you start your code. That is the reason for "ScriptChanged" - it tests whether script differs from the one stored inside "exe-directory".

"SaveNormal" then stores scripts into exe-dir.

Note that those script issues are usually present only in debug code. When delivering application, you can either execute scripts from exe-dir, or you can run debug version against customers database engine (recently, I prefer later).

Anything left to explain?

Mirek
icon7.gif  Re: Please help me understand u++ schemas [message #1600 is a reply to message #1598] Thu, 09 March 2006 15:43 Go to previous messageGo to next message
santiago is currently offline  santiago
Messages: 13
Registered: March 2006
Location: C�rdoba, Argentina
Promising Member
GREAT EXPLANATION!

thank you very much for this.

I whish i could help someday with the proyect, or some other people.Thanks.
Re: Please help me understand u++ schemas [message #1601 is a reply to message #1600] Thu, 09 March 2006 17:03 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
santiago wrote on Thu, 09 March 2006 09:43

GREAT EXPLANATION!

thank you very much for this.

I whish i could help someday with the proyect, or some other people.Thanks.



Write SQL tutorial Wink

Mirek
Previous Topic: Multithread build problem with MySql
Next Topic: MySQL Link Issue [SOLVED]
Goto Forum:
  


Current Time: Mon Apr 29 01:00:05 CEST 2024

Total time taken to generate the page: 0.06370 seconds