ソフト開発塾 |
my $strsql = <<EOT; SELECT naiyou FROM mytb WHERE mailaddr='$mm_mail' EOT my $result = $conn->exec($strsql); if (PGRES_TUPLES_OK == $result->resultStatus) { $rows = $result->ntuples; if($rows >0){ my $naiyou=$result->getvalue(0,0); } |
$result_status = $result->resultStatus Returns the status of the result. For comparing the status you may use one of the following constants depending upon the command executed: - PGRES_EMPTY_QUERY - PGRES_COMMAND_OK - PGRES_TUPLES_OK - PGRES_COPY_OUT - PGRES_COPY_IN - PGRES_BAD_RESPONSE - PGRES_NONFATAL_ERROR - PGRES_FATAL_ERROR Use the functions below to access the contents of the PGresult structure. $ntuples = $result->ntuples Returns the number of tuples in the query result. $nfields = $result->nfields Returns the number of fields in the query result. $ret = $result->binaryTuples Returns 1 if the tuples in the query result are bianry. $fname = $result->fname($field_num) Returns the field name associated with the given field number. $fnumber = $result->fnumber($field_name) Returns the field number associated with the given field name. $ftype = $result->ftype($field_num) Returns the oid of the type of the given field number. $fsize = $result->fsize($field_num) Returns the size in bytes of the type of the given field number. It returns -1 if the field has a variable length. $fmod = $result->fmod($field_num) Returns the type-specific modification data of the field associated with the given field index. Field indices start at 0. $cmdStatus = $result->cmdStatus Returns the command status of the last query command. In case of DELETE it returns also the number of deleted tuples. In case of INSERT it returns also the OID of the inserted tuple followed by 1 (the number of affected tuples). $oid = $result->oidStatus In case the last query was an INSERT command it returns the oid of the inserted tuple. $oid = $result->cmdTuples In case the last query was an INSERT or DELETE command it returns the number of affected tuples. $value = $result->getvalue($tup_num, $field_num) Returns the value of the given tuple and field. This is a null-terminated ASCII string. Binary cursors will not work. $length = $result->getlength($tup_num, $field_num) Returns the length of the value for a given tuple and field. $null_status = $result->getisnull($tup_num, $field_num) Returns the NULL status for a given tuple and field. |
トップページ ソフト開発塾 前のページへ戻る |