Database Reference
In-Depth Information
Listing 4.11 Example Usage of INSERT Specifying a TTL
Click here to view code image
INSERT INTO events (
event_time,
url,
event_id,
network_location,
event_data
) VALUES (
1365977131666,
'http://www.google.com',
now(),
'10.10.10.10',
'{"browser": "Firefox"}'
) USING TTL 345600;
UPDATE
The UDPATE command ( Listing 4.12 ) is similar to the SQL UPDATE command.
Just as with the INSERT statement, you must specify the PRIMARY KEY as part
of the UPDATE WHERE statement. In addition, the only other difference is that
in CQL the UPDATE command does not check for the existence of the row; if the
row does not exist, CQL will just create it. Because of this, the application can ex-
clusively use UPDATE and not have to use INSERT when modifying data.
Listing 4.12 Example Usage of UPDATE Specifying a TTL
Click here to view code image
UPDATE events USING TTL 345600
SET event_id=now(),
network_location='10.10.10.10',
event_data='{"browser": "Firefox"}'
WHERE event_time=1365977131666
AND url='http://www.google.com';
 
 
Search WWH ::




Custom Search