My first instinct is to add a Units column to any table with a
measurement. The value in Units would be a foreign key to a Units
table. Another table, Conversions, could hold conversion factors.
In addition to what jkl said, I'd like to point out that if you may
someday find yourself
Don't depend on column names. The ability to get a column name is not a
fundamental part of the SQL specification. There is no standard for the text
of column names, or for disambiguating names which occur in two different
tables.
If you need to specify the units of a measurement, store them
On Fri, 17 Jun 2016 19:59:56 +0200
Rapin Patrick wrote:
> 2016-06-17 18:24 GMT+02:00 James K. Lowden :
>
> > You are encoding type information in the name. If you move the type
> > information into the data, SQLite can manage the unit
2016-06-17 18:26 GMT+02:00 Igor Tandetnik :
>
> select * from t1 where col1 = ?1+?2 and col2=?1-?2;
>
> What should be the expected output of your hypothetical generic way for a
> statement like this?
>
> You seem to assume a one-to-one correspondence between columns and
>
2016-06-17 18:24 GMT+02:00 James K. Lowden :
>
> You are encoding type information in the name. If you move the type
> information into the data, SQLite can manage the unit dimension. You
> could use a CHECK constraint to require that speed was in m/s, or a
> trigger
On 6/17/2016 8:21 AM, Rapin Patrick wrote:
Find a generic way to retrieve column names and table name (and then column
types with above pragma) in a arbitrary single SQL statement for all
placeholder values.
Examples:
"INSERT INTO t1(col1, col2) VALUES(2, ?); » => (t1, col2)
"UPDATE t2 SET
On Fri, 17 Jun 2016 10:56:32 +0200
Rapin Patrick wrote:
> And my C++ wrapper then knows that this column is a speed expressed
> in meters per second. So when making a SELECT on t1 table, the
> wrapper will output number objects with unit dimension of Speed
> expressed in
> Le 17 juin 2016 à 13:35, Hick Gunter a écrit :
>
> Does
>
> .pragma table_info();
>
> not solve your problem?
>
I indeed need PRAGMA table_info(), to get type names from column names.
Let my rephrase my question:
Find a generic way to retrieve column names and table
@mailinglists.sqlite.org
Betreff: [sqlite] sqlite3_column_origin_name for INSERT and UPDATE
Hello,
I am using function sqlite3_column_origin_name and friends in my SQLite3 C++
wrapper class to get table and column names in SELECT statements.
I would like to have the same feature for INSERT and UPDATE statements
Hello,
I am using function sqlite3_column_origin_name and friends in my SQLite3 C++
wrapper class to get table and column names in SELECT statements.
I would like to have the same feature for INSERT and UPDATE statements: that
is, find the table name and column names when writing to the
10 matches
Mail list logo