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

Get for text results when querying #679

Closed
wants to merge 1 commit into from

Conversation

EPashkin
Copy link

Fix #389

&self,
statement: &T,
params: &[&(dyn ToSql + Sync)],
) -> Result<Vec<Row>, Error>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't use the Row type since FromSql will not work with almost any of the types returned in text mode.

Copy link
Author

@EPashkin EPashkin Oct 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You right, in your project it used with proxy function, but in general case it need more thoughts.

decode_column_value_common::<postgres_types::AcceptEverythingString>(row, i)


fn decode_column_value_common<'a, T: postgres::types::FromSql<'a> + std::fmt::Display>(
    row: &'a Row,
    i: usize,
) -> String {
    match row.try_get::<usize, T>(i) {
        Ok(data) => format!("{}", data),
        Err(_) => "<null>".to_string(),
    }
}

@EPashkin
Copy link
Author

@sfackler Sorry, as you stated, no good solution for this issue.
I close MR.

@EPashkin EPashkin closed this Oct 28, 2020
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

Successfully merging this pull request may close these issues.

Support the ltree data type
2 participants