Skip to content
This repository has been archived by the owner on May 10, 2020. It is now read-only.

How can I parse data from a QueryRow? #77

Open
johnfercher opened this issue Sep 15, 2018 · 6 comments
Open

How can I parse data from a QueryRow? #77

johnfercher opened this issue Sep 15, 2018 · 6 comments

Comments

@johnfercher
Copy link
Contributor

let future = SqlConnection::connect(self.connection_string.as_str())
            .and_then(|conn| {
                conn.simple_query("SELECT TOP(10) * FROM [dbo].[Test]")
                    .for_each(|row| {
                        let guid : Guid = row.get(0);
                        Ok(())
                    })
            });
current_thread::block_on_all(future).unwrap();

I'm trying to parse a guid from QueryRow, but I'm getting the error bellow.

the trait `tiberius::types::FromColumnData<'_>` is not implemented for `tiberius::prelude::Guid`
@steffengy
Copy link
Owner

Does using &Guid work?

@johnfercher
Copy link
Contributor Author

It's working now with your suggestion, sorry for bother you. I'm having some difficulties to understand how the crate works.

@johnfercher
Copy link
Contributor Author

I'm having issues to parse text too, I tried &str, String and &String, but without success. How can I resolve this?

@brokenthorn
Copy link

brokenthorn commented Sep 26, 2018

@johnfercher Github issues are not for issues you're having while trying to understand a programming language. It's for issues related to proper usage of a project. Use Stackoverflow for that. Besides, your previous question is 100% unusable, it's devoid of any information pertaining to your problem. You're just crying out that you're having problems.

@johnfercher
Copy link
Contributor Author

@brokenthorn, I think that all libraries have to provide at least a basic documentation of how to do basic things. Exists a lot of possibilities of how someone could implement this, for this reason, I don't see these my doubts like "programming language issue". I see like a project which I want to use, but I don't have a documentation to follow.

Tiberius is an awesome project, but I'm having to discover of how to do things, I don't like to create issues like this, but I spent a lot of time trying to solve and I can't realize of how to do.

@steffengy
Copy link
Owner

I think issues are fine for that, it shows that some documentation is missing and often real issues might show up. What error do you get when you e.g. replace Guid in your first example with &str?

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

No branches or pull requests

3 participants