Skip to content
This repository has been archived by the owner on Jan 2, 2023. It is now read-only.

Prepare statement again when it is lost #126

Merged
merged 2 commits into from
Jul 15, 2015

Conversation

stenlarsson
Copy link
Contributor

If an ALTER TABLE is performed the prepared statements are lost. In this case the statement should be prepared again.

run(args, connection)
f = run(args, connection)
f.fallback do |e|
raise e unless e.is_a?(Cql::QueryError) && e.code == 0x2500 # unprepared
Copy link
Owner

Choose a reason for hiding this comment

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

Instead of a comment, use a constant for the error code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Owner

Choose a reason for hiding this comment

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

Sometimes even I do bad things

If an ALTER TABLE is performed the prepared statements are lost. In this case the statement should be prepared again.
@stenlarsson
Copy link
Contributor Author

Added constants for all error codes.

@iconara
Copy link
Owner

iconara commented Jul 15, 2015

One final request: put the ErrorCodes module inside of the Protocol module.

@stenlarsson
Copy link
Contributor Author

The Protocol module is private, so if I do that the error codes will not be visible in the documentation.

@iconara
Copy link
Owner

iconara commented Jul 15, 2015

Good point. It doesn't look like it's possible to make Yard understand that it should show the constants as public under QueryError when they are included there while also hiding ErrorCodes (or even making ErrorCodes visible when Protocol is private).

@iconara iconara merged commit 4317c04 into iconara:master Jul 15, 2015
@iconara
Copy link
Owner

iconara commented Jul 15, 2015

I'll release this as v2.0.5

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

Successfully merging this pull request may close these issues.

2 participants