Feat Req Get Aliased Table Name.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Feat Req Get Aliased Table Name.

J Decker
https://sqlite.org/c3ref/column_database_name.html

Source Of Data In A Query Result
The names returned are the original un-aliased names of the database,
table, and column.


Okay.  and there's...

https://sqlite.org/c3ref/column_name.html

These routines return the name assigned to a particular column in the
result set of a SELECT <https://sqlite.org/lang_select.html> statement.

Which is aliased column names (if aliased)

But there's no way to get the source table aliased.  And I don't think
database ever gets a chance to be aliased?

--------
SELECT a, sum(b), max(c) FROM t1 m GROUP BY a

There's no C API to get 'm' from the above.

Updated my patch to add the above through


+const char *sqlite3_column_table_alias_name(sqlite3_stmt*,int);
+const void *sqlite3_column_table_alias_name16(sqlite3_stmt*,int);

which is added with the top mentionend function groups behind
SQLITE_ENABLE_COLUMN_METADATA

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

Visual diff.
https://github.com/d3x0r/sqlite3/compare/AddTableAliasForColumn?expand=1


It's not very large.  It just has to allocate one more element in the array
of column info allocated by METADATA flag.... and set it when it sets the
rest, and expose it with an API call.


Even if it's just taken as inspiration, please add something to expose the
alias.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users