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 fieldname case bug
PostgreSQL fieldname case bug [message #9689] Fri, 25 May 2007 00:16 Go to next message
zsolt is currently offline  zsolt
Messages: 697
Registered: December 2005
Location: Budapest, Hungary
Contributor
The problem is that postgresql returns field names in lower case.
In the original version of PostgreSQL classes, there was a ToUpper() on field names, allowing using expressions like sql[FIELD_NAME].
In current version, ToUpper() disappeared, so I'm unable to get fields by name from a result set.

Put back the original version please.

in bool PostgreSQLConnection::Execute() currently it is:
f.name = PQfname(result, i);

but should be
f.name = ToUpper(PQfname(result, i));
Re: PostgreSQL fieldname case bug [message #9693 is a reply to message #9689] Fri, 25 May 2007 09:23 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
OK, applied.
Re: PostgreSQL fieldname case bug [message #9694 is a reply to message #9689] Fri, 25 May 2007 09:24 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

I'm sorry. I was experimenting with PostgreSql plugin and forgot to revert this change. It will be fixed.

PS:
As you can see in postgre plugin code I added GetInsertedId but I pass null in sequence variable:
Format("select currval('%s')", sequence);
As I discovered this is the only way to get the squence value. Unfortunatelly this way requires sequence name.

This leads me to 2 conclusions:
1. GetInsertedId() must be change to GetInsertedId(const char *sequence = NULL)

2. postgres sch interface should generate squences ids automaticaly if column's type is SERIAL (to be able to write SQL.GetInsertedID(T_ID_SEQ)) Now I would be force to do something like this:
TABLE(T)
  INT (id) PRIMARY_KEY
  SEQUENCE(id)
END_TABLE

instead of just
TABLE(T)
  SERIAL (id) PRIMARY_KEY
END_TABLE


[Updated on: Fri, 25 May 2007 09:28]

Report message to a moderator

Re: PostgreSQL fieldname case bug [message #9702 is a reply to message #9694] Fri, 25 May 2007 19:50 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 697
Registered: December 2005
Location: Budapest, Hungary
Contributor
Mirek: Thanks Smile

Daniel:
1.: Yes, this would be good idea.
2.: I don't understand that clearly.
Re: PostgreSQL fieldname case bug [message #10063 is a reply to message #9694] Mon, 18 June 2007 20:18 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
unodgs wrote on Fri, 25 May 2007 03:24

I'm sorry. I was experimenting with PostgreSql plugin and forgot to revert this change. It will be fixed.

PS:
As you can see in postgre plugin code I added GetInsertedId but I pass null in sequence variable:
Format("select currval('%s')", sequence);
As I discovered this is the only way to get the squence value. Unfortunatelly this way requires sequence name.



Hm, I am sorry I missed this one...

Actually, this makes PostgreSQL equivalent to Oracle - means you no longer need or use "autoincrement" and GetInsertedId, but rather sequences directly... You only need to add PostgreSQL ValueGen... See SqlSequence in Oracle/OraCommon.h.

Mirek
Previous Topic: SqlFormat() bug with Date and Time types
Next Topic: How to access a firebird database ?
Goto Forum:
  


Current Time: Sun Apr 28 22:02:31 CEST 2024

Total time taken to generate the page: 0.04963 seconds