Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Synapse Compress State
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
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
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Synapse Compress State
Commits
f9d35703
Unverified
Commit
f9d35703
authored
5 years ago
by
Jan Alexander Steffens (heftig)
Browse files
Options
Downloads
Patches
Plain Diff
Fix typo: Rename PGEscapse to PGEscape
parent
9990141d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/database.rs
+4
-4
4 additions, 4 deletions
src/database.rs
src/main.rs
+5
-5
5 additions, 5 deletions
src/main.rs
with
9 additions
and
9 deletions
src/database.rs
+
4
−
4
View file @
f9d35703
...
...
@@ -164,9 +164,9 @@ fn get_missing_from_db(client: &mut Client, missing_sgs: &[i64]) -> BTreeMap<i64
}
/// Helper function that escapes the wrapped text when writing SQL
pub
struct
PGEscap
s
e
<
'a
>
(
pub
&
'a
str
);
pub
struct
PGEscape
<
'a
>
(
pub
&
'a
str
);
impl
<
'a
>
fmt
::
Display
for
PGEscap
s
e
<
'a
>
{
impl
<
'a
>
fmt
::
Display
for
PGEscape
<
'a
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
<
'_
>
)
->
fmt
::
Result
{
let
mut
delim
=
Cow
::
from
(
"$$"
);
while
self
.0
.contains
(
&
delim
as
&
str
)
{
...
...
@@ -181,12 +181,12 @@ impl<'a> fmt::Display for PGEscapse<'a> {
#[test]
fn
test_pg_escape
()
{
let
s
=
format!
(
"{}"
,
PGEscap
s
e
(
"test"
));
let
s
=
format!
(
"{}"
,
PGEscape
(
"test"
));
assert_eq!
(
s
,
"$$test$$"
);
let
dodgy_string
=
"test$$ing"
;
let
s
=
format!
(
"{}"
,
PGEscap
s
e
(
dodgy_string
));
let
s
=
format!
(
"{}"
,
PGEscape
(
dodgy_string
));
// prefix and suffixes should match
let
start_pos
=
s
.find
(
dodgy_string
)
.expect
(
"expected to find dodgy string"
);
...
...
This diff is collapsed.
Click to expand it.
src/main.rs
+
5
−
5
View file @
f9d35703
...
...
@@ -23,7 +23,7 @@ mod database;
static
GLOBAL
:
jemallocator
::
Jemalloc
=
jemallocator
::
Jemalloc
;
use
compressor
::
Compressor
;
use
database
::
PGEscap
s
e
;
use
database
::
PGEscape
;
use
clap
::{
crate_authors
,
crate_description
,
crate_name
,
crate_version
,
value_t_or_exit
,
App
,
Arg
,
...
...
@@ -269,10 +269,10 @@ fn main() {
output
,
"({}, {}, {}, {}, {})"
,
sg
,
PGEscap
s
e
(
room_id
),
PGEscap
s
e
(
t
),
PGEscap
s
e
(
s
),
PGEscap
s
e
(
e
)
PGEscape
(
room_id
),
PGEscape
(
t
),
PGEscape
(
s
),
PGEscape
(
e
)
)
.unwrap
();
}
...
...
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