Update for DB::IO
DB/SQL/Pgsql: add __dbConnectionBusySocketWait for testing with loop type and socket check wait loop for async queries. (TODO) add parameter query method to supplement current normal query only function DB/IO: Make all class variables private and add needed methods to read them. Also add method for reset query in case for new calls. db error/warnings are written to proper history file with timestamp, source, etc. Update source (where called) to show the whole method stack. Move connection OK to method to easy switch to different connection open for queries check type. Never use method variable query, instead only use method parameter and error out on not set. All core calls reset errors and set error hash id for history. Bug fix for insert data return array and reset said array every time a query execution is started and not only if we have some return data to avoid having wrong (previous query) data for a new query. Add more error info to all erros where a separate db logging call was done.: ACL/Login: Do not access DB IO cursor variable directly but use method to read data. Fixes change for hash type
This commit is contained in:
@@ -493,10 +493,10 @@ class PgSQL
|
||||
/**
|
||||
* wrapper for pg_meta_data
|
||||
* @param string $table table name
|
||||
* @param bool $extended show extended info (default false)
|
||||
* @param bool $extended show extended info (default true)
|
||||
* @return array<mixed>|bool array data for the table info or false on error
|
||||
*/
|
||||
public function __dbMetaData(string $table, $extended = false)
|
||||
public function __dbMetaData(string $table, $extended = true)
|
||||
{
|
||||
if ($this->dbh === false || is_bool($this->dbh)) {
|
||||
return false;
|
||||
@@ -572,6 +572,25 @@ class PgSQL
|
||||
return pg_connection_busy($this->dbh);
|
||||
}
|
||||
|
||||
/**
|
||||
* Experimental wrapper with scoket timetout
|
||||
* @param integer $timeout_seconds Wait how many seconds on timeout
|
||||
* @return boolean
|
||||
*/
|
||||
public function __dbConnectionBusySocketWait(int $timeout_seconds = 3): bool
|
||||
{
|
||||
if ($this->dbh === false || is_bool($this->dbh)) {
|
||||
return false;
|
||||
}
|
||||
$busy = pg_connection_busy($this->dbh);
|
||||
$socket = [pg_socket($this->dbh)];
|
||||
while ($busy) {
|
||||
// Will wait on that socket until that happens or the timeout is reached
|
||||
stream_select($socket, null, null, $timeout_seconds);
|
||||
$busy = pg_connection_busy($this->dbh);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* wrapper for pg_version
|
||||
* Note: this only returns server version
|
||||
|
||||
Reference in New Issue
Block a user