2017-01-23 23:20 GMT+01:00 Ben Newberg <ben.newb...@gmail.com>:

> what i've done in the past is append a character to the value and make use
> of "cast":
>
> ​​
> update desktops set indexNo = indexNo || '_';
> update desktops set indexNo = cast(indexNo as integer) + 1;
>
> then:
> insert into desktops values (new row with index = 1);
>
> from the docs, which i hope i'm not misreading:
>
> http://sqlite.org/lang_expr.html#castexpr
> "When casting a TEXT value to INTEGER, the longest possible prefix of the
> value that can be interpreted as an integer number is extracted from the
> TEXT value and the remainder ignored."
>
> has worked for me for years but ymmv
>

​It looks very promising. Would also be very useful when the order is
changed. One strange quirk: the first statement does not work in
sqlitebrowser, but the second does. The first does work in the commandline
tool.

When I am building my GUI I am going to play with it.


The program I am using this table:

https://github.com/CecilWesterhof/PythonScripts/blob/master/startPrograms.py
​


-- 
Cecil Westerhof
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to