-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix python prepared statement uuid binding
- Loading branch information
1 parent
89aba2f
commit 78b8c84
Showing
16 changed files
with
89 additions
and
74 deletions.
There are no files selected for viewing
This file contains 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 file contains 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 file contains 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 file contains 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 file contains 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 file contains 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 file contains 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 file contains 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 file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,33 @@ | ||
#pragma once | ||
// pragma once doesn't appear to work properly on MSVC for this file | ||
#ifndef KUZU_COMMON_TYPES_UUID | ||
#define KUZU_COMMON_TYPES_UUID | ||
|
||
#include "common/types/int128_t.h" | ||
#include "int128_t.h" | ||
|
||
namespace kuzu { | ||
namespace common { | ||
|
||
class RandomEngine; | ||
|
||
struct uuid_t { | ||
constexpr static uint8_t UUID_STRING_LENGTH = 36; | ||
constexpr static char HEX_DIGITS[] = "0123456789abcdef"; | ||
// Note: uuid_t is a reserved keyword in MSVC, we have to use ku_uuid_t instead. | ||
struct ku_uuid_t { | ||
int128_t value; | ||
}; | ||
|
||
struct UUID { | ||
static constexpr const uint8_t UUID_STRING_LENGTH = 36; | ||
static constexpr const char HEX_DIGITS[] = "0123456789abcdef"; | ||
static void byteToHex(char byteVal, char* buf, uint64_t& pos); | ||
static unsigned char hex2Char(char ch); | ||
static inline bool isHex(char ch) { | ||
return (ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F'); | ||
} | ||
|
||
// Convert a uuid string to a int128_t object | ||
static bool isHex(char ch); | ||
static bool fromString(std::string str, int128_t& result); | ||
|
||
static inline int128_t fromString(std::string str) { | ||
int128_t result; | ||
fromString(str, result); | ||
return result; | ||
} | ||
|
||
static inline int128_t fromCString(const char* str, uint64_t len) { | ||
return fromString(std::string(str, len)); | ||
} | ||
|
||
// Convert a int128_t object to a uuid style string | ||
static int128_t fromString(std::string str); | ||
static int128_t fromCString(const char* str, uint64_t len); | ||
static void toString(int128_t input, char* buf); | ||
static std::string toString(int128_t input); | ||
static std::string toString(ku_uuid_t val); | ||
|
||
static inline std::string toString(int128_t input) { | ||
char buff[UUID_STRING_LENGTH]; | ||
toString(input, buff); | ||
return std::string(buff, UUID_STRING_LENGTH); | ||
} | ||
inline std::string toString() const { return toString(value); } | ||
|
||
int128_t value; | ||
|
||
// generate a random uuid object | ||
static uuid_t generateRandomUUID(RandomEngine* engine); | ||
static ku_uuid_t generateRandomUUID(RandomEngine* engine); | ||
}; | ||
|
||
} // namespace common | ||
} // namespace kuzu | ||
#endif |
This file contains 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 file contains 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 file contains 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 file contains 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 file contains 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
Oops, something went wrong.