On Sun, Aug 18, 2019 at 6:51 PM Keith Medcalf <kmedc...@dessus.com> wrote:
> > And what would you expect the column, alias, and table alias, and origin > table to be for the following query: > > select * from (select * from ( select * from (select 1, 2, 3) ta) as tb) > tc; > > Wrong function... it's SQLColAttribute... https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlcolattribute-function?view=sql-server-2017 '1' '2' '3' no column alias 'ta' is where the values came from.... but probably 'tc' amusing though. ------- Added some logging to break it out, because there isn't any reason to have any depth to that.... SQL_DESC_TABLE_NAME (TN) SQL_DESC_BASE_TABLE_NAME (BN) SQL_DESC_NAME (CN) select 1,2,3 = CN=['1','2','3'] TN=blank BN=blank select * from( select 1,2,3 ) ta TN='ta' BN=blank select * from (select * from( select 1,2,3 ) ta )tb TN='tb' BN='tb'; ... etc for tc, td, ... For MySQL ODBC. but most importantly; 'select * from someTable ta'; table_name returns 'ta' not 'someTable' ... base name does return 'someTable'. in current Sqlite API there is NO way to get 'ta' from the last query. > -- > The fact that there's a Highway to Hell but only a Stairway to Heaven says > a lot about anticipated traffic volume. > > >-----Original Message----- > >From: sqlite-users [mailto:sqlite-users- > >boun...@mailinglists.sqlite.org] On Behalf Of J Decker > >Sent: Sunday, 18 August, 2019 18:14 > >To: SQLite mailing list > >Subject: Re: [sqlite] Request to get alias of table > > > >And sorry for the Spam. But, having had cake, I really do like cake, > >and i > >do beleive I have deliberatly forced a query to result with an object > >of > >group:{} and users: {} information in the group. > > > >But, having worked motstly with MySQL/MSSQL through ODBC, that's why > >I > >would expect > > > >select count(*) count from table alias > > > >to have a origin column name of 'count(*)' (not null), an alias of > >'count' > >, a table name of 'table' and a table alias of 'alias'. > > > >Although the ODBC stuff doesn't actually give you the choice to get > >the > >origin names of things. > > > > > > > > > >On Sun, Aug 18, 2019 at 5:01 PM J Decker <d3c...@gmail.com> wrote: > > > >> Okay let's start with, I originally had an API compatible with > >ODBC, which > >> the third information parameter is 'The name of the table, view, > >alias, > >> or synonym.' > >> > >> > >> > >https://www.ibm.com/support/knowledgecenter/en/SSEPEK_11.0.0/odbc/src > >/tpc/db2z_fncolumns.html > >> > >> > >> > >> Column 1 TABLE_CAT (VARCHAR(128))The name of the catalog. The value > >is > >> NULL if this table does not have catalogs.Column 2 TABLE_SCHEM > >> (VARCHAR(128))The name of the schema containing TABLE_NAME.Column 3 > >> TABLE_NAME (VARCHAR(128) not NULL)The name of the table, view, > >alias, or > >> synonym.Column 4 COLUMN_NAME (VARCHAR(128) not NULL)The column > >> identifier. The name of the column of the specified table, view, > >alias, or > >> synonym.Column 5 DATA_TYPE (SMALLINT not NULL)The SQL data type of > >the > >> column that is identified by COLUMN_NAME. The DATA_TYPE is one of > >the > >> values in the Symbolic SQL Data Type column in the table of > >symbolic and > >> default data types for CLI.Column 6 TYPE_NAME (VARCHAR(128) not > >NULL)A > >> character string that represents the name of the data type that > >corresponds > >> to DATA_TYPE.Column 7 COLUMN_SIZE (INTEGER) > >> > >> > >_______________________________________________ > >sqlite-users mailing list > >sqlite-users@mailinglists.sqlite.org > >http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > > > > _______________________________________________ > sqlite-users mailing list > sqlite-users@mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users