Home » U++ Library support » U++ SQL » GUID column in DB and SqlArray (how to use GUID column in database app)
Re: GUID column in DB and SqlArray [message #46217 is a reply to message #46124] |
Sun, 27 March 2016 11:48   |
LamerDrv
Messages: 3 Registered: March 2016
|
Junior Member |
|
|
Thank you for answer.
Unfortunately, it is appears that handling with GUID, SQL on Upp exceeds my knowledge
First I try direct use the COLUMN_ macros
TABLE_(Customer)
COLUMN_ ("uniqueidentifier", GUID, ID, 0, 0)
...
END_TABLE
and get
error C2664: 'Upp::FieldOperator &Upp::FieldOperator::operator ()(const char *,Upp::Ref)': cannot convert argument 2 from 'GUID' to 'bool &'
when compiling sch-file.
As far as I understanding the data types for db-fields must support Ref.
Then I try to use the Uuid type but get same error.
Then I try to make UGLY fix ) for make the Uuid be Ref-compatible:
struct Uuid2 : Uuid
{
operator Ref() const {return Ref((Value)*this);}
Uuid2& operator=(const Nuller&){SetNull(); return *this; }
};
After this the compiler passed sch-file
TABLE_(Customer)
COLUMN_ ("uniqueidentifier", Uuid2, ID, 0, 0)
...
END_TABLE
But when I call SqlArray.Query() I get error:
"[Microsoft][SQL Server Native Client 11.0]Numeric value out if range"
Eventually ... I made "simple" call
SQL.Execute("select ID from Customer");
and got same error.
This error is generated by ODBC-function SQLGetData (inside "default" branch of switch in ODBCConnection::Fetch0, ODBC.cpp):
if(!IsOk(SQLGetData(session->hstmt, i + 1, ct, &tm, 0, &li)))
break;
It is appears, Upp can't execute select query on uniquieidentifier field.
On this point I get stuck.
[Updated on: Sun, 27 March 2016 11:56] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sun Apr 27 13:04:39 CEST 2025
Total time taken to generate the page: 0.01017 seconds
|