Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There are a few parts to UUIDs in phpcassa. First, how to generate one. The following functions are useful for this:</p> <pre><code>$my_uuid_string = phpcassa\UUID::uuid1(); $my_uuid_string = phpcassa\UUID::uuid4(); </code></pre> <p>uuid1() generates a v1 UUID, which has a timestamp component, and is called TimeUUIDType in Cassandra. uuid4() generates a totally random UUID, and is called LexicalUUIDType in Cassandra. (The other uuidX() functions aren't generally that useful.) What this function gives you back is a byte array representation of the UUID -- basically a 16 byte string. This is what your <code>"ämªðÏBà=0£Ï‰"</code> string is. When you are trying to insert a UUID into Cassandra, this is what you want to use.</p> <p>It's possible to make a UUID object which has useful methods and attributes from this byte array:</p> <pre><code>$my_uuid = phpcassa\UUID::import($my_uuid_string); </code></pre> <p>With $my_uuid, you can get a pretty string representation like 'd881bf7c-cf8f-11e0-85e5-00234d21610a' by getting <code>$my_uuid-&gt;string</code>. You can get back the byte representation by doing <code>$my_uuid-&gt;bytes</code>. Any uuid data that you get back from Cassandra will by in the byte array format, so you need to use <code>UUID::import()</code> on it if you want a UUID object.</p> <p>Also, <code>UUID::import()</code> also works on the pretty string representation as well (the one that looks like ''d881bf7c-cf8f-11e0-85e5-00234d21610a').</p> <p>Last, don't forget about the documentation for the <a href="http://thobbs.github.io/phpcassa/api/class-phpcassa.UUID.html" rel="nofollow">UUID class</a>.</p> <p><strong>EDIT</strong>: updated links and class names to match the latest phpcassa API</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload