Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F101485322
HarbormasterString.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Feb 10, 22:14
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Feb 12, 22:14 (2 d)
Engine
blob
Format
Raw Data
Handle
24161668
Attached To
rPH Phabricator
HarbormasterString.php
View Options
<?php
final
class
HarbormasterString
extends
HarbormasterDAO
{
protected
$stringIndex
;
protected
$stringValue
;
protected
function
getConfiguration
()
{
return
array
(
self
::
CONFIG_TIMESTAMPS
=>
false
,
self
::
CONFIG_COLUMN_SCHEMA
=>
array
(
'stringIndex'
=>
'bytes12'
,
'stringValue'
=>
'text'
,
),
self
::
CONFIG_KEY_SCHEMA
=>
array
(
'key_string'
=>
array
(
'columns'
=>
array
(
'stringIndex'
),
'unique'
=>
true
,
),
),
)
+
parent
::
getConfiguration
();
}
public
static
function
newIndex
(
$string
)
{
$index
=
PhabricatorHash
::
digestForIndex
(
$string
);
$table
=
new
self
();
$conn
=
$table
->
establishConnection
(
'w'
);
queryfx
(
$conn
,
'INSERT IGNORE INTO %R (stringIndex, stringValue) VALUES (%s, %s)'
,
$table
,
$index
,
$string
);
return
$index
;
}
public
static
function
newIndexMap
(
array
$indexes
)
{
$table
=
new
self
();
$conn
=
$table
->
establishConnection
(
'r'
);
$rows
=
queryfx_all
(
$conn
,
'SELECT stringIndex, stringValue FROM %R WHERE stringIndex IN (%Ls)'
,
$table
,
$indexes
);
return
ipull
(
$rows
,
'stringValue'
,
'stringIndex'
);
}
}
Event Timeline
Log In to Comment