U++ framework
Do not panic. Ask here before giving up.

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: Mon Jul 20 05:33:12 GMT+2 2026

Total time taken to generate the page: 0.00465 seconds