Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F112219331
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
Fri, May 9, 00:53
Size
1 KB
Mime Type
text/x-php
Expires
Sun, May 11, 00:53 (2 d)
Engine
blob
Format
Raw Data
Handle
26055893
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