This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| This is free and unencumbered software released into the public domain. | |
| Anyone is free to copy, modify, publish, use, compile, sell, or | |
| distribute this software, either in source code form or as a compiled | |
| binary, for any purpose, commercial or non-commercial, and by any | |
| means. | |
| In jurisdictions that recognize copyright laws, the author or authors | |
| of this software dedicate any and all copyright interest in the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <new> | |
| #include <iostream> | |
| // Approach #1: Overload global operators | |
| // | |
| // Problem: Our allocator overrides/conflicts with the application's | |
| // allocator when static linking. | |
| void* operator new(size_t size) throw(std::bad_alloc) { | |
| void* p = malloc(size); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cmake_minimum_required(VERSION 3.6) | |
| project(php_driver) | |
| set(CMAKE_C_STANDARD 90) | |
| include_directories(/usr/local/include) | |
| include_directories(${CMAKE_SOURCE_DIR}/ext) | |
| include_directories(${CMAKE_SOURCE_DIR}/ext/src/Cassandra) | |
| include_directories(${CMAKE_SOURCE_DIR}/ext/utils) | |
| include_directories(/usr/local/include/php/) | |
| include_directories(/usr/local/include/php/main/) | |
| include_directories(/usr/local/include/php/Zend/) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| This is free and unencumbered software released into the public domain. | |
| Anyone is free to copy, modify, publish, use, compile, sell, or | |
| distribute this software, either in source code form or as a compiled | |
| binary, for any purpose, commercial or non-commercial, and by any | |
| means. | |
| In jurisdictions that recognize copyright laws, the author or authors | |
| of this software dedicate any and all copyright interest in the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| This is free and unencumbered software released into the public domain. | |
| Anyone is free to copy, modify, publish, use, compile, sell, or | |
| distribute this software, either in source code form or as a compiled | |
| binary, for any purpose, commercial or non-commercial, and by any | |
| means. | |
| In jurisdictions that recognize copyright laws, the author or authors | |
| of this software dedicate any and all copyright interest in the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $cluster = Cassandra::cluster() | |
| ->build(); | |
| $session = $cluster->connect(); | |
| $session->execute("CREATE KEYSPACE IF NOT EXISTS test WITH replication = { 'class': 'SimpleStrategy', 'replication_factor': '3' }"); | |
| $session->execute(new Cassandra\SimpleStatement("CREATE TABLE IF NOT EXISTS test.test (key int PRIMARY KEY, value 'LexicalUUIDType')")); | |
| $session->close(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $cluster = Cassandra::cluster()->build(); | |
| $connectionFuture = $cluster->connectAsync(); | |
| $session = $connectionFuture->get(); | |
| $schema = $session->schema(); | |
| foreach ($schema->keyspaces() as $keyspace) { | |
| foreach ($keyspace->tables() as $table) { | |
| foreach ($table->columns() as $column) | |
| { $column->type(); } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $cluster = Cassandra::cluster()->build(); | |
| $session = $cluster->connect(); | |
| $session->execute(new Cassandra\SimpleStatement( | |
| "CREATE KEYSPACE IF NOT EXISTS simplex | |
| WITH replication = { 'class': 'SimpleStrategy', 'replication_factor': '3' }")); | |
| $session->execute(new Cassandra\SimpleStatement("USE simplex")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdint.h> | |
| void print(uint64_t value) { | |
| printf("%llu\n", (unsigned long long)value); | |
| } | |
| int main() { | |
| print(-1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| This is free and unencumbered software released into the public domain. | |
| Anyone is free to copy, modify, publish, use, compile, sell, or | |
| distribute this software, either in source code form or as a compiled | |
| binary, for any purpose, commercial or non-commercial, and by any | |
| means. | |
| In jurisdictions that recognize copyright laws, the author or authors | |
| of this software dedicate any and all copyright interest in the |