PreparedStatement pstmt = null;
ResultSet rs = null;
try {
- pstmt = connection.prepareStatement("SELECT line_hashes FROM file_sources WHERE file_uuid=? AND data_type='SOURCE'");
+ pstmt = connection.prepareStatement("SELECT line_hashes FROM file_sources WHERE file_uuid=?");
pstmt.setString(1, fileUuid);
rs = pstmt.executeQuery();
if (rs.next()) {
ResultSet rs = null;
Reader reader = null;
try {
- pstmt = connection.prepareStatement("SELECT line_hashes FROM file_sources WHERE file_uuid=? AND data_type='SOURCE'");
+ pstmt = connection.prepareStatement("SELECT line_hashes FROM file_sources WHERE file_uuid=?");
pstmt.setString(1, fileUuid);
rs = pstmt.executeQuery();
if (rs.next()) {
public interface FileSourceMapper {
- List<FileSourceDto> selectHashesForProject(@Param("projectUuid") String projectUuid, @Param("dataType") String dataType);
+ List<FileSourceDto> selectHashesForProject(@Param("projectUuid") String projectUuid);
@CheckForNull
FileSourceDto selectByFileUuid(@Param("fileUuid") String fileUuid);
repeated Line lines = 1;
}
-message Test {
- optional string uuid = 1;
- optional string name = 2;
- optional TestStatus status = 3;
- optional int64 execution_time_ms = 4;
- optional string stacktrace = 5;
- optional string msg = 6;
- repeated CoveredFile covered_file = 7;
-
- message CoveredFile {
- optional string file_uuid = 1;
- repeated int32 covered_line = 2 [packed = true];
- }
-
- enum TestStatus {
- OK = 1;
- FAILURE = 2;
- ERROR = 3;
- SKIPPED = 4;
- }
-}
and p.scope='FIL'
INNER JOIN file_sources fs ON
fs.file_uuid=p.uuid
- and fs.data_type='SOURCE'
where
root.uuid=#{projectUuid,jdbcType=VARCHAR}
</select>
FROM projects p
INNER JOIN file_sources fs ON
fs.file_uuid=p.uuid
- and fs.data_type='SOURCE'
<include refid="modulesTreeQuery"/>
</select>
from projects p
inner join file_sources fs on
fs.file_uuid = p.uuid
- and fs.data_type = 'SOURCE'
where
p.project_uuid = #{projectUuid,jdbcType=VARCHAR}
and p.enabled = ${_true}
file_sources
where
file_uuid = #{fileUuid,jdbcType=VARCHAR}
- and data_type = 'SOURCE'
</select>
<select id="selectHashesForProject" parameterType="map" resultType="org.sonar.db.source.FileSourceDto">
src_hash as srcHash,
revision,
updated_at as updatedAt
- from
+ from
file_sources
where
project_uuid = #{projectUuid,jdbcType=VARCHAR}
- and data_type = 'SOURCE'
</select>
<select id="scrollLineHashes" parameterType="map" resultType="org.sonar.db.source.LineHashesWithUuidDto" fetchSize="${_scrollFetchSize}" resultSetType="FORWARD_ONLY">
from projects p
inner join file_sources fs on
fs.file_uuid = p.uuid
- and fs.data_type = 'SOURCE'
where
p.uuid in
<foreach collection="fileUuids" item="fileUuid" open="(" close=")" separator=",">
file_sources
WHERE
file_uuid = #{fileUuid,jdbcType=VARCHAR}
- and data_type = 'SOURCE'
</select>
<insert id="insert" parameterType="org.sonar.db.source.FileSourceDto" useGeneratedKeys="false">
line_count,
data_hash,
src_hash,
- data_type,
revision
)
values
#{lineCount,jdbcType=INTEGER},
#{dataHash,jdbcType=VARCHAR},
#{srcHash,jdbcType=VARCHAR},
- 'SOURCE',
#{revision,jdbcType=VARCHAR}
)
</insert>
assertThat(fn.result).isNull();
}
- @Test
- public void no_line_hashes_when_only_test_data() {
- dbTester.prepareDbUnit(getClass(), "no_line_hashes_when_only_test_data.xml");
-
- ReaderToStringConsumer fn = new ReaderToStringConsumer();
- underTest.readLineHashesStream(dbSession, "FILE1_UUID", fn);
-
- assertThat(fn.result).isNull();
- }
-
@Test
public void insert() {
FileSourceDto expected = new FileSourceDto()
line_count="0"
data_hash="321654987"
created_at="123456789"
- updated_at="123456789"
- data_type="SOURCE"/>
+ updated_at="123456789"/>
</dataset>
+++ /dev/null
-<dataset>
-
- <file_sources id="101" project_uuid="PRJ_UUID" file_uuid="FILE1_UUID"
- binary_data="abcde" data_hash="[null]"
- line_hashes="[null]"
- line_count="0"
- src_hash="[null]"
- line_hashes_version="[null]"
- created_at="1500000000000" updated_at="1500000000000" data_type="TEST" />
-
-</dataset>
line_hashes="ABC\nDEF\nGHI"
line_count="3"
src_hash="FILE_HASH" revision="123456789"
- created_at="1500000000000" updated_at="1500000000000" data_type="SOURCE"
+ created_at="1500000000000" updated_at="1500000000000"
line_hashes_version="[null]"/>
</dataset>
line_hashes="NEW_LINE_HASHES"
line_count="1"
src_hash="NEW_FILE_HASH" revision="987654321"
- created_at="1500000000000" updated_at="1500000000002" data_type="SOURCE"
+ created_at="1500000000000" updated_at="1500000000002"
line_hashes_version="1" />