Hi, Simon,

On Fri, Apr 22, 2016 at 9:23 AM, Simon Slavin <slavins at bigfraud.org> wrote:
>
> On 22 Apr 2016, at 2:09pm, Igor Korot <ikorot01 at gmail.com> wrote:
>
>> The field type is set to be "varchar(100)" for the name field.
>> Wouldn't it be more logical to have it as "varchar" and have another field
>> for data size?
>
> What you are seeing there is SQLite just repeating back the type that the 
> CREATE TABLE command used.  It is not the type of data SQLite is actually 
> storing.
>
> There is no 'varchar' datatype in SQLite.  And it never truncates strings.
>
> I think that the best thing for you may be to read this page
>
> <https://www.sqlite.org/datatype3.html>

I know SQLite goes by the affinity and not by the type. Something like
scripting language - nothing is typed.

However, what I'm saying is that most DBMS out there do store the size
of the field.

Even though I issue something like:

CREATE TABLE test( id INTEGER, PRIMARY KEY, test1 VARCHAR(25), test2
INTEGER(3), test3 FLOAT(25,2) );

if I ask for the columns information, I will get:

id            INTEGER
test1       VARCHAR      25      0
test2        INTEGER         3      0
test2        FLOAT           25      2

So instead of me parsing this info, it can be parsed by SQLite engine.

I understand that for the reason of backward compatibility it will not
be changed,
but it may be something to consider for the next major release (SQLite4).

Thank you.

>
> and get back to us if you have further questions.
>
> Simon.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to