snapshot of https://github.com/sqlc-dev/sqlc.git (main, 2026-09-16; blobs > 131072B omitted)
Some checks failed
kotlin / test (push) Has been skipped
python / test (push) Has been skipped
typescript / test (push) Has been skipped
go / build darwin/amd64 (push) Has been cancelled
go / build linux/amd64 (push) Has been cancelled
go / build windows/amd64 (push) Has been cancelled
go / build darwin/arm64 (push) Has been cancelled
go / build linux/arm64 (push) Has been cancelled
go / build windows/arm64 (push) Has been cancelled
go / test (push) Has been cancelled
go / vuln_check (push) Has been cancelled
Some checks failed
kotlin / test (push) Has been skipped
python / test (push) Has been skipped
typescript / test (push) Has been skipped
go / build darwin/amd64 (push) Has been cancelled
go / build linux/amd64 (push) Has been cancelled
go / build windows/amd64 (push) Has been cancelled
go / build darwin/arm64 (push) Has been cancelled
go / build linux/arm64 (push) Has been cancelled
go / build windows/arm64 (push) Has been cancelled
go / test (push) Has been cancelled
go / vuln_check (push) Has been cancelled
This commit is contained in:
36
internal/engine/dolphin/format.go
Normal file
36
internal/engine/dolphin/format.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package dolphin
|
||||
|
||||
// QuoteIdent returns a quoted identifier if it needs quoting.
|
||||
// MySQL uses backticks for quoting identifiers.
|
||||
func (p *Parser) QuoteIdent(s string) string {
|
||||
// For now, don't quote - MySQL is less strict about quoting
|
||||
return s
|
||||
}
|
||||
|
||||
// TypeName returns the SQL type name for the given namespace and name.
|
||||
// Handles MySQL-specific type name mappings for formatting.
|
||||
func (p *Parser) TypeName(ns, name string) string {
|
||||
if ns != "" {
|
||||
return ns + "." + name
|
||||
}
|
||||
// Map internal type names to MySQL CAST-compatible names for formatting
|
||||
switch name {
|
||||
case "bigint unsigned":
|
||||
return "UNSIGNED"
|
||||
case "bigint signed":
|
||||
return "SIGNED"
|
||||
}
|
||||
return name
|
||||
}
|
||||
|
||||
// Param returns the parameter placeholder for the given number.
|
||||
// MySQL uses ? for all parameters (positional).
|
||||
func (p *Parser) Param(n int, numbered bool) string {
|
||||
return "?"
|
||||
}
|
||||
|
||||
// Cast returns a type cast expression.
|
||||
// MySQL uses CAST(expr AS type) syntax.
|
||||
func (p *Parser) Cast(arg, typeName string) string {
|
||||
return "CAST(" + arg + " AS " + typeName + ")"
|
||||
}
|
||||
Reference in New Issue
Block a user