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

Error: UTF-16 error #325

Open
efendioglukdz opened this issue Jan 23, 2024 · 0 comments
Open

Error: UTF-16 error #325

efendioglukdz opened this issue Jan 23, 2024 · 0 comments

Comments

@efendioglukdz
Copy link

efendioglukdz commented Jan 23, 2024

Hello friends,

I have some strange issues when reading from database. Is there any chance to catch that or at least to catch that string with the value that has some broken characters in it � � �. I cant always correct the Database values. It seems to me that it always panics when trying
stream.try_next().await.unwrap(). Unfortunately stream.try_next().await.unwrap_or_else(|_| None) { doesnt do better. It breaks the loop. Does anybody had the same issues already and did u come to a solution? Or mayb I use the Library wrong I dnt know

match client.query(sql,&[]).await{
        Ok(mut stream) => {
        
            while let Some(item) = stream.try_next().await.unwrap(){
                match item{
                    QueryItem::Metadata(meta) if meta.result_index() == 0 => {
                        // the first result column info can be handled here
                        let col_names:Vec<String> = meta.columns().iter().map(|c| c.name().to_string()).collect();
                        println!("{}",col_names.join(","));
                    },
                    // the second result set returns first another metadata item
                    QueryItem::Metadata(meta) => {
                        // .. handling
                    },
                    // ...and, again, we get rows from the second resultset
                    QueryItem::Row(row) => {

                        println!("{row:?}");
                    }

                }
            }
        },
        Err(error) => {

        },
    }
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