1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

ndb api blobs

This commit is contained in:
unknown
2004-06-10 12:04:30 +02:00
parent 0d6b5946d0
commit 28306758b5
37 changed files with 3397 additions and 177 deletions

View File

@ -19,6 +19,7 @@
#include <string.h>
#include <ndb_types.h>
#include <kernel/ndb_limits.h>
class NdbSqlUtil {
public:
@ -77,7 +78,9 @@ public:
Binary, // Len
Varbinary, // Max len
Datetime, // Precision down to 1 sec (size 8 bytes)
Timespec // Precision down to 1 nsec (size 12 bytes)
Timespec, // Precision down to 1 nsec (size 12 bytes)
Blob, // Blob
Clob // Text blob
};
Enum m_typeId;
Cmp* m_cmp; // set to NULL if cmp not implemented
@ -121,6 +124,8 @@ private:
static Cmp cmpVarbinary;
static Cmp cmpDatetime;
static Cmp cmpTimespec;
static Cmp cmpBlob;
static Cmp cmpClob;
};
inline int
@ -350,6 +355,23 @@ NdbSqlUtil::cmp(Uint32 typeId, const Uint32* p1, const Uint32* p2, Uint32 full,
break;
case Type::Timespec: // XXX fix this
break;
case Type::Blob: // XXX fix
break;
case Type::Clob:
{
// skip blob head, the rest is varchar
const unsigned skip = NDB_BLOB_HEAD_SIZE;
if (size >= skip + 1) {
union { const Uint32* p; const char* v; } u1, u2;
u1.p = p1 + skip;
u2.p = p2 + skip;
// length in first 2 bytes
int k = strncmp(u1.v + 2, u2.v + 2, ((size - skip) << 2) - 2);
return k < 0 ? -1 : k > 0 ? +1 : full == size ? 0 : CmpUnknown;
}
return CmpUnknown;
}
break;
}
return CmpError;
}