Bu pg_send_query()
başarıyla geri engelleme modu için bağlantıyı geçmek mümkün olmayan bir belirtisidir. PHPs pgsql.c kaynak koduna baktığımızda, şunları bulabilirsiniz:
/* {{{ proto bool pg_send_query(resource connection, string query)
Send asynchronous query */
PHP_FUNCTION(pg_send_query)
{
<... snipped function setup stuff ...>
if (PQ_SETNONBLOCKING(pgsql, 1)) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to nonblocking mode");
RETURN_FALSE;
}
<... snipped main function execution stuff ...>
if (PQ_SETNONBLOCKING(pgsql, 0)) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to blocking mode");
}
RETURN_TRUE;
}
Ana çalışma yapıldıktan sonra Yani hata fonksiyonunun sonunda gündeme alır. Bu INSERT deyimleri idam olsun sizin gözlem ile uyuyor.
Iki PQ_SETNONBLOCKING
bütün amacı uyumsuz yürütme ve sonrasında davranışları engelleme varsayılan geri koyarak izin dışı engelleme modunda bağlantıyı koymaktır çağırır. Dan documentation of PQsetnonblocking: (PQ_SETNONBLOCKING o işlev için tanımlanmış sadece bir takma isimdir):
Sets the nonblocking status of the
connection.
int PQsetnonblocking(PGconn *conn, int arg);
Sets the state of the connection to nonblocking if arg is 1,
or blocking if arg is 0. Returns 0 if
OK, -1 if error.
In the nonblocking state, calls to
PQsendQuery, PQputline, PQputnbytes,
and PQendcopy will not block but
instead return an error if they need
to be called again.
Note that PQexec does not honor
nonblocking mode; if it is called, it
will act in blocking fashion anyway.
(PostgeSQLs fe-exec.c in) PQsetnonblocking kaynağında ayrıca baktığımızda, çağrı başarısız olabilir neden iki olası nedeni vardır:
/* PQsetnonblocking:
* sets the PGconn's database connection non-blocking if the arg is TRUE
* or makes it non-blocking if the arg is FALSE, this will not protect
* you from PQexec(), you'll only be safe when using the non-blocking API.
* Needs to be called only on a connected database connection.
*/
int
PQsetnonblocking(PGconn *conn, int arg)
{
bool barg;
if (!conn || conn->status == CONNECTION_BAD)
return -1;
barg = (arg ? TRUE : FALSE);
/* early out if the socket is already in the state requested */
if (barg == conn->nonblocking)
return 0;
/*
* to guarantee constancy for flushing/query/result-polling behavior we
* need to flush the send queue at this point in order to guarantee proper
* behavior. this is ok because either they are making a transition _from_
* or _to_ blocking mode, either way we can block them.
*/
/* if we are going from blocking to non-blocking flush here */
if (pqFlush(conn))
return -1;
conn->nonblocking = barg;
return 0;
}
Yani bağlantı ya bir şekilde kayboldu, ya da pqFlush bağlantı çıktı tamponunda artık şeyler gösteren, başarılı bir şekilde bitirmek vermedi.
Script kesinlikle sonraki aramalar için kayıp bağlantıyı fark ve bu tepki (veya daha fazla fark başarısız) gibi ilk vaka, zararsız olacaktır.
Bu non varsayılan olmayan engelleme durumundaki bir bağlantı var demektir ikinci durumda bırakır. Bu bağlantıyı yeniden kullanıyorlardı daha sonra aramaları etkileyebilir eğer ben bilmiyorum. Bunu güvenli oynamak istiyorsanız, bu durumda bağlantısını kapatın ve bir diğer yeni / kullanmak istiyorum.