Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5958035
SqliteResultWrapper.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
SqliteResultWrapper.php
View Options
<?php
namespace
Wikimedia\Rdbms
;
use
ArrayIterator
;
use
PDO
;
use
PDOStatement
;
class
SqliteResultWrapper
extends
ResultWrapper
{
/** @var PDOStatement|null */
private
$result
;
/** @var ArrayIterator|null */
private
$rows
;
/**
* @internal
* @param PDOStatement $result
*/
public
function
__construct
(
PDOStatement
$result
)
{
$this
->
result
=
$result
;
// SQLite doesn't allow buffered results or data seeking etc, so we'll
// use fetchAll. PDO has PDO::CURSOR_SCROLL but the SQLite C API doesn't
// support it, so the driver raises an error if it is used.
$this
->
rows
=
$result
->
fetchAll
(
PDO
::
FETCH_OBJ
);
}
protected
function
doNumRows
()
{
return
count
(
$this
->
rows
);
}
protected
function
doFetchObject
()
{
return
$this
->
rows
[
$this
->
currentPos
]
??
false
;
}
protected
function
doFetchRow
()
{
$obj
=
$this
->
doFetchObject
();
if
(
is_object
(
$obj
)
)
{
$i
=
0
;
$row
=
get_object_vars
(
$obj
);
foreach
(
$row
as
$value
)
{
$row
[
$i
++]
=
$value
;
}
return
$row
;
}
else
{
return
$obj
;
}
}
protected
function
doSeek
(
$pos
)
{
// Nothing to do -- parent updates $this->currentPos
}
protected
function
doFree
()
{
$this
->
rows
=
null
;
$this
->
result
=
null
;
}
protected
function
doGetFieldNames
()
{
if
(
$this
->
rows
)
{
return
array_keys
(
get_object_vars
(
$this
->
rows
[
0
]
)
);
}
else
{
return
[];
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 05:31 (2 w, 5 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
4b/81/a5546b7b1d41f78b6fce8f87e1da
Default Alt Text
SqliteResultWrapper.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment