Re: [sqlite] Request to get alias of table

2019-08-18 Thread J Decker
e 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--

Re: [sqlite] Request to get alias of table

2019-08-18 Thread Keith Medcalf
pated 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 f

Re: [sqlite] Request to get alias of table

2019-08-18 Thread J Decker
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(*)

Re: [sqlite] Request to get alias of table

2019-08-18 Thread J Decker
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

Re: [sqlite] Request to get alias of table

2019-08-18 Thread J Decker
n option to use without breaking old stuff. > -- > 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...@mai

Re: [sqlite] Request to get alias of table

2019-08-15 Thread Keith Medcalf
separate... > > { >count: 1, >'address.count': 1, >'address.addresses.id': 1, >'address.addresses.name': 'there', >'address.users.id': 1, >'address.users.address_id': 1, >'addr

Re: [sqlite] Request to get alias of table

2019-08-15 Thread J Decker
id': 1, 'address.users.address_id': 1, 'address.users.name': 'bob' } > > -- > The fact that there's a Highway to Hell but only a Stairway to Heaven says > a lot about anticipated traffic volume. > > > >-Original Message-

Re: [sqlite] Request to get alias of table

2019-08-15 Thread Keith Medcalf
te-users [mailto:sqlite-users- >boun...@mailinglists.sqlite.org] On Behalf Of J Decker >Sent: Thursday, 15 August, 2019 14:37 >To: SQLite mailing list >Subject: Re: [sqlite] Request to get alias of table > >> >> >> >> sqlite> select * from ( select count(*)count,* from

Re: [sqlite] Request to get alias of table

2019-08-15 Thread Keith Medcalf
Aha! Found and fixed some bugs in my apsw wrapper for stuff that I do not do often (such as using * to retrieve duplicate column names as I typically always use AS to name columns explicitly, so the Row was being built with duplicate names). Also, removed the code that disabled the long_colum

Re: [sqlite] Request to get alias of table

2019-08-15 Thread J Decker
On Thu, Aug 15, 2019 at 2:53 PM Keith Medcalf wrote: > > Using AS to name columns means NOT using *. One only uses * when one does > not care about column names (or the ordering of the result columns). > Sounds like a personal gospel. This is closer to the test case (yes it doesn't make a

Re: [sqlite] Request to get alias of table

2019-08-15 Thread Keith Medcalf
Using AS to name columns means NOT using *. One only uses * when one does not care about column names (or the ordering of the result columns). select address.id AS address_id, address.nameAS address_name, user.id AS user_id, user.address_id AS user_address_

Re: [sqlite] Request to get alias of table

2019-08-15 Thread J Decker
> > > > sqlite> select * from ( select count(*)count,* from addresses join users > on users.address_id=addresses.id ) address join pets pet on pet.user_id= > address.users.id; > Error: no such column: address.users.id > > >> console.log( db.do( "select count(*)count,* from ( select count(*)count,*

Re: [sqlite] Request to get alias of table

2019-08-15 Thread J Decker
On Thu, Aug 15, 2019 at 12:33 PM J Decker wrote: > > > On Thu, Aug 15, 2019 at 12:24 PM Keith Medcalf > wrote: > >> After fixing the errors in the script (strings are quoted with single >> quotes, not double quotes): >> > .headers on > pragma full_column_names=1; > pragma short_column_names=0; >

Re: [sqlite] Request to get alias of table

2019-08-15 Thread J Decker
On Thu, Aug 15, 2019 at 12:24 PM Keith Medcalf wrote: > After fixing the errors in the script (strings are quoted with single > quotes, not double quotes): > sqlite> .headers on > sqlite> create table addresses( id, name ); > sqlite> create table users( id, address_id, name ); > sqlite> create ta

Re: [sqlite] Request to get alias of table

2019-08-15 Thread Keith Medcalf
After fixing the errors in the script (strings are quoted with single quotes, not double quotes): sqlite> .headers on sqlite> create table addresses( id, name ); sqlite> create table users( id, address_id, name ); sqlite> create table pets(id, user_id, name ); sqlite> sqlite> insert into addresse

Re: [sqlite] Request to get alias of table

2019-08-15 Thread J Decker
I was trying a more complex query where the table name isn't a simple table name... select * from ( select * from addresses join user on user.address_id= addresses.id ) address; but that gives like really strange column names... # sqlite3 output id|name|id:1|address_id|name:1 1|there|1|1|bob # m

[sqlite] Request to get alias of table

2019-08-15 Thread J Decker
I would really like to get the table alias specified in the query, with an unpatched version of Sqlite. So here's a script... -- .headers on create table addresses( id, name ); create table users( id, address_id, name ); create table pets(id, user_id, name ); insert into addresses(id,name)