Bug query spatial data
Posted by:
d q
Date: March 10, 2010 11:42PM
Hello,
I have a data sheet as follows:
insert into test.geo(geometry) values(geomfromtext('point(10 20)'));
insert into test.geo(geometry) values(geomfromtext('point(20 30)'));
insert into test.geo(geometry) values(geomfromtext('point(40 50)'));
I use the library 'SQLAPI' to query the data sheet.
The value of the 'geometry' returns incorrect.
How I could solve that?
Thanks in advance for your help
d q
Code:
typedef struct myPoint
{
unsigned char byte;
unsigned int type;
double X;
double Y;
}MYPOINT;
SAConnection conn;
try
{//;
conn.Connect(_T("localhost@test"),
_T("root"), _T(""), SA_MySQL_Client);
SACommand cmd(&conn);
cmd.setCommandText(_T("select id, aswkb(geometry) from test.geo;"));
cmd.Execute();
unsigned int id;
int nLen = 0;
void* pBuff = NULL;
MYPOINT *pPoint = NULL;
double dbX, dbY;
SAString szByte;
while(cmd.FetchNext())
{
id = cmd.Field(1).asLong();
szByte = cmd.Field(2).asBLob();
nLen = szByte.GetBinaryLength();
pBuff = szByte.GetBinaryBuffer(nLen);
pPoint = (MYPOINT *)pBuff;
unsigned char order = pPoint->byte;
unsigned int nType = pPoint->type;
dbX = pPoint->X;
dbY = pPoint->Y;
}
cmd.Close();
}
catch(SAException &x)
{
SAString str = x.ErrText();
CString msg((wchar_t*)str.GetBuffer(str.GetLength()));
MessageBox(msg);
str.ReleaseBuffer();
}
conn.Disconnect();
Subject
Views
Written By
Posted
Bug query spatial data
3845
March 10, 2010 11:42PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.