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 » Access to S_* Structure of TABLE crash Application.
Re: PROPOSAL: Access to S_* Structure of TABLE crash Application. [message #36301 is a reply to message #36300] Fri, 18 May 2012 22:27 Go to previous messageGo to previous message
Sender Ghost is currently offline  Sender Ghost
Messages: 301
Registered: November 2008
Senior Member
sergeynikitin wrote on Fri, 18 May 2012 21:27

A colorful example of how we ourselves create artificial boundaries.

Yes, my conclusions based on current implementation. But I didn't say, that this is not possible in principle.
I showed real example about how to achieve this with current tools.
Quote:

Otherwise, we are forced to write for each table, in which there is a field NAME or ID some artificial design.


I think, no. It's normal to write as follows:
SQL * Select(ID, NAME, LASTNAME, PLANT_ID).From(WORKER);
LOG(SQL.ToString());
while (SQL.Fetch()) {
	LOG("-----");
	DUMP(SQL[ID]);
	DUMP(SQL[NAME]);
	DUMP(SQL[LASTNAME]);
	DUMP(SQL[PLANT_ID]);
}

SQL * Select(ID, NAME, ADDRESS).From(PLANT);
LOG('\n' << SQL.ToString());
while (SQL.Fetch()) {
	LOG("-----");
	DUMP(SQL[ID]);
	DUMP(SQL[NAME]);
	DUMP(SQL[ADDRESS]);
}

With following output:
select ID, NAME, LASTNAME, PLANT_ID from WORKER
-----
SQL[ID] = 0
SQL[NAME] = Joe
SQL[LASTNAME] = Smith
SQL[PLANT_ID] = 0
-----
SQL[ID] = 1
SQL[NAME] = Mike
SQL[LASTNAME] = Smith
SQL[PLANT_ID] = 0
-----
SQL[ID] = 2
SQL[NAME] = Jon
SQL[LASTNAME] = Goober
SQL[PLANT_ID] = 1

select ID, NAME, ADDRESS from PLANT
-----
SQL[ID] = 0
SQL[NAME] = First Plant
SQL[ADDRESS] = First st.
-----
SQL[ID] = 1
SQL[NAME] = Second Plant
SQL[ADDRESS] = Second st.

For cases with column name clashes there is "AS" clause. And even without this, it still possible to access result set through indexes.
 
Read Message icon3.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message icon3.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Sql .sch / Date (moved)
Next Topic: SqlBinary and Postgres 9
Goto Forum:
  


Current Time: Fri Jun 07 20:26:07 CEST 2024

Total time taken to generate the page: 0.01686 seconds