On Sun, 1 Mar 2020, Allin Cottrell wrote:
On Fri, 28 Feb 2020, Riccardo (Jack) Lucchetti wrote:
> While we're on the subject: I need to pull a string-valued series from an
> ODBC source, which is not possible at present (if I'm not mistaken). Shall
> we leave this for after release?
There's now an initial go at this in git. When the "data" command
identifies
a column in a db table that is marked as of one of the
string types (SQL_CHAR, SQL_VARCHAR, SQL_WCHAR, SQL_WVARCHAR) we import it as
a string-valued series.
Please test! I can envisage encoding issues that we might have to deal with.
I can also envisage surprising results if a db table has been set up wrongly
-- numeric data entered, but as strings so far as SQL is concerned. Up till
now we'd automatically convert strings that represent numeric values to
numeric values, but as things stand in git we'll take the values to be
strings if that's what SQL says they are.
Confirmed working here, thanks a million Allin! :)
Note: some database managers (eg mariaDB/MySQL, which is what I'm using
for testing) provide extra types for strings (eg TEXT), that won't make it
through the ODBC channel. In these cases, some kind of conversion might
help. For example, assuming you have a table called "bar" containing a
TEXT column called "foo", you can trim it to its first 32 characters via
<hansl>
data x query="select left(foo, 32) from bar" --odbc
</hansl>
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------