Skip to content
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

First query result is not valid after a second one #206

Open
Ronneesley opened this issue Apr 4, 2023 · 1 comment
Open

First query result is not valid after a second one #206

Ronneesley opened this issue Apr 4, 2023 · 1 comment

Comments

@Ronneesley
Copy link

Hello,

When I execute two queries, the first result becomes random.

Given the database:

create database test;

use test;

create table person (
	id int auto_increment,
	name varchar(100),
	primary key (id)
);

create table address (
    id int auto_increment primary key,
    person int,
    description varchar(200),
    foreign key (person) references person(id)
);

insert into person(name) values('Roni');
insert into address(person, description) values(1, 'Street 1');

Given the code:

julia> using DBInterface, MySQL

julia> con = DBInterface.connect(MySQL.Connection, "127.0.0.1", "root", 
                            "PASSWORD", db="test", port=3306);

julia> r1 = first(DBInterface.execute(con, 
                            "select * from address where id = 1"))
MySQL.TextRow{true}: (id = 1, person = 1, description = "Street 1")

julia> r1.id
1

julia> r1.person
1

julia> r2 = first(DBInterface.execute(con, 
                            "select * from person where id = 1"))
MySQL.TextRow{true}: (id = 1, name = "Roni")

julia> r2.id
1

julia> r2.name
"Roni"

julia> r1.description
"\0_9\n\x02\0\0\0\0b9\n\x02\0\0\0\0e9..."

Note that result r1.description is incorrect! The correct answer is: "Street 1", but
when I do the second query and store the result at r2, the first result r1 turns incorrect.

@Ronneesley
Copy link
Author

@quinnj, I opened the issue here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant