Files
upstream-mirror 0f4df23290
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
snapshot of https://github.com/sqlc-dev/sqlc.git (main, 2026-09-16; blobs > 131072B omitted)
2026-09-16 02:17:34 +05:00

37 lines
1.0 KiB
Go

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 + ")"
}