Skip to content

Release 1.12.2 #369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ Versioning](http://semver.org/spec/v2.0.0.html) except to the first release.

### Fixed

## [1.12.2] - 2024-01-11

The patch release with fixes from the master branch.

### Fixed

- Tests with crud 1.4.0 (#336)
- Tests with case sensitive SQL (#341)
- Potentially packet length overflow when reading (#361)

## [1.12.1] - 2023-08-03

The patch release with fixes from the master branch.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ clean:
.PHONY: deps
deps: clean
( cd ./queue/testdata; $(TTCTL) rocks install queue 1.3.0 )
( cd ./crud/testdata; $(TTCTL) rocks install crud 1.1.1 )
( cd ./crud/testdata; $(TTCTL) rocks install crud 1.4.1 )

.PHONY: datetime-timezones
datetime-timezones:
Expand Down
19 changes: 12 additions & 7 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ func (conn *Connection) timeouts() {
}

func read(r io.Reader, lenbuf []byte) (response []byte, err error) {
var length int
var length uint64

if _, err = io.ReadFull(r, lenbuf); err != nil {
return
Expand All @@ -1199,15 +1199,20 @@ func read(r io.Reader, lenbuf []byte) (response []byte, err error) {
err = errors.New("Wrong response header")
return
}
length = (int(lenbuf[1]) << 24) +
(int(lenbuf[2]) << 16) +
(int(lenbuf[3]) << 8) +
int(lenbuf[4])
length = (uint64(lenbuf[1]) << 24) +
(uint64(lenbuf[2]) << 16) +
(uint64(lenbuf[3]) << 8) +
uint64(lenbuf[4])

if length == 0 {
err = errors.New("Response should not be 0 length")
switch {
case length == 0:
err = errors.New("response should not be 0 length")
return
case length > math.MaxUint32:
err = errors.New("response is too big")
return
}

response = make([]byte, length)
_, err = io.ReadFull(r, response)

Expand Down
2 changes: 1 addition & 1 deletion crud/tarantool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ var testResultWithErrCases = []struct {
{
"ManyResult",
&crud.Result{},
crud.MakeReplaceManyRequest(invalidSpaceName).Opts(opManyOpts),
crud.MakeReplaceManyRequest(invalidSpaceName).Tuples(tuples).Opts(opManyOpts),
},
{
"NumberResult",
Expand Down
12 changes: 6 additions & 6 deletions settings/tarantool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func TestSQLDefaultEngineSetting(t *testing.T) {
require.Equal(t, []interface{}{[]interface{}{"sql_default_engine", "vinyl"}}, resp.Data)

// Create a space with "CREATE TABLE".
resp, err = conn.Execute("CREATE TABLE t1_vinyl(a INT PRIMARY KEY, b INT, c INT);", []interface{}{})
resp, err = conn.Execute("CREATE TABLE T1_VINYL(a INT PRIMARY KEY, b INT, c INT);", []interface{}{})
require.Nil(t, err)
require.NotNil(t, resp)
require.Equal(t, uint64(1), resp.SQLInfo.AffectedCount)
Expand All @@ -140,7 +140,7 @@ func TestSQLDefaultEngineSetting(t *testing.T) {
require.Equal(t, []interface{}{[]interface{}{"sql_default_engine", "memtx"}}, resp.Data)

// Create a space with "CREATE TABLE".
resp, err = conn.Execute("CREATE TABLE t2_memtx(a INT PRIMARY KEY, b INT, c INT);", []interface{}{})
resp, err = conn.Execute("CREATE TABLE T2_MEMTX(a INT PRIMARY KEY, b INT, c INT);", []interface{}{})
require.Nil(t, err)
require.NotNil(t, resp)
require.Equal(t, uint64(1), resp.SQLInfo.AffectedCount)
Expand Down Expand Up @@ -233,13 +233,13 @@ func TestSQLFullColumnNamesSetting(t *testing.T) {
defer conn.Close()

// Create a space.
resp, err = conn.Execute("CREATE TABLE fkname(id INT PRIMARY KEY, x INT);", []interface{}{})
resp, err = conn.Execute("CREATE TABLE FKNAME(ID INT PRIMARY KEY, X INT);", []interface{}{})
require.Nil(t, err)
require.NotNil(t, resp)
require.Equal(t, uint64(1), resp.SQLInfo.AffectedCount)

// Fill it with some data.
resp, err = conn.Execute("INSERT INTO fkname VALUES (1, 1);", []interface{}{})
resp, err = conn.Execute("INSERT INTO FKNAME VALUES (1, 1);", []interface{}{})
require.Nil(t, err)
require.NotNil(t, resp)
require.Equal(t, uint64(1), resp.SQLInfo.AffectedCount)
Expand All @@ -257,7 +257,7 @@ func TestSQLFullColumnNamesSetting(t *testing.T) {
require.Equal(t, []interface{}{[]interface{}{"sql_full_column_names", false}}, resp.Data)

// Get a data with short column names in metadata.
resp, err = conn.Execute("SELECT x FROM fkname WHERE id = 1;", []interface{}{})
resp, err = conn.Execute("SELECT X FROM FKNAME WHERE ID = 1;", []interface{}{})
require.Nil(t, err)
require.NotNil(t, resp)
require.Equal(t, "X", resp.MetaData[0].FieldName)
Expand All @@ -275,7 +275,7 @@ func TestSQLFullColumnNamesSetting(t *testing.T) {
require.Equal(t, []interface{}{[]interface{}{"sql_full_column_names", true}}, resp.Data)

// Get a data with full column names in metadata.
resp, err = conn.Execute("SELECT x FROM fkname WHERE id = 1;", []interface{}{})
resp, err = conn.Execute("SELECT X FROM FKNAME WHERE ID = 1;", []interface{}{})
require.Nil(t, err)
require.NotNil(t, resp)
require.Equal(t, "FKNAME.X", resp.MetaData[0].FieldName)
Expand Down
25 changes: 13 additions & 12 deletions tarantool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1324,17 +1324,18 @@ func TestClientSessionPush(t *testing.T) {
}

const (
createTableQuery = "CREATE TABLE SQL_SPACE (id STRING PRIMARY KEY, name STRING COLLATE \"unicode\" DEFAULT NULL);"
createTableQuery = "CREATE TABLE SQL_SPACE (ID STRING PRIMARY KEY, NAME " +
"STRING COLLATE \"unicode\" DEFAULT NULL);"
insertQuery = "INSERT INTO SQL_SPACE VALUES (?, ?);"
selectNamedQuery = "SELECT id, name FROM SQL_SPACE WHERE id=:id AND name=:name;"
selectPosQuery = "SELECT id, name FROM SQL_SPACE WHERE id=? AND name=?;"
updateQuery = "UPDATE SQL_SPACE SET name=? WHERE id=?;"
selectNamedQuery = "SELECT ID, NAME FROM SQL_SPACE WHERE ID=:ID AND NAME=:NAME;"
selectPosQuery = "SELECT ID, NAME FROM SQL_SPACE WHERE ID=? AND NAME=?;"
updateQuery = "UPDATE SQL_SPACE SET NAME=? WHERE ID=?;"
enableFullMetaDataQuery = "SET SESSION \"sql_full_metadata\" = true;"
selectSpanDifQueryNew = "SELECT id||id, name, id FROM seqscan SQL_SPACE WHERE name=?;"
selectSpanDifQueryOld = "SELECT id||id, name, id FROM SQL_SPACE WHERE name=?;"
selectSpanDifQueryNew = "SELECT ID||ID, NAME, ID FROM seqscan SQL_SPACE WHERE NAME=?;"
selectSpanDifQueryOld = "SELECT ID||ID, NAME, ID FROM SQL_SPACE WHERE NAME=?;"
alterTableQuery = "ALTER TABLE SQL_SPACE RENAME TO SQL_SPACE2;"
insertIncrQuery = "INSERT INTO SQL_SPACE2 VALUES (?, ?);"
deleteQuery = "DELETE FROM SQL_SPACE2 WHERE name=?;"
deleteQuery = "DELETE FROM SQL_SPACE2 WHERE NAME=?;"
dropQuery = "DROP TABLE SQL_SPACE2;"
dropQuery2 = "DROP TABLE SQL_SPACE;"
disableFullMetaDataQuery = "SET SESSION \"sql_full_metadata\" = false;"
Expand Down Expand Up @@ -1383,8 +1384,8 @@ func TestSQL(t *testing.T) {
{
selectNamedQuery,
map[string]interface{}{
"id": "1",
"name": "test",
"ID": "1",
"NAME": "test",
},
Response{
SQLInfo: SQLInfo{AffectedCount: 0},
Expand Down Expand Up @@ -1434,22 +1435,22 @@ func TestSQL(t *testing.T) {
FieldName: "COLUMN_1",
FieldIsNullable: false,
FieldIsAutoincrement: false,
FieldSpan: "id||id",
FieldSpan: "ID||ID",
},
{
FieldType: "string",
FieldName: "NAME",
FieldIsNullable: true,
FieldIsAutoincrement: false,
FieldSpan: "name",
FieldSpan: "NAME",
FieldCollation: "unicode",
},
{
FieldType: "string",
FieldName: "ID",
FieldIsNullable: false,
FieldIsAutoincrement: false,
FieldSpan: "id",
FieldSpan: "ID",
FieldCollation: "",
},
}},
Expand Down