Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
Prostředí pro benchmarky kompresních algoritmů pro 3D modely - Underpaid devs
Manage
Activity
Members
Labels
Plan
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ASWI
ASWI 2024
Prostředí pro benchmarky kompresních algoritmů pro 3D modely - Underpaid devs
Commits
49fa74cc
Commit
49fa74cc
authored
11 months ago
by
Daniel Cífka
Browse files
Options
Downloads
Patches
Plain Diff
PPBKA3M-92
-Implement registration method to database
Repair and compailing last chnage.
parent
abbca648
No related branches found
Branches containing commit
No related tags found
1 merge request
!5
PPBKA3M-92-Implement registration method to database
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Core/Database/DatabaseAccess.cs
+14
-84
14 additions, 84 deletions
Core/Database/DatabaseAccess.cs
with
14 additions
and
84 deletions
Core/Database/DatabaseAccess.cs
+
14
−
84
View file @
49fa74cc
...
...
@@ -23,46 +23,9 @@ namespace MeshCompression.Core.Database
Console
.
WriteLine
(
$"Disconnected..."
);
}
public
List
<
DataPoint
>
GetExperimentData
(
ulong
methodId
,
ulong
metricId
,
ulong
objectId
)
{
List
<
DataPoint
>
experimentDataPoints
=
new
List
<
DataPoint
>();
try
{
string
sql
=
"SELECT Rate, Error, Start, Stop FROM experiments WHERE Algorithms_ID = @MethodId AND Metrics_ID = @MetricId AND 3D_Objects_ID = @ObjectId"
;
using
(
var
command
=
new
MySqlCommand
(
sql
,
connection
))
{
// Add parameter for the methodId
command
.
Parameters
.
AddWithValue
(
"@MethodId"
,
methodId
);
command
.
Parameters
.
AddWithValue
(
"@MetricId"
,
metricId
);
command
.
Parameters
.
AddWithValue
(
"@ObjectId"
,
objectId
);
public
void
EndExperiment
(
ulong
experimentId
,
Experiment
experiment
)
=>
throw
new
NotImplementedException
();
using
(
var
reader
=
command
.
ExecuteReader
())
{
while
(
reader
.
Read
())
{
double
rate
=
(
double
)
reader
[
"Rate"
];
double
result
=
(
double
)
reader
[
"Error"
];
DateTime
start
=
(
DateTime
)
reader
[
"Start"
];
DateTime
end
=
(
DateTime
)
reader
[
"Stop"
];
DataPoint
dataPoint
=
new
DataPoint
(
rate
,
result
,
start
,
end
,
methodId
,
metricId
,
objectId
);
experimentDataPoints
.
Add
(
dataPoint
);
}
}
}
}
catch
(
Exception
ex
)
{
Console
.
WriteLine
(
"An error occurred: "
+
ex
.
Message
.
ToString
());
}
return
experimentDataPoints
;
}
public
List
<
DataPoint
>
GetExperimentData
(
ulong
methodId
,
ulong
metricId
,
ulong
objectId
)
=>
throw
new
NotImplementedException
();
public
MethodFile
GetMethodFileByName
(
string
name
)
{
MethodFile
methodFile
=
null
;
...
...
@@ -83,9 +46,8 @@ namespace MeshCompression.Core.Database
var
Name
=
reader
[
"Name"
].
ToString
();
var
path
=
reader
[
"Path"
].
ToString
();
var
DisplayName
=
reader
[
"DisplayName"
].
ToString
();
var
Flags
=
Convert
.
ToInt32
(
reader
[
"Flags"
]);
methodFile
=
new
MethodFile
(
Name
,
DisplayName
,
path
,
Flags
);
methodFile
=
new
MethodFile
(
Name
,
DisplayName
,
path
);
}
}
}
...
...
@@ -117,9 +79,8 @@ namespace MeshCompression.Core.Database
var
Name
=
reader
[
"Name"
].
ToString
();
var
path
=
reader
[
"Path"
].
ToString
();
var
DisplayName
=
reader
[
"DisplayName"
].
ToString
();
var
Flags
=
Convert
.
ToInt32
(
reader
[
"Flags"
]);
metricFile
=
new
MetricFile
(
Name
,
DisplayName
,
path
,
Flags
);
metricFile
=
new
MetricFile
(
Name
,
DisplayName
,
path
);
}
}
}
...
...
@@ -165,19 +126,22 @@ namespace MeshCompression.Core.Database
return
objFile
;
}
public
ulong
RegisterExperiment
(
Experiment
experiment
)
=>
throw
new
NotImplementedException
();
public
void
RegisterMethodFile
(
MethodFile
methodFile
)
{
try
{
string
sql
=
"INSERT INTO algorithm(Name,
Path, Flags,
DisplayName) VALUE (@Name,
@Path, @Flags,
@DisplayName)"
;
string
sql
=
"INSERT INTO algorithm(Name, DisplayName
, Path
) VALUE (@Name, @DisplayName
,@Path
)"
;
using
(
var
command
=
new
MySqlCommand
(
sql
,
connection
))
{
// Add parameters
command
.
Parameters
.
AddWithValue
(
"@Name"
,
methodFile
.
Name
);
command
.
Parameters
.
AddWithValue
(
"@Path"
,
methodFile
.
Path
);
command
.
Parameters
.
AddWithValue
(
"@Flags"
,
methodFile
.
Flags
);
command
.
Parameters
.
AddWithValue
(
"@DisplayName"
,
methodFile
.
DisplayName
);
command
.
Parameters
.
AddWithValue
(
"@Path"
,
methodFile
.
Path
);
// Execute the command
int
rowsAffected
=
command
.
ExecuteNonQuery
();
...
...
@@ -202,15 +166,15 @@ namespace MeshCompression.Core.Database
{
try
{
string
sql
=
"INSERT INTO metric(Name,
Path, Flags,
DisplayName) VALUE (@Name,
@Path, @Flags,
@DisplayName)"
;
string
sql
=
"INSERT INTO metric(Name, DisplayName
, Path
) VALUE (@Name, @DisplayName
, @Path
)"
;
using
(
var
command
=
new
MySqlCommand
(
sql
,
connection
))
{
// Add parameters
command
.
Parameters
.
AddWithValue
(
"@Name"
,
metricFile
.
Name
);
command
.
Parameters
.
AddWithValue
(
"@Path"
,
metricFile
.
Path
);
command
.
Parameters
.
AddWithValue
(
"@Flags"
,
metricFile
.
Flags
);
command
.
Parameters
.
AddWithValue
(
"@DisplayName"
,
metricFile
.
DisplayName
);
command
.
Parameters
.
AddWithValue
(
"@Path"
,
metricFile
.
Path
);
// Execute the command
int
rowsAffected
=
command
.
ExecuteNonQuery
();
...
...
@@ -264,42 +228,8 @@ namespace MeshCompression.Core.Database
Console
.
WriteLine
(
"An error occurred: "
+
ex
.
Message
.
ToString
());
}
}
public
void
SaveExperimentDataPoint
(
DataPoint
experimentDataPoint
)
{
try
{
string
sql
=
"INSERT INTO 3d_objects(Rate, Error, Start, End, 3D_Objects_ID, Metric_ID, Algorithm_ID) VALUE (@Rate, @Error, @Start, @End, @3D_Objects_ID, @Metric_ID, @Algorithm_ID)"
;
using
(
var
command
=
new
MySqlCommand
(
sql
,
connection
))
{
// Add parameters
command
.
Parameters
.
AddWithValue
(
"@Rate"
,
experimentDataPoint
.
Rate
);
command
.
Parameters
.
AddWithValue
(
"@Error"
,
experimentDataPoint
.
Result
);
command
.
Parameters
.
AddWithValue
(
"@Start"
,
experimentDataPoint
.
Start
);
command
.
Parameters
.
AddWithValue
(
"@End"
,
experimentDataPoint
.
End
);
command
.
Parameters
.
AddWithValue
(
"@3D_Objects_ID"
,
experimentDataPoint
.
ObjectId
);
command
.
Parameters
.
AddWithValue
(
"@Metric_ID"
,
experimentDataPoint
.
MetricId
);
command
.
Parameters
.
AddWithValue
(
"@Algorithm_ID"
,
experimentDataPoint
.
MethodId
);
// Execute the command
int
rowsAffected
=
command
.
ExecuteNonQuery
();
// Check if the insertion was successful
if
(
rowsAffected
>
0
)
{
Console
.
WriteLine
(
"Record inserted successfully."
);
}
else
{
Console
.
WriteLine
(
"Failed to insert record."
);
}
}
}
catch
(
Exception
ex
)
{
Console
.
WriteLine
(
"An error occurred: "
+
ex
.
Message
.
ToString
());
}
}
public
void
SaveExperimentDataPoint
(
DataPoint
experimentDataPoint
)
=>
throw
new
NotImplementedException
();
private
void
Connect
()
{
...
...
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