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

JsonValue Type Does Not Match SQL Type. #2422

Open
Jungle666 opened this issue Nov 19, 2024 · 0 comments
Open

JsonValue Type Does Not Match SQL Type. #2422

Jungle666 opened this issue Nov 19, 2024 · 0 comments

Comments

@Jungle666
Copy link

Jungle666 commented Nov 19, 2024

There is a table define:

CREATE TABLE `demo` ( 
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`char_col` varchar(20) DEFAULT NULL ,
`text_col` text  DEFAULT NULL ,
 PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4
)

Then insert data:

insert into demo (null,"1234","1234");
insert into demo (null,"aabbcc","aabbcc");

There is The sea-orm Query Code:

    let list = JsonValue::find_by_statement(Statement::from_sql_and_values(DbBackend::MySql,"select * from demo", []))
            .all(db)
            .await
            .context(DbSnafu)?;

Then we found that the list:

[{
"id":1,
"char_col": "1234",
"text_col": 1234
},
{
"id":2,
"char_col": "1234",
"text_col": "aabbcc"
}
]

The Question is :

Why first row data text_col is a number type,then second text_col row data is String, How can i fix it?

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