help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: string handling in database-2.0.1 commands


From: richard
Subject: Re: string handling in database-2.0.1 commands
Date: Fri, 22 Feb 2013 18:55:22 +0000
User-agent: Mutt/1.5.20 (2009-06-14)

On Thu, Feb 21, 2013 at 06:47:58PM +0100, Olaf Till wrote:
 
> While constructing strings from Octave valules (with cstrcat or
> better, with sprintf) will work, I'd say the 'preferred' way is to use
> placeholders ($..), as explained in the help-text of pq_exec_params.
> 
> Example:
> 
> data = S.data;
> 
> pq_exec_params (conn, "insert into rome001 (year, l_pay) values ($1, $2);", 
> {data(1, 1), data(1, 2)});
> 
I tried your example, with a slight modification for my test: 
pq_exec_params (conn, "insert into rome001 (year, l_pay, legion_pay, legions, 
Army_pay) values ($1, $2, $3, $4, $5);", {data(1, 1), data(1, 2), data(1, 3), 
data(1, 4), data(1, 5)});
#error: could not determine postgresql type for Octave parameter

I will have a look to see if I can figure out why this error appeared. 

Richard



reply via email to

[Prev in Thread] Current Thread [Next in Thread]