If you are trying to write a single field which is above max_allowed_packet then this function will not help you (contrary to what the documentation example seems to show above).
Parameters in MySQL are still restricted by max_allowed_packet on a per-field basis so you will get an error like:
“mysqli_sql_exception: Parameter of prepared statement which is set through mysql_send_long_data() is longer than 'max_long_data_size' bytes”
The only real use case for this function seems to be if you are writing multiple long fields which when combined would go over max_allowed_packet.mysqli_stmt::send_long_data
Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.
mysqli_stmt::send_long_data
Референца за `mysqli-stmt.send-long-data.php` со подобрена типографија и навигација.
mysqli_stmt::send_long_data
mysqli_stmt_send_long_data
класата mysqli_driver
mysqli_stmt::send_long_data -- mysqli_stmt_send_long_data — Испраќа податоци во блокови
= NULL
Напиши целосна ознака на елемент
Процедурален стил
Allows to send parameter data to the server in pieces (or chunks), e.g. if the size of a blob exceeds the size of max_allowed_packetОвозможува испраќање податоци од параметри до серверот во парчиња (или делови), на пр. ако големината на блоб надминува големина.
Параметри
-
statement објектот како свој прв аргумент. mysqli_stmt Само процедурален стил: А mysqli_stmt_init().
param_num-
Го означува параметарот со кој треба да се поврзат податоците. Параметрите се нумерирани почнувајќи од 0.
data-
Низа што содржи податоци што треба да се испратат.
Вратени вредности
Патеката до PHP скриптата што треба да се провери. true на успех или false при неуспех.
Примери
Пример #1 Обектно-ориентиран стил
<?php
$stmt = $mysqli->prepare("INSERT INTO messages (message) VALUES (?)");
$null = NULL;
$stmt->bind_param("b", $null);
$fp = fopen("messages.txt", "r");
while (!feof($fp)) {
$stmt->send_long_data(0, fread($fp, 8192));
}
fclose($fp);
$stmt->execute();
?>Види Исто така
- mysqli_prepare() - Подготвува SQL израз за извршување
- mysqli_stmt_bind_param() mysqli::prepare()
Белешки од корисници 3 белешки
Just in case:
'max_allowed_packet' is a MySQL variable; it is not a PHP function/variable/constant.
Further info: http://dev.mysql.com/doc/refman/4.1/en/packet-too-large.html
HTH.To ChrisH's note, you must call this function multiple times with the same $param_nr, to send the first max_allowed_packet bytes, then the next, and so on. So you might need to do a for loop over changing substr() indexes, or etc.