Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bwinf
medal
Commits
e49a08ba
Commit
e49a08ba
authored
Jul 07, 2020
by
Robert Czechowski
Browse files
Admin page: Contest export: Generalise export to work with postgres as well
parent
4d5af089
Pipeline
#692
passed with stage
in 14 minutes and 7 seconds
Changes
5
Pipelines
1
Show whitespace changes
Inline
Side-by-side
src/db_conn.base.rs
View file @
e49a08ba
...
...
@@ -833,7 +833,9 @@ impl MedalConnection for Connection {
let
mut
select_part
=
String
::
new
();
let
mut
join_part
=
String
::
new
();
let
mut
join_params
=
Vec
::
<&
dyn
rusqlite
::
types
::
ToSql
>
::
new
();
let
mut
join_params
=
gen_tosql_vector
();
join_params
.push
(
&
contest_id
);
for
(
n
,
(
id
,
name
))
in
taskgroups
.iter
()
.enumerate
()
{
...
...
@@ -909,7 +911,6 @@ impl MedalConnection for Connection {
row
.get
::
<
_
,
Option
<
String
>>
(
19
),
points
))
.unwrap
();
()
})
.unwrap
();
wtr
.flush
()
.unwrap
();
...
...
src/db_conn_postgres.header.rs
View file @
e49a08ba
...
...
@@ -24,6 +24,8 @@ use db_conn::{MedalConnection, MedalObject};
use
db_objects
::
*
;
use
helpers
;
fn
gen_tosql_vector
()
->
Vec
<&
'static
dyn
postgres
::
types
::
ToSql
>
{
Vec
::
new
()
}
trait
Queryable
{
fn
query_map_one
<
T
,
F
>
(
&
self
,
sql
:
&
str
,
params
:
&
[
&
dyn
postgres
::
types
::
ToSql
],
f
:
F
)
->
postgres
::
Result
<
Option
<
T
>>
...
...
src/db_conn_postgres.rs
View file @
e49a08ba
...
...
@@ -37,6 +37,8 @@ use db_conn::{MedalConnection, MedalObject};
use
db_objects
::
*
;
use
helpers
;
fn
gen_tosql_vector
()
->
Vec
<&
'static
dyn
postgres
::
types
::
ToSql
>
{
Vec
::
new
()
}
trait
Queryable
{
fn
query_map_one
<
T
,
F
>
(
&
self
,
sql
:
&
str
,
params
:
&
[
&
dyn
postgres
::
types
::
ToSql
],
f
:
F
)
->
postgres
::
Result
<
Option
<
T
>>
...
...
@@ -943,7 +945,9 @@ impl MedalConnection for Connection {
let
mut
select_part
=
String
::
new
();
let
mut
join_part
=
String
::
new
();
let
mut
join_params
=
Vec
::
<&
dyn
rusqlite
::
types
::
ToSql
>
::
new
();
let
mut
join_params
=
gen_tosql_vector
();
join_params
.push
(
&
contest_id
);
for
(
n
,
(
id
,
name
))
in
taskgroups
.iter
()
.enumerate
()
{
...
...
@@ -1019,7 +1023,6 @@ impl MedalConnection for Connection {
row
.get
::
<
_
,
Option
<
String
>>
(
19
),
points
))
.unwrap
();
()
})
.unwrap
();
wtr
.flush
()
.unwrap
();
...
...
src/db_conn_sqlite_new.header.rs
View file @
e49a08ba
...
...
@@ -24,6 +24,8 @@ use db_conn::{MedalConnection, MedalObject};
use
db_objects
::
*
;
use
helpers
;
fn
gen_tosql_vector
()
->
Vec
<&
'static
dyn
rusqlite
::
types
::
ToSql
>
{
Vec
::
new
()
}
trait
Queryable
{
fn
query_map_one
<
T
,
F
>
(
&
self
,
sql
:
&
str
,
params
:
&
[
&
dyn
rusqlite
::
types
::
ToSql
],
f
:
F
)
->
rusqlite
::
Result
<
Option
<
T
>>
...
...
src/db_conn_sqlite_new.rs
View file @
e49a08ba
...
...
@@ -37,6 +37,8 @@ use db_conn::{MedalConnection, MedalObject};
use
db_objects
::
*
;
use
helpers
;
fn
gen_tosql_vector
()
->
Vec
<&
'static
dyn
rusqlite
::
types
::
ToSql
>
{
Vec
::
new
()
}
trait
Queryable
{
fn
query_map_one
<
T
,
F
>
(
&
self
,
sql
:
&
str
,
params
:
&
[
&
dyn
rusqlite
::
types
::
ToSql
],
f
:
F
)
->
rusqlite
::
Result
<
Option
<
T
>>
...
...
@@ -943,7 +945,9 @@ impl MedalConnection for Connection {
let
mut
select_part
=
String
::
new
();
let
mut
join_part
=
String
::
new
();
let
mut
join_params
=
Vec
::
<&
dyn
rusqlite
::
types
::
ToSql
>
::
new
();
let
mut
join_params
=
gen_tosql_vector
();
join_params
.push
(
&
contest_id
);
for
(
n
,
(
id
,
name
))
in
taskgroups
.iter
()
.enumerate
()
{
...
...
@@ -1019,7 +1023,6 @@ impl MedalConnection for Connection {
row
.get
::
<
_
,
Option
<
String
>>
(
19
),
points
))
.unwrap
();
()
})
.unwrap
();
wtr
.flush
()
.unwrap
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment