cubrid_lob2_read
(PECL CUBRID >= 8.4.1)
cubrid_lob2_read - BLOB / CLOB 데이터 읽기
설명
cubrid_lob2_read(resource $lob_identifier
, int $len
): string
cubrid_lob2_read() 함수는 LOB 데이터에서 len
바이트를 읽어 읽은 바이트를 반환한다.
매개변수
lob_identifier
- cubrid_lob2_new()의 결과인 Lob 식별자 또는 결과 집합에서 가져옵니다.
len
- lob 데이터에서 읽으려는 버퍼의 길이입니다.
반환 값
내용을 문자열로 반환하고 더 이상 데이터가 없으면 false
를 반환하고 실패하면 null
을 반환합니다.
Examples
예제 #1 cubrid_lob2_read() 예제1
<?php
// test_lob (id INT, contents CLOB)
$conn = cubrid_connect("localhost", 33000, "demodb", "public", "");
$req = cubrid_execute($conn, "select * from test_lob");
$row = cubrid_fetch_row($req, CUBRID_LOB);
print "position now is " . cubrid_lob2_tell($row[1]) . "\n";
cubrid_lob2_seek($row[1], 10, CUBRID_CURSOR_FIRST);
print "\nposition after moving farword is " . cubrid_lob2_tell($row[1]) . "\n";
$data = cubrid_lob2_read($row[1], 12);
print "\nposition after reading is " . cubrid_lob2_tell($row[1]) . "\n";
print $data . "\n";
cubrid_lob2_seek($row[1], 5, CUBRID_CURSOR_CURRENT);
print "\nposition after moving again is " . cubrid_lob2_tell($row[1]) . "\n";
$data = cubrid_lob2_read($row[1], 20);
print $data . "\n";
cubrid_disconnect($conn);
?>
예제 #2 cubrid_lob2_read() 예제2
<?php
// test_lob (id INT, contents CLOB)
$conn = cubrid_connect("localhost", 33000, "demodb", "dba", "");
$req = cubrid_execute($conn, "select * from test_lob");
$row = cubrid_fetch_row($req, CUBRID_LOB);
while (true) {
if ($data = cubrid_lob2_read($row[1], 1024)) {
print $data . "\n";
}
elseif ($data === false) {
print "There is no more data\n";
break;
}
else {
print "There must some errors\n";
break;
}
}
cubrid_disconnect($conn);
?>
기타
- cubrid_lob2_write() - lob 객체에 쓰기
- cubrid_lob2_seek() - lob 개체의 커서 이동
- cubrid_lob2_seek64() - lob 개체의 커서 이동
- cubrid_lob2_tell() - LOB 객체의 커서 위치를 알려줍니다.
- cubrid_lob2_tell64() - LOB 객체의 커서 위치를 알려줍니다.
- cubrid_lob2_size() - lob 객체의 크기 가져오기
- cubrid_lob2_size64() - lob 객체의 크기 가져오기