'Range check error' on SELECT with JOIN
Posted: 28.03.2007, 16:05
I have a very strange problem with the following SQL query (it was more complex earlier, but this still causes the same problem).
SELECT Sites.Name, Inventory.Name FROM Inventory JOIN (Sites) ON Sites.IndexID = Inventory.SiteID) WHERE Inventory.IndexID = 62;
The error ERangeError "Range check error" appears in this function (or the likes for other data types):
TZRowAccessor.SetPChar
And on these rows in those functions:
FBuffer.Columns[FColumnOffsets[ColumnIndex - 1]]
Debug shows that the ColumnIndex is 2 when the exception appears.
The strange thing it that if I reorganize the SQL query and remove the Inventory.Name or switch place of the Sites.Name and Inventory.Name the problem does not occur. The same if I change so that I select from Sites and JOIN the Inventory table.
My thought is that the columns of the two tables do not add up somehow, and then there are not enough entries in the FColumnOffsets or the FBuffer.Columns. Sadly my Borland C++ Builder 6 do not give me debug info into these arrays.
Both tables has 9 columns with different data types.
I can add the structure of these tables and some data, but I thought that it would be better to see if anyone has some ideas of where to start debugging or maybe even what the error may be.
Thanks.
SELECT Sites.Name, Inventory.Name FROM Inventory JOIN (Sites) ON Sites.IndexID = Inventory.SiteID) WHERE Inventory.IndexID = 62;
The error ERangeError "Range check error" appears in this function (or the likes for other data types):
TZRowAccessor.SetPChar
And on these rows in those functions:
FBuffer.Columns[FColumnOffsets[ColumnIndex - 1]]
Debug shows that the ColumnIndex is 2 when the exception appears.
The strange thing it that if I reorganize the SQL query and remove the Inventory.Name or switch place of the Sites.Name and Inventory.Name the problem does not occur. The same if I change so that I select from Sites and JOIN the Inventory table.
My thought is that the columns of the two tables do not add up somehow, and then there are not enough entries in the FColumnOffsets or the FBuffer.Columns. Sadly my Borland C++ Builder 6 do not give me debug info into these arrays.
Both tables has 9 columns with different data types.
I can add the structure of these tables and some data, but I thought that it would be better to see if anyone has some ideas of where to start debugging or maybe even what the error may be.
Thanks.