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 » PostgreSQL GetInsertedId()
Re: PostgreSQL GetInsertedId() [message #16619 is a reply to message #16618] Wed, 02 July 2008 16:46 Go to previous messageGo to previous message
captainc is currently offline  captainc
Messages: 278
Registered: December 2006
Location: New Jersey, USA
Experienced Member
Idea 2: Have a mapping of sequences to table names from the .sch file.

Something like:
String seq = m_session.GetPKSequence(TABLENAME)

and we could use it like this:

...insert statement...
sql.GetInsertedId(seq)

and/or

sql.GetNextId(seq)
...insert statement...

Idea 3: Create a separate insert function called InsertSelect which will return 0 (or -1) for a failed insert and otherwise return 1..N which would be the last inserted id using the method described in the above post. So this would mean we would have 1 insert with no overhead and 1 with the overhead of getting the inserted id and returning it.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Quick explanation of function calls for postgresql
Next Topic: db access to MS ACCESS
Goto Forum:
  


Current Time: Sun May 12 17:18:41 CEST 2024

Total time taken to generate the page: 0.02214 seconds