-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Alexey Tyuryumov <Alexey.Tyuryumov@acronis.com>
- Loading branch information
Alexey19
and
Alexey Tyuryumov
authored
Nov 16, 2020
1 parent
5ee9f28
commit 44bd707
Showing
12 changed files
with
185 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package dialect | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
"time" | ||
) | ||
|
||
type mssql struct{} | ||
|
||
func (d mssql) QuoteIdent(s string) string { | ||
return quoteIdent(s, `"`) | ||
} | ||
|
||
func (d mssql) EncodeString(s string) string { | ||
return `'` + strings.Replace(s, `'`, `''`, -1) + `'` | ||
} | ||
|
||
func (d mssql) EncodeBool(b bool) string { | ||
if b { | ||
return "1" | ||
} | ||
return "0" | ||
} | ||
|
||
func (d mssql) EncodeTime(t time.Time) string { | ||
return t.Format("'2006-01-02 15:04:05.999'") | ||
} | ||
|
||
func (d mssql) EncodeBytes(b []byte) string { | ||
return fmt.Sprintf(`E'\\x%x'`, b) | ||
} | ||
|
||
func (d mssql) Placeholder(n int) string { | ||
return fmt.Sprintf("@p%d", n+1) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.