sqlite_unbuffered_query

SQLiteDatabase::unbufferedQuery

(PHP 5 < 5.4.0, PECL sqlite >= 1.0.0)

sqlite_unbuffered_query -- SQLiteDatabase::unbufferedQueryExecute a query that does not prefetch and buffer all data

설명

resource sqlite_unbuffered_query ( resource $dbhandle , string $query [, int $result_type = SQLITE_BOTH [, string &$error_msg ]] )
resource sqlite_unbuffered_query ( string $query , resource $dbhandle [, int $result_type = SQLITE_BOTH [, string &$error_msg ]] )

객체 기반 형식 (method):

public SQLiteUnbuffered SQLiteDatabase::unbufferedQuery ( string $query [, int $result_type = SQLITE_BOTH [, string &$error_msg ]] )

sqlite_unbuffered_query() is identical to sqlite_query() except that the result that is returned is a sequential forward-only result set that can only be used to read each row, one after the other.

This function is ideal for generating things such as HTML tables where you only need to process one row at a time and don't need to randomly access the row data.

Note:

Functions such as sqlite_seek(), sqlite_rewind(), sqlite_next(), sqlite_current(), and sqlite_num_rows() do not work on result handles returned from sqlite_unbuffered_query().

인수

dbhandle

The SQLite Database resource; returned from sqlite_open() when used procedurally. This parameter is not required when using the object-oriented method.

query

The query to be executed.

Data inside the query should be properly escaped.

result_type

선택적인 result_type 인수는 반환하는 배열이 어떤 형식일지에 대한 대한 상수를 받습니다. SQLITE_ASSOC를 사용하면 연상배열(이름 필드)로 반환합니다. SQLITE_NUM은 수치배열(순차적인 필드 번호)를 반환합니다. SQLITE_BOTH는 연상 및 수치를 동시에 반환합니다. SQLITE_BOTH가 기본값입니다.

error_msg

The specified variable will be filled if an error occurs. This is specially important because SQL syntax errors can't be fetched using the sqlite_last_error() function.

Note: (MySQL 같은) 다른 데이터베이스 확장과 호환성을 유지하기 위하여 두가지 다른 형식의 문법을 지원합니다. 권장하는 방식은 dbhandle 인수를 함수의 첫번째 인수로 사용하는 것입니다.

반환값

Returns a result handle실패 시 FALSE를 반환합니다.

sqlite_unbuffered_query() returns a sequential forward-only result set that can only be used to read each row, one after the other.

변경점

버전 설명
5.1.0 Added the error_msg parameter

참고

  • sqlite_query() - Executes a query against a given database and returns a result handle

add a note add a note

User Contributed Notes 1 note

up
0
radley25 at spamcop net
20 years ago
Always use this over the sqlite_fetch_* functions if possible as it's much faster.
To Top