Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Sleuthkit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IRT
Sleuthkit
Commits
f9d0ba0b
Commit
f9d0ba0b
authored
7 years ago
by
millmanorama
Browse files
Options
Downloads
Patches
Plain Diff
fix hasDBColumn for postgres and Sqlite
parent
7e4ce9b5
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bindings/java/src/org/sleuthkit/datamodel/TimelineManager.java
+17
-12
17 additions, 12 deletions
...ngs/java/src/org/sleuthkit/datamodel/TimelineManager.java
with
17 additions
and
12 deletions
bindings/java/src/org/sleuthkit/datamodel/TimelineManager.java
+
17
−
12
View file @
f9d0ba0b
...
...
@@ -89,7 +89,11 @@ public class TimelineManager {
private
final
String
csvFunction
;
public
String
csvAggFunction
(
String
args
)
{
return
csvFunction
+
"("
+
args
+
")"
;
return
csvAggFunction
(
args
,
","
);
}
public
String
csvAggFunction
(
String
args
,
String
seperator
)
{
return
csvFunction
+
"("
+
args
+
", '"
+
seperator
+
"')"
;
}
TimelineManager
(
SleuthkitCase
tskCase
)
throws
TskCoreException
{
...
...
@@ -343,11 +347,11 @@ public List<CombinedEvent> getCombinedEvents(Interval timeRange, RootFilter filt
ArrayList
<
CombinedEvent
>
results
=
new
ArrayList
<>();
final
String
query
=
"SELECT full_description, time, file_id, "
+
csvAggFunction
(
"events.event_id
::character varying, ','
"
)
+
"
as
eventIDs, "
+
csvFunction
+
"
(sub_type
::character varying, ',') as
eventTypes"
+
csvAggFunction
(
"
CAST(
events.event_id
AS VARCHAR)
"
)
+
"
AS
eventIDs, "
+
csv
Agg
Function
(
"CAST
(sub_type
AS VARCHAR)"
)
+
" AS
eventTypes"
+
" FROM events "
+
useHashHitTablesHelper
(
filter
)
+
useTagTablesHelper
(
filter
)
+
" WHERE time >= "
+
startTime
+
" AND time <"
+
endTime
+
" AND "
+
getSQLWhere
(
filter
)
+
" GROUP BY time,full_description, file_id ORDER BY time ASC, full_description"
;
+
" GROUP BY time,
full_description, file_id ORDER BY time ASC, full_description"
;
sleuthkitCase
.
acquireSingleUserCaseReadLock
();
try
(
CaseDbConnection
con
=
sleuthkitCase
.
getConnection
();
...
...
@@ -738,20 +742,21 @@ private void createIndex(final String tableName, final List<String> columnList)
private
boolean
hasDBColumn
(
final
String
dbColumn
)
throws
TskCoreException
{
String
query
=
sleuthkitCase
.
getDatabaseType
()
==
TskData
.
DbType
.
POSTGRESQL
?
"
SELECT column_name as name FROM information_schema.columns WHERE table_name='events';"
//NON-NLS //Postgres
?
"SELECT column_name as name FROM information_schema.columns WHERE table_name='events';"
//NON-NLS //Postgres
:
"PRAGMA table_info(events)"
;
//NON-NLS //SQLite
sleuthkitCase
.
acquireSingleUserCaseReadLock
();
try
(
CaseDbConnection
con
=
sleuthkitCase
.
getConnection
();
Statement
stmt
=
con
.
createStatement
();
ResultSet
executeQuery
=
stmt
.
executeQuery
(
query
);)
{
while
(
executeQuery
.
next
())
{
if
(
dbColumn
.
equals
(
executeQuery
.
getString
(
"name"
)))
{
//NON-NLS
return
true
;
Statement
statement
=
con
.
createStatement
();)
{
statement
.
execute
(
query
);
try
(
ResultSet
results
=
statement
.
getResultSet
();)
{
while
(
results
.
next
())
{
if
(
dbColumn
.
equals
(
results
.
getString
(
"name"
)))
{
//NON-NLS
return
true
;
}
}
}
}
catch
(
SQLException
ex
)
{
throw
new
TskCoreException
(
"
problem
querying for events table column names"
,
ex
);
// NON-NLS
throw
new
TskCoreException
(
"
Error
querying for events table column names"
,
ex
);
// NON-NLS
}
finally
{
sleuthkitCase
.
releaseSingleUserCaseReadLock
();
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment