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

Support named parameters for prepared statements #838

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

debop
Copy link
Contributor

@debop debop commented Dec 11, 2018

Support named parameters like this

Map<String, Object> resultIdMap = new HashMap<>();
resultIdMap.put("ids", resultIds);
data.raw(Person.class, "select * from Person WHERE id IN :ids", resultIdMap)

and support duplicated parameters

try (Result<Tuple> result = data.raw("select * from Person WHERE id = :id and name = :name and id = :id", parameters)) {
            assertEquals(result.first().<Number>get("id").intValue(), people.get(0).getId());
        }

@npurushe
Copy link
Contributor

Will look this over thanks!

}
}

private class EntityResult extends BaseResult<E> {
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks identical to RawEntityQuery.EntityResult this class should probably extend RawEntityQuery to avoid duplication

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can I change RawEntityQuery overridable? If then, I will

* @author debop (Sunghyouk Bae)
* @since 18. 12. 8
*/
public class RawTupleNamedQuery extends PreparedQueryOperation implements Supplier<Result<Tuple>> {
Copy link
Contributor

Choose a reason for hiding this comment

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

similarly this duplicates much RawTupleQuery so probably should extend it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I change RawTupleQuery to overridable, I will extend 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

Successfully merging this pull request may close these issues.

None yet

2 participants