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 » SQL*, SQL&, SQL*:: ???
SQL*, SQL&, SQL*:: ??? [message #11297] Sat, 01 September 2007 21:34 Go to next message
jeremyc is currently offline  jeremyc
Messages: 4
Registered: August 2007
Junior Member
I do not understand all of these that I see in code. Can someone tell me the difference between:

SQL * Select(...);
SQL & Select(...);
SQL * ::Select(...);


I've seen it in example code all three ways. Maybe more.

Thanks,

Jeremy
Re: SQL*, SQL&, SQL*:: ??? [message #11306 is a reply to message #11297] Mon, 03 September 2007 00:14 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
In 99% of cases, you use the first one.

"SQL &" throws an exception on error. Usually, with transactional RDBMS, using transaction block over exceptions is easier (even if not completely optimal), so it less often used.

"SQL * ::Select" is a bug, should be "SQL * UPP::Select", in what example you have spotted it? This has to be used in case when there is method named "Select" (name clash problem resolved by fully qualifying the name).

Mirek
Re: SQL*, SQL&, SQL*:: ??? [message #19339 is a reply to message #11306] Thu, 27 November 2008 19:21 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

I have seen similar use in HomeBudget.
But there it was ::Update.

Incidentally, all want more examples on databases and SQL.


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: SQL*, SQL&, SQL*:: ??? [message #19341 is a reply to message #19339] Thu, 27 November 2008 20:19 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

sergeynikitin wrote on Thu, 27 November 2008 13:21

I have seen similar use in HomeBudget.
But there it was ::Update.

Incidentally, all want more examples on databases and SQL.

:: Is not necessary, it is even wrong as all upp functions belogns to Upp namespace.
I often had in my apps Update method in which I had SQL * ::Update. Without scope selector I would have names conflict. I still use :: instead of UPP:: because it's shorter.
Re: SQL*, SQL&, SQL*:: ??? [message #19342 is a reply to message #19341] Thu, 27 November 2008 20:24 Go to previous message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

operator * calls Execute(), & calls ExecuteX which throws SqlExc if something is wrong. Useful if you do some operation in a transaction.

[Updated on: Thu, 27 November 2008 20:24]

Report message to a moderator

Previous Topic: Syntactic sugar
Next Topic: MSSQL new strange story :)
Goto Forum:
  


Current Time: Mon Apr 29 02:01:43 CEST 2024

Total time taken to generate the page: 0.05019 seconds