Maybe this patch (the same, but against original source instead of
amalgamation) against current fossil head

https://drive.google.com/open?id=1c24qvtvS57ASJF5RfZxLJSsgI2FhOVk1


On Sun, Jan 14, 2018 at 11:17 PM, Jake Chen <jakep...@gmail.com> wrote:

> Hi Peter,
>
> Currently the query result returned by node-sqlite3 has the rows formatted
> into objects all ready. Given SQL `SELECT foo.*, bar.* FROM foo JOIN bar`,
> the columns of foo and bar collide with each other. I've already sent a PR
> https://github.com/mapbox/node-sqlite3/pull/932 <
> https://github.com/mapbox/node-sqlite3/pull/932> to node-sqlite3 to allow
> a different result structure that keeps the rows untouched and returns
> fields along with rows.
>
> However, when the SQL contains table aliases, such as `SELECT foo.*, bar.*
> FROM egg AS foo JOIN egg AS bar ON foo.id <http://foo.id/> =
> bar.parent_id`, there's no way to return the fields correctly since
> `sqlite_column_table_name()` returns the actual table name rather than the
> alias. The link I attached in previous post is a discussion that took place
> 4 years ago. OP suggests a new function called 
> `sqlite_column_table_alias_name()`
> to return the table alias instead of actual name. A patch is attached to
> implement this function. The major change is in `columnTypeImpl` of
> `src/select.c`:
>
> @@ -105364,6 +105386,7 @@
>           if( j<pTabList->nSrc ){
>             pTab = pTabList->a[j].pTab;
>             pS = pTabList->a[j].pSelect;
> +          zTableAlias =
> pTabList->a[j].zAlias?pTabList->a[j].zAlias:pTabList->a[j].zName;
>           }else{
>             pNC = pNC->pNext;
>           }
>
> Source: http://mailinglists.sqlite.org/cgi-bin/mailman/private/
> sqlite-users/2014-November/056388.html <http://mailinglists.sqlite.
> org/cgi-bin/mailman/private/sqlite-users/2014-November/056388.html>
>
> Jake
> _______________________________________________
> 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

Reply via email to