- $db = wfGetDB( ( $flags & self::READ_LATEST ) ? DB_MASTER : DB_SLAVE );
- $options = ( ( $flags & self::READ_LOCKING ) == self::READ_LOCKING )
- ? [ 'LOCK IN SHARE MODE' ]
- : [];
+ list( $index, $options ) = DBAccessObjectUtils::getDBOptions( $flags );
+ $db = wfGetDB( $index );