Re: [sqlite] Can I recursively concatenate strings?

2017-11-23 Thread Shane Dev
> > > PS: If you do like the SQlite features and CTEs (which is one of my > favourite additions ever), I could post you the CTE example tutorials made > to accompany an sqlite DB manager (which I made very long ago, after the > introduction in 3.8 I think) - they have some nifty stuff, like

Re: [sqlite] Can I recursively concatenate strings?

2017-11-23 Thread R Smith
On 2017/11/23 10:15 PM, Shane Dev wrote: Perfect! I guessed this could be achieved with a recursive CTE but I could not find one that would produce my desired view. Your CTE is simply a table of strings keyed by the length and then you join it with the stringlengths table to create the final

Re: [sqlite] Can I recursively concatenate strings?

2017-11-23 Thread Shane Dev
Perfect! I guessed this could be achieved with a recursive CTE but I could not find one that would produce my desired view. Your CTE is simply a table of strings keyed by the length and then you join it with the stringlengths table to create the final view. Thanks On 22 November 2017 at 23:55, R

Re: [sqlite] Can I recursively concatenate strings?

2017-11-22 Thread petern
Shane. printf() will pad spaces you can replace with 'x' or whatever. WITH lengths(id,l) AS (VALUES (1,4),(2,1),(3,9)) SELECT id,l,replace(printf('%'||l||'s'),' ','x')mask FROM lengths; id,l,mask 1,4, 2,1,x 3,9,x If printf() weren't available, it would be worth the effort to add

Re: [sqlite] Can I recursively concatenate strings?

2017-11-22 Thread Simon Slavin
On 22 Nov 2017, at 9:56pm, Shane Dev wrote: > P.S I know that substr('x', 1, stringlengths.length) would work in > this particular case but then I must know maximum value of > stringlengths.length at the point of time when I construct the query. Is > there a more

Re: [sqlite] Can I recursively concatenate strings?

2017-11-22 Thread R Smith
On 2017/11/22 11:56 PM, Shane Dev wrote: Let's say I have a table of stringlengths - sqlite>select * from stringlengths; length 4 1 9 ... Can I create a view xstrings containing strings (for example of char 'x') with the lengths specified in stringlengths? Pretty easily:   -- SQLite

[sqlite] Can I recursively concatenate strings?

2017-11-22 Thread Shane Dev
Let's say I have a table of stringlengths - sqlite>select * from stringlengths; length 4 1 9 ... Can I create a view xstrings containing strings (for example of char 'x') with the lengths specified in stringlengths? desired result - sqlite>select * from xstrings; string x ...