Hi Lokesh,

Thanks for the details.

Unfortunately, not all databases / JDBC drivers report table (and schema)
names with ResultSetMetaData (e.g. Oracle and SQL Server don't). What
database are you using?

If those are present, then jOOQ will read those and associate them with the
individual fields that are reported in the Result. The fields will then be
of the form:

DSL.field(name(schemaName, tableName, columnName), dataType);


The table name can be extracted by calling toString() and then doing string
manipulation. There is currently no other way.

BTW, if both tables A and B have one attribute with same name e.g.  "xxx"
> what would the response as map (attribute name to value) contain?


jOOQ's Result will contain two Field references with the same column name
"xxx". This is OK for jOOQ, because internally, all operations are column
index based, not column name base. If you want to read the right column
from a jOOQ Result, and there is no table name information available to
disambiguate the names, you'll have to either:

- Access columns by index
- Explicitly alias such columns in your original query.

I hope this helps.

Let me know if you have any additional questions
Lukas

2015-12-23 4:45 GMT+01:00 <[email protected]>:

> Hi Lukas,
>
> Thanks for following up. The query that I am running looks like this:
>
> select().from("A").join("B").on(some condition)
>
> I tried response as ResultSet also. It is giving me empty table name for
> all the fields.
> BTW, if both tables A and B have one attribute with same name e.g.  "xxx"
> what would the response as map (attribute name to value) contain?
>
> Thanks,
> Lokesh
>
> On Tuesday, 22 December 2015 01:08:25 UTC-8, Lukas Eder wrote:
>>
>> Hi Lokesh,
>>
>> This would depend on the concrete query that you're running.
>>
>> - If you're selecting generated TableField instances, then
>> TableField.getTable() can be used
>> - If you're selecting plain SQL Fields or aliased fields, or any kind of
>> expression, you'll have to manage yourself.
>>
>> What does the query you're running look like?
>>
>> Cheers,
>> Lukas
>>
>>
>>
>> 2015-12-21 21:09 GMT+01:00 <[email protected]>:
>>
>>> Hi,
>>>
>>> From a join query result record, how could I know which field belongs to
>>> which table? Or, how do I group the fields by table name?
>>>
>>> Thanks,
>>> Lokesh
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "jOOQ User Group" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "jOOQ User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to