mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-24 03:09:22 -06:00
Add expect files for binary-as-hex tests
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -121,7 +121,7 @@ func applyBinaryAsHexContext(sqlCtx *sql.Context, apr *argparser.ArgParseResults
|
||||
} else if apr.Contains(binaryAsHexFlag) {
|
||||
enabled = true
|
||||
}
|
||||
|
||||
|
||||
if enabled {
|
||||
return tabular.WithBinaryAsHex(sqlCtx, true)
|
||||
}
|
||||
@@ -246,7 +246,7 @@ func (cmd SqlCmd) Exec(ctx context.Context, commandStr string, args []string, dE
|
||||
if query, queryOK := apr.GetValue(QueryFlag); queryOK {
|
||||
// Apply binary-as-hex logic for query mode (default: false for non-interactive)
|
||||
sqlCtx = applyBinaryAsHexContext(sqlCtx, apr, false)
|
||||
|
||||
|
||||
if apr.Contains(saveFlag) {
|
||||
return execSaveQuery(sqlCtx, dEnv, queryist, apr, query, format, usage)
|
||||
}
|
||||
@@ -254,7 +254,7 @@ func (cmd SqlCmd) Exec(ctx context.Context, commandStr string, args []string, dE
|
||||
} else if savedQueryName, exOk := apr.GetValue(executeFlag); exOk {
|
||||
// Apply binary-as-hex logic for execute saved query mode (default: false for non-interactive)
|
||||
sqlCtx = applyBinaryAsHexContext(sqlCtx, apr, false)
|
||||
|
||||
|
||||
return executeSavedQuery(sqlCtx, queryist, dEnv, savedQueryName, format, usage)
|
||||
} else if apr.Contains(listSavedFlag) {
|
||||
return listSavedQueries(sqlCtx, queryist, dEnv, format, usage)
|
||||
|
||||
@@ -37,7 +37,6 @@ import (
|
||||
"github.com/dolthub/dolt/go/libraries/utils/filesys"
|
||||
)
|
||||
|
||||
|
||||
// BuildConnectionStringQueryist returns a Queryist that connects to the server specified by the given server config. Presence in this
|
||||
// module isn't ideal, but it's the only way to get the server config into the queryist.
|
||||
func BuildConnectionStringQueryist(ctx context.Context, cwdFS filesys.Filesys, creds *cli.UserPassword, apr *argparser.ArgParseResults, host string, port int, useTLS bool, dbRev string) (cli.LateBindQueryist, error) {
|
||||
@@ -165,7 +164,7 @@ func NewMysqlRowWrapper(sqlRows *sql2.Rows) (*MysqlRowWrapper, error) {
|
||||
// Normalize both BINARY and VARBINARY to VarBinary for simpler formatting logic
|
||||
sqlType = types.MustCreateBinary(sqltypes.VarBinary, 255)
|
||||
}
|
||||
|
||||
|
||||
schema[i] = &sql.Column{
|
||||
Name: colType.Name(),
|
||||
Type: sqlType,
|
||||
|
||||
@@ -28,7 +28,6 @@ import (
|
||||
"github.com/dolthub/dolt/go/store/types"
|
||||
)
|
||||
|
||||
|
||||
// DoltRowToSqlRow constructs a go-mysql-server sql.Row from a Dolt row.Row.
|
||||
func DoltRowToSqlRow(doltRow row.Row, sch schema.Schema) (sql.Row, error) {
|
||||
if doltRow == nil {
|
||||
|
||||
26
integration-tests/bats/binary-as-hex-server-interactive.expect
Executable file
26
integration-tests/bats/binary-as-hex-server-interactive.expect
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/expect
|
||||
|
||||
set port [lindex $argv 0]
|
||||
set timeout 10
|
||||
|
||||
spawn dolt --host 127.0.0.1 --port $port --no-tls sql --binary-as-hex
|
||||
expect ">"
|
||||
|
||||
send "USE repo1;\r"
|
||||
expect ">"
|
||||
|
||||
send "SELECT * FROM binary_test;\r"
|
||||
expect {
|
||||
"0x0A000000" {
|
||||
# Found hex output - this is correct
|
||||
expect ">"
|
||||
send "exit\r"
|
||||
expect eof
|
||||
exit 0
|
||||
}
|
||||
timeout {
|
||||
send "exit\r"
|
||||
expect eof
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
26
integration-tests/bats/binary-as-hex-skip-flag-interactive.expect
Executable file
26
integration-tests/bats/binary-as-hex-skip-flag-interactive.expect
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/expect
|
||||
|
||||
set port [lindex $argv 0]
|
||||
set timeout 10
|
||||
|
||||
spawn dolt --host 127.0.0.1 --port $port --no-tls sql --skip-binary-as-hex
|
||||
expect ">"
|
||||
|
||||
send "USE repo1;\r"
|
||||
expect ">"
|
||||
|
||||
send "SELECT * FROM binary_test;\r"
|
||||
expect {
|
||||
-re "\\| 1 \\|.*\\|" {
|
||||
# Found raw binary output (not hex) - this is correct for skip flag
|
||||
expect ">"
|
||||
send "exit\r"
|
||||
expect eof
|
||||
exit 0
|
||||
}
|
||||
timeout {
|
||||
send "exit\r"
|
||||
expect eof
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user