=?iso-2022-jp?b?W3BncG9vbC1nZW5lcmFsLWpwOiA2NzRdIFJlOiBwZ3Bvb2wb?= =?iso-2022-jp?b?JEItNhsoQi0yLjMuMRskQiRHJE4lKCVpITwlYSVDJTshPCU4GyhCKHBv?= =?iso-2022-jp?b?cnRhbCAiIiBkb2VzIG5vdCBleGlzdCkbJEIkSyREJCQkRhsoQg==?=

皿海 太二朗 saragai @ mbgx.tis.co.jp
2010年 1月 15日 (金) 09:51:54 JST


$B @ PEDMM(B

$B;.3$$G$9!#(B

$B$4BP1~$"$j$,$H$&$4$6$$$^$7$?!#(B
$B$$$?$@$$$?(Bpool_timestamp.c$B$N2~=$$K$F!"(B
$B;d$I$b$N4D6-$G$b!";v>]$OH/@8$7$J$/$J$j$^$7$?!#(B

$B$"$j$,$H$&$4$6$$$^$7$?!#(B

$B$J$*!"$3$&$$$C$?%P%0$O<!%P!<%8%g%s(B(2.3.2$B0J9_(B)$B$G(B
FIX$B$5$l$F$$$k$b$N$J$N$G$7$g$&$+!#(B


ISHIDA Akio $B$5$s$O=q$-$^$7$?(B:
> $B @ PED$G$9!#=$@5$7$F$_$^$7$?!#(B
>
> $BK\Ev$O(Bresult format code$BB&$b=$@5$,I,MW$+$b$7$l$^$;$s$,!"(B
> $B8=>u!"NsKh$K(Bresult format code$B$r;XDj$9$k(BAPI$B$,L5$$(B
> $B$i$7$$$N$GLdBjL5$$$H;W$$$^$9!#(B
>
> diff --git a/pool_timestamp.c b/pool_timestamp.c
> index 4aa501d..4e664d5 100644
> --- a/pool_timestamp.c
> +++ b/pool_timestamp.c
> @@ -666,7 +666,8 @@ bind_rewrite_timestamp(POOL_CONNECTION_POOL
> *backend, Portal *portal,
>  		const char *orig_msg, int *len)
>  {
>  	int16		 tmp2,
> -				 num_params;
> +				 num_params,
> +				 num_formats;
>  	int32		 tmp4;
>  	int			 i,
>  				 ts_len,
> @@ -686,7 +687,7 @@ bind_rewrite_timestamp(POOL_CONNECTION_POOL
> *backend, Portal *portal,
>  	ts_len = strlen(ts);
>
>  	*len += (strlen(ts) + sizeof(int32)) * portal->num_tsparams;
> -	new_msg = copy_to = (char *) malloc(*len);
> +	new_msg = copy_to = (char *) malloc(*len + portal->num_tsparams *
> sizeof(int16));
>  	copy_from = orig_msg;
>
>  	/* portal_name */
> @@ -702,11 +703,29 @@ bind_rewrite_timestamp(POOL_CONNECTION_POOL
> *backend, Portal *portal,
>  	/* format code */
>  	memcpy(&tmp2, copy_from, sizeof(int16));
>  	copy_len = sizeof(int16);
> -	tmp2 = ntohs(tmp2);
> -	copy_len += tmp2 * sizeof(int16);
> +	tmp2 = num_formats = ntohs(tmp2);
> +
> +	if (num_formats > 1)
> +	{
> +		/* enlarge message length */
> +		*len += portal->num_tsparams * sizeof(int16);
> +		tmp2 += portal->num_tsparams;
> +	}
> +	tmp2 = htons(tmp2);
> +	memcpy(copy_to, &tmp2, copy_len);
> +	copy_to += copy_len; copy_from += copy_len;
> +
> +	copy_len = num_formats * sizeof(int16);
>  	memcpy(copy_to, copy_from, copy_len);
>  	copy_to += copy_len; copy_from += copy_len;
>
> +	if (num_formats > 1)
> +	{
> +		/* set format codes to zero(text) */
> +		memset(copy_to, 0, portal->num_tsparams * 2);
> +		copy_to += sizeof(int16) * portal->num_tsparams;
> +	}
> +
>  	/* num params */
>  	memcpy(&tmp2, copy_from, sizeof(int16));
>  	copy_len = sizeof(int16);
>
>
> 2010$BG/(B1$B7n(B12$BF|(B19:03 ISHIDA Akio <iakio @ mono-space.net>:
>   
>> $B$3$s$K$A$O!#@PED(B@$BFQ>.KR;T$H?=$7$^$9!#(B
>>
>> 2010$BG/(B1$B7n(B7$BF|(B22:04 $B;.3$!!B @ FsO/(B <saragai @ mbgx.tis.co.jp>:
>>     
>>> $B;.3$(B($B%5%i%,%$(B)$B$H?=$7$^$9!#(B
>>> $BD9J8$H$J$j?=$7Lu$4$6$$$^$;$s$,!"$43NG'$$$?$@$1$^$;$s$G$7$g$&$+!#(B
>>>
>>> pgpool$B-6(B-2.3.1$B$,%j%j!<%9$5$l$?$H$*J9$-$7!"(B
>>> pgpool$B-6(B-2.2.6$B$+$i(B2.3.1$B$X%P!<%8%g%s%"%C%WCW$7$^$7$?!#(B
>>>
>>> $B$=$3$G!"(Boperatioin_log$B$H$$$&%F!<%V%k$KBP$7!"(B
>>> $B0J2<$N(BSQL$B$r<B9T$7$?:]$K!"(Bpostgresql$B$N%m%0$K%(%i!<$,=PNO$5$l$F$*$j$^$9!#(B
>>>
>>> $B!Z<B9T(BSQL$BJ8![(B
>>> $sql = 'insert into operation_log
>>> (session_id,user_id,event_date,log_text,user_name) values
>>> (:session,12345,NOW(),:log,:user)';
>>> $stmt = $dbh->prepare($sql);
>>> $stmt->bindValue(':session', 'shimada_test');
>>> $stmt->bindValue(':log', '20100107$B%F%9%H(B');
>>> $stmt->bindValue(':user', '20100107$BEgED(B');
>>> $flag = $stmt->execute();
>>>
>>> $B!Z(Bpostgresql$B%5!<%P%m%0(B($B%P%C%/%(%s%I%5!<%P$bF1MM$N%m%0M-(B)$B![(B
>>> 2010-01-07 15:40:22 JST:17216 ERROR: bind message has 3 parameter
>>> formats but 4 parameters
>>> 2010-01-07 15:40:22 JST:17216 STATEMENT: INSERT INTO
>>> "operation_log"("session_id", "user_id", "event_date", "log_text",
>>> "user_name") VALUES ($1,12345,"timestamptz"($4::text),$2,$3)
>>> 2010-01-07 15:40:22 JST:17216 ERROR: portal "" does not exist
>>> 2010-01-07 15:40:22 JST:17216 ERROR: portal "" does not exist
>>>
>>> $B$3$A$i!"(Bnow()$B4X?t$r(B"timestamptz"($4::text)$B$KJQ49$7$F(BINSERT$B$9$k$3$H$K$h$k(B
>>> $B%(%i!<$G$"$k$H9M$($F$*$j$^$9!#(B
>>>
>>> $B;v>]$NH/@8860x$O(Bpgpool$B$N%P!<%8%g%s%"%C%W$K$h$k$b$N$H(B
>>> $B9M$($F$*$j!"%P%0$N5?$$$b$"$k$H9M$($F$*$j860x$rD4::$$$?$@$/$3$H$O2DG=$G(B
>>> $B$7$g$&$+!#(B
>>>
>>>       
>> $B$O$$!#(Bpgpool$B$N%P%0$G$9!#$9$$$^$;$s8+Mn$H$7$F$^$7$?!#(B
>>
>> $B>e$N%3!<%I$O(BPHP$B$N(BPDO$B$K$h$k$b$N$H;W$$$^$9$,!"(B
>> - $B%?%$%`%9%?%s%W$N=q$-49$($,H/@8$9$k%1!<%9$G(B
>> - PQprepare$B$J$I$G(BparamFormats$B$r;XDj$5$l$?>l9g$G!"(B
>> - $B85$N%/%(%j$K(B2$B$D0J>e$N%Q%i%a!<%?$,B8:_$9$k>l9g$K(B
>> $BH/@8$9$k$h$&$G$9!#(B
>>
>> $B$H$j$"$($:$4Js9p$^$G!#(B
>> $B=$@5$K$O$b$&>/!9$*;~4V$r$/$@$5$$!#(B
>>
>>
>>     
>>> $B$J$*>e5-$N%(%i!<$O!"(Bpostgres$B%5!<%P$KD>@\@\B3$7!"(B
>>> SQL$BJ8$r<B9T$7$?>l9g$K$O=PNO$5$l$^$;$s!#(B
>>>
>>> $BB>$N>pJs$K$D$$$F$O0J2<$NDL$j$G$9!#(B
>>> //$B!Z%F!<%V%k$N%+%i%`Dj5A![(B
>>> publis=# \d operation_log
>>> Table "public.operation_log"
>>> Column | Type | Modifiers
>>> ---------------------+--------------------------+---------------
>>> page_id | integer |
>>> share_id | integer |
>>> article_id | integer |
>>> block_id | integer |
>>> function_block_type | smallint |
>>> session_id | character varying(4000) |
>>> user_id | integer |
>>> event_date | timestamp with time zone | default now()
>>> log_text | character varying(4000) |
>>> title | character varying(4000) |
>>> user_name | character varying(4000) |
>>> Indexes:
>>> "operation_log_event_idx" btree (event_date)
>>> "operation_log_page_idx" btree (page_id, article_id, block_id)
>>> "operation_log_share_idx" btree (share_id)
>>>
>>> $B!Z(Bpostgresql$B$N%P!<%8%g%s![(B
>>> 8.3.7
>>>
>>> $B0J>e!"$h$m$7$/$*4j$$CW$7$^$9!#(B
>>>
>>> _______________________________________________
>>> pgpool-general-jp mailing list
>>> pgpool-general-jp @ sraoss.jp
>>> http://www.sraoss.jp/mailman/listinfo/pgpool-general-jp
>>>
>>>
>>>       
>>
>> --
>> ISHIDA Akio <iakio @ mono-space.net/ishida @ cycleof5th.com>
>>
>>     
>
>
>
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> pgpool-general-jp mailing list
> pgpool-general-jp @ sraoss.jp
> http://www.sraoss.jp/mailman/listinfo/pgpool-general-jp
>   



pgpool-general-jp メーリングリストの案内