On 2014/03/07 01:59, Gabor Grothendieck wrote:



A small enhancement request:

It would be great if the RPAD and LPAD functions could be implemented in
sqlite.

The SQLite you can get the effect of RPAD(x,y) using PRINTF('%-*s',y,x).
See http://www.sqlite.org/lang_corefunc.html#printf for details.
Thanks, but you snipped the relevant part of my post:
"I know I can easily achieve the equivalent ... but if the functions were available 
natively it would avoid the need to hack third party SQL scripts."

I have also found that it was tedious to retarget MySQL scripts to
SQLite because many of the function calls are different.  Its not just
rpad and lpad but other functions too.

Speaking as someone who retargets (nice word btw.) SQL scripts often, yes I agree, it's a bit of a chore to retarget SQL scripts to SQLite sometimes, but not really moreso than retargeting a script from MSSQL to PostGres or Oracle, or PostGres to MySQL (which btw. doesn't support WITH RECURSIVE at all) etc.[1] To single out the SQLite differences as anything more than standard incompatibility between SQL engines would be... exaggerative. (I just made up that word!) - And still with the bit of incompatibility we need to deal with for a world of clever, trusted and fast querying in an engine that is a fraction the size of anything else, so much so that you can run it on a smart calculator.... hardly a deficit.

Add to this the fact that you can - through SQL's ability to add user-defined functions (an almost unique ability among SQL engines) - add your own RPAD and LPAD functions that work exactly how you envision... you have the power to solve your own problem.

[1]: Yes I know MySQL has other ways to deal with recursion, but the point is that revising the scripts will need a LOT of adjustment to achieve the same, which is the point of this note.


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

Reply via email to