Hello to you all,
It seems to me there are some limitations or (for me at least) unexpected behaviours to the Cursor.GetString method (and its siblings) when getting data from a SELECT stmt with a JOIN and identically named columns.
When I write my SQL as follows (and thats how I like to write them)
getting field data with cursor.Getstring("M.descr") gives a null value.
Also not aliasing the tables does not work : cursor.Getstring("tableM.descr")
It took me some nights to discover that one solution is to not only alias the tables, but the columns also, like this
cursor.Getstring("Mdescr") is ok now. Looks like the cursor.Getstring functions don't behave correctly when a dot is involved.
Perhaps this info is of use to anyone, I did not find any information concerning this issue.
Can anyone with closer knowledge on the SQL library acknowledge this issue and also if we can expect this to be solved, or why it can't be.
Many greetings,
Bart
It seems to me there are some limitations or (for me at least) unexpected behaviours to the Cursor.GetString method (and its siblings) when getting data from a SELECT stmt with a JOIN and identically named columns.
When I write my SQL as follows (and thats how I like to write them)
B4X:
SELECT M.id, M.descr, T.descr
FROM tableM AS M
LEFT JOIN tableT AS T ON M.tid = T.id
Also not aliasing the tables does not work : cursor.Getstring("tableM.descr")
It took me some nights to discover that one solution is to not only alias the tables, but the columns also, like this
B4X:
SELECT M.id AS Mid, M.descr AS Mdescr, T.descr AS Tdescr
FROM tableM AS M
LEFT JOIN tableT AS T ON M.tid = T.id
cursor.Getstring("Mdescr") is ok now. Looks like the cursor.Getstring functions don't behave correctly when a dot is involved.
Perhaps this info is of use to anyone, I did not find any information concerning this issue.
Can anyone with closer knowledge on the SQL library acknowledge this issue and also if we can expect this to be solved, or why it can't be.
Many greetings,
Bart