You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -91,7 +91,7 @@ __Note__: if you want to use compression you should also install [snappy](http:/
91
91
92
92
Some of the new features added to the driver have unfortunately led to changes in the original cql-rb API. In the examples directory, you can find [an example of how to wrap the ruby driver to achieve almost complete interface parity with cql-rb](https://github.com/datastax/ruby-driver/blob/master/examples/cql-rb-wrapper.rb) to assist you with gradual upgrade.
Copy file name to clipboardExpand all lines: features/README.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ For queries that will be run repeatedly, [you should use Prepared statements](#p
40
40
**If you're using Cassandra 2.0 or later** you no longer have to build CQL strings when you want to insert a value in a query, there's a new feature that lets you bind values with regular statements:
41
41
42
42
```ruby
43
-
session.execute("UPDATE users SET age = ? WHERE user_name = ?", 41, 'Sam')
43
+
session.execute("UPDATE users SET age = ? WHERE user_name = ?", arguments: [41, 'Sam'])
44
44
```
45
45
46
46
If you find yourself doing this often, it's better to use prepared statements. As a rule of thumb, if your application is sending a request more than once, a prepared statement is almost always the right choice.
@@ -61,7 +61,7 @@ data = [
61
61
62
62
# execute all statements in background
63
63
futures = data.map do |(age, username)|
64
-
session.execute_async("UPDATE users SET age = ? WHERE user_name = ?", age, username)
64
+
session.execute_async("UPDATE users SET age = ? WHERE user_name = ?", arguments: [age, username])
65
65
end
66
66
67
67
# block until both statements executed
@@ -77,7 +77,7 @@ The driver supports prepared statements. Use `#prepare` to create a statement ob
77
77
```ruby
78
78
statement = session.prepare('INSERT INTO users (username, email) VALUES (?, ?)')
You should prepare a statement for a given query **only** once and then resue it by calling #execute. Re-preparing the same statement will have a negative impact on the performance and should be avoided.
0 commit comments