[PHP-users 14800]Re: [PHP-users14665]PEARでクエリが実行されるときとされない時がある

sorako yamamoto sorako_yamamoto @ hotmail.com
2003年 4月 23日 (水) 02:03:06 JST


こんにちは。
返信の方遅くなってしまいました。

Setoさん、Mashikiさん、ご回答の程ありがとうございます。

1.タイミングによって、画面(test.php)にDBの結果配列が表示されたり、エラーとな
る。
2.submitボタンで、他の画面(test2.php)にとび、SQLを実行すると必ずエラーにな
る。

質問内容は以上の通りでしたが、Mashikiさんにご助言を頂いた通り、

> 何が起きているか想像がつかないのであれば、
> 
>        $objCon->setErrorHandling(  );
> 
> の行を一時的にコメントアウトしておき、
> 
> 	$objRs = $objCon->query( $sQuery );
> 
> の戻り値を調べ、DB_RESULTオブジェクトでない場合、
> print_r($objCon)とprint_r($objRs)を表示してみては
> いかがでしょうか。
> 
 
print_r($objCon)とprint_r($objRs)で表示してみました。

2はテーブルに権限が無かったため、エラーとなっていたので簡単に解決しました。

問題は1の方です。
画面を表示するととても頻繁に(3〜4回に1回くらい)エラーとなってしまいます。

$objConと$objRsの戻り値は以下のとおりです。
DB側に問題があるのか、PHPと連携させたときに問題があるのか、PEARに問題がある
のか
良く分からなくなって、パニックになっています。
そろそろ締め切りも近づいているのに…
(まあ、社内使用のものなのですが…
こんな頻繁にエラーが発生するのでは、とても実稼動できません…)
どなたか、原因・解決方法等小さなことでもよいのでアドバイスお願いします。


// 社員名一覧を取得した場合。
// SQL:
//[SELECT name, emp_no FROM tbl_users WHERE retire_flg != 1 ORDER BY emp_no 
;]

/*********
  NG
**********/
// print_r($this->db) ;
db_pgsql Object 
( [connection] => Resource id #27 
[phptype] => pgsql [dbsyntax] => pgsql [prepare_tokens] => Array ( )
[prepare_types] => Array ( ) 
[transaction_opcount] => 0 
[dsn] => Array ( 
[phptype] => pgsql 
[dbsyntax] => pgsql 
[username] => 
[password] => 
[protocol] => unix 
[hostspec] => 
[port] => 
[socket] => 
[database] => intraTest 
) 
[row] => Array ( ) 
[num_rows] => Array ( ) 
[affected] => 0 
[autocommit] => 1 
[fetchmode] => 1 
[_debug] => 
[_default_error_mode] => 
[_default_error_options] => 
[_default_error_handler] => 
[_error_class] => DB_Error 
[_expected_errors] => Array ( ) 
[features] => Array ( [prepare] => [pconnect] => 1 [transactions] => 1 
[limit] => alter ) 
[errorcode_map] => Array ( ) 
[type] => 
[prepared_queries] => 
[prepare_maxstmt] => 0 
[last_query] => SELECT name, emp_no FROM tbl_users WHERE retire_flg != 1 
ORDER BY emp_no 
[fetchmode_object_class] => stdClass 
[options] => Array ( 
[persistent] => 1 
[optimize] => performance 
[debug] => 0 
[seqname_format] => %s_seq 
[autofree] => ) 
[dbh] => ) 

// print_r($objRs) ;
db_error Object ( 
[error_message_prefix] => 
[mode] => 1 
[level] => 1024 
[code] => -1 
[message] => DB Error: unknown error 
[userinfo] => SELECT name, emp_no FROM tbl_users WHERE retire_flg != 1 
ORDER BY emp_no 
[nativecode=ERROR: current transaction is aborted, queries ignored until 
end of transaction block ] [callback] => ) 



/*********
  OK
**********/
//print_r($this->db) ;
db_pgsql Object 
( [connection] => Resource id #27 
[phptype] => pgsql 
[dbsyntax] => pgsql 
[prepare_tokens] => Array ( ) 
[prepare_types] => Array ( ) 
[transaction_opcount] => 0 
[dsn] => Array ( 
[phptype] => pgsql 
[dbsyntax] => pgsql 
[username] => 
[password] => 
[protocol] => unix 
[hostspec] => 
[port] => 
[socket] => 
[database] => intraTest ) 
[row] => Array ( [30] => 0 ) 
[num_rows] => Array ( [30] => 6 ) 
[affected] => 0 
[autocommit] => 1 
[fetchmode] => 1 
[_debug] => 
[_default_error_mode] => 
[_default_error_options] => 
[_default_error_handler] => 
[_error_class] => DB_Error 
[_expected_errors] => Array ( ) 
[features] => Array ( 
[prepare] => 
[pconnect] => 1 
[transactions] => 1 
[limit] => alter ) 
[errorcode_map] => Array ( ) 
[type] => 
[prepared_queries] => 
[prepare_maxstmt] => 0 
[last_query] => SELECT name, emp_no FROM tbl_users WHERE retire_flg != 1 
ORDER BY emp_no 
[fetchmode_object_class] => stdClass 
[options] => Array ( 
[persistent] => 1 
[optimize] => performance 
[debug] => 0 
[seqname_format] => %s_seq 
[autofree] => ) 
[dbh] => ) 

//print_r($objRs) ;
db_result Object ( 
[dbh] => db_pgsql Object ( 
[connection] => Resource id #27 
[phptype] => pgsql 
[dbsyntax] => pgsql 
[prepare_tokens] => Array ( ) 
[prepare_types] => Array ( ) 
[transaction_opcount] => 0 
[dsn] => Array ( 
[phptype] => pgsql 
[dbsyntax] => pgsql 
[username] => 
[password] => 
[protocol] => unix 
[hostspec] => 
[port] => 
[socket] => 
[database] => intraTest ) 
[row] => Array ( [30] => 0 ) 
[num_rows] => Array ( [30] => 6 ) 
[affected] => 0 
[autocommit] => 1 
[fetchmode] => 1 
[_debug] => 
[_default_error_mode] => 
[_default_error_options] => 
[_default_error_handler] => 
[_error_class] => DB_Error 
[_expected_errors] => Array ( ) 
[features] => Array ( 
[prepare] => 
[pconnect] => 1 
[transactions] => 1 
[limit] => alter ) 
[errorcode_map] => Array ( ) 
[type] => 
[prepared_queries] => 
[prepare_maxstmt] => 0 
[last_query] => SELECT name, emp_no FROM tbl_users WHERE retire_flg != 1 
ORDER BY emp_no 
[fetchmode_object_class] => stdClass 
[options] => Array ( 
[persistent] => 1 
[optimize] => performance 
[debug] => 0 
[seqname_format] => %s_seq 
[autofree] => ) 
[dbh] => ) 
[result] => Resource id #30 
[row_counter] => 
[limit_from] => 
[limit_count] => 
[limit_type] => alter 
[autofree] => 
[fetchmode] => 1 
[fetchmode_object_class] => stdClass ) 






_________________________________________________________________
会員登録は無料  充実した出品アイテムなら MSN オークション   
http://auction.msn.co.jp/  



PHP-users メーリングリストの案内