Get Field Names In Select Query

classic Classic list List threaded Threaded
3 messages Options
siva siva
Reply | Threaded
Open this post in threaded view
|

Get Field Names In Select Query

Hi,

How to get the field names in select query?

I am using sql api to create tables (Not based on model class because table
and its fields need to create dynamically and its fields more than 100).

Let Assume i want to create a person table it contains more than 100 fields
and  i am creating like bellow with out model class
/ cache.query(new SqlFieldsQuery(
                 "CREATE TABLE Persons (id LONG PRIMARY KEY, name
VARCHAR,jurney date,,,,,,,,,,,,,,) WITH
"template=replicated,CACHE_NAME=Persons)).getAll()/


Query:
-------
Get All The Person Details Based On Person Id And Journey Date

If i use SqlFields query i am not able to get the field names along with the
values.

If i use SqlQuery i need to mention model class










--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Peter Sham Peter Sham
Reply | Threaded
Open this post in threaded view
|

Re: Get Field Names In Select Query

If you don't do GetAll() and just do Query(new SqlFieldsQuery...), the FieldsQueryCursor returned will have the column count and name of your result set.

Hope this help.

On Tuesday, November 20, 2018, 8:43:22 PM EST, siva <[hidden email]> wrote:


Hi,

How to get the field names in select query?

I am using sql api to create tables (Not based on model class because table
and its fields need to create dynamically and its fields more than 100).

Let Assume i want to create a person table it contains more than 100 fields
and  i am creating like bellow with out model class
/ cache.query(new SqlFieldsQuery(
                "CREATE TABLE Persons (id LONG PRIMARY KEY, name
VARCHAR,jurney date,,,,,,,,,,,,,,) WITH
"template=replicated,CACHE_NAME=Persons)).getAll()/


Query:
-------
Get All The Person Details Based On Person Id And Journey Date

If i use SqlFields query i am not able to get the field names along with the
values.

If i use SqlQuery i need to mention model class










--
siva siva
Reply | Threaded
Open this post in threaded view
|

Re: Get Field Names In Select Query

Thank You Peter ,Its helped  :)



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/