Re: [sqlite] printf function is shown in docs but not found when I try it

2014-04-19 Thread Kees Nuyt
n Sat, 19 Apr 2014 10:38:01 +0100, c...@isbd.net wrote:

>Simon Slavin  wrote:
>> 
>> On 18 Apr 2014, at 2:49pm, c...@isbd.net wrote:
>> 
>> > Xubuntu 13.10 (which I'm currently using) has sqlite 3.7.17.
>> > 
>> > Xubuntu 14.04 has sqlite 3.8.2, I'm not sure if they're likely to move
>> > to anything newer during its lifetime. 
>> 
>> If you're writing C or C++ code then you don't need to use something 
>> supplied 
>> with your OS. Just download current amalgamation version files and include 
>> the .h and .c files in your application source code. 
>> 
>No, I'm not running from within C/C++, I'm using sqlite3 databases
>from my wiki (DokuWiki) so it's being accessed using PHP's PDO
>interface.  Can I update *that* to get printf() available within SQL
>queries?

PDO used to have a variant pdo_sqlite3_external (or similar name), which
linked dynamically to a standard sqlite3 library, but that wasn't
supported on all platforms (don't remember which though).

It was a great solution, because you could upgrade sqlite3 independent
from the PHP release cycle.

I'm afraid it is totally extinct by now, but you might be lucky.

-- 
Groet, Cordialement, Pozdrawiam, Regards,

Kees Nuyt

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


Re: [sqlite] printf function is shown in docs but not found when I try it

2014-04-19 Thread cl
Simon Slavin  wrote:
> 
> On 18 Apr 2014, at 2:49pm, c...@isbd.net wrote:
> 
> > Xubuntu 13.10 (which I'm currently using) has sqlite 3.7.17.
> > 
> > Xubuntu 14.04 has sqlite 3.8.2, I'm not sure if they're likely to move
> > to anything newer during its lifetime. 
> 
> If you're writing C or C++ code then you don't need to use something supplied 
> with your OS. Just download current amalgamation version files and include 
> the .h and .c files in your application source code. 
> 
No, I'm not running from within C/C++, I'm using sqlite3 databases
from my wiki (DokuWiki) so it's being accessed using PHP's PDO
interface.  Can I update *that* to get printf() available within SQL
queries?

-- 
Chris Green
·

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


Re: [sqlite] printf function is shown in docs but not found when I try it

2014-04-18 Thread Simon Slavin

On 18 Apr 2014, at 2:49pm, c...@isbd.net wrote:

> Xubuntu 13.10 (which I'm currently using) has sqlite 3.7.17.
> 
> Xubuntu 14.04 has sqlite 3.8.2, I'm not sure if they're likely to move
> to anything newer during its lifetime. 

If you're writing C or C++ code then you don't need to use something supplied 
with your OS.  Just download current amalgamation version files and include the 
.h and .c files in your application source code.

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


Re: [sqlite] printf function is shown in docs but not found when I try it

2014-04-18 Thread Andy Goth

On 4/18/2014 8:49 AM, c...@isbd.net wrote:

Alternatively are there any other reasonably practical ways to format
numeric output?  Specifically I want to format floating point numbers
into a fixed format like NNN.N.


Your application can provide custom functions callable from queries.

Tcl example:

$ tclsh
% package require sqlite3
% sqlite3 db :memory:
% db function printf format
% db eval {select printf('%05.1f', 12.3)}
012.3

--
Andy Goth | 
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] printf function is shown in docs but not found when I try it

2014-04-18 Thread cl
Richard Hipp  wrote:
> On Thu, Apr 17, 2014 at 8:03 AM,  wrote:
> 
> > In the documentation at http://www.sqlite.org/lang_corefunc.html
> > there's a printf function, however when I try and use it in sqlite3
> > (on xubuntu 13.10) it says "Error: no such function: printf".
> >
> > Is this because I need to load some extra library to make it work or
> > is it just not available in the version of sqlite3 on Ubuntu, or what?
> >
> > All the other functions in 'core functions' seem to work.
> >
> 
> The printf() function was added for SQLite version 3.8.3.  What version of
> SQLite does xubuntu have installed?

Ah, that explains it, thank you!

Xubuntu 13.10 (which I'm currently using) has sqlite 3.7.17.

Xubuntu 14.04 has sqlite 3.8.2, I'm not sure if they're likely to move
to anything newer during its lifetime.  

I guess I could build/install a newer sqlite on my system.
Alternatively are there any other reasonably practical ways to format
numeric output?  Specifically I want to format floating point numbers
into a fixed format like NNN.N.

-- 
Chris Green
·

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


Re: [sqlite] printf function is shown in docs but not found when I try it

2014-04-18 Thread Richard Hipp
On Thu, Apr 17, 2014 at 8:03 AM,  wrote:

> In the documentation at http://www.sqlite.org/lang_corefunc.html
> there's a printf function, however when I try and use it in sqlite3
> (on xubuntu 13.10) it says "Error: no such function: printf".
>
> Is this because I need to load some extra library to make it work or
> is it just not available in the version of sqlite3 on Ubuntu, or what?
>
> All the other functions in 'core functions' seem to work.
>

The printf() function was added for SQLite version 3.8.3.  What version of
SQLite does xubuntu have installed?
-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users