1
0
mirror of https://github.com/stefanocasazza/ULib.git synced 2025-09-28 19:05:55 +08:00
This commit is contained in:
stefanocasazza 2018-06-22 14:17:50 +02:00
parent 836450f95d
commit cc9ba072d8
24 changed files with 206 additions and 254 deletions

View File

@ -488,10 +488,10 @@ static inline void u_put_unalignedp64( void* p, uint64_t val) { s
#define U_NUMBER_SUFFIX(num,suffix) \
switch (suffix) { \
case 'G': num <<= 10; /* FALLTHRU */ \
case 'M': num <<= 10; /* FALLTHRU */ \
case 'K': /* FALLTHRU */ \
case 'k': num <<= 10; /* FALLTHRU */ }
case 'G': num <<= 10; /* FALL THRU */ \
case 'M': num <<= 10; /* FALL THRU */ \
case 'K': /* FALL THRU */ \
case 'k': num <<= 10; /* FALL THRU */ }
#endif
/* Optimization if it is enough a resolution of one second */

View File

@ -242,10 +242,10 @@ extern U_EXPORT uclientimage_info u_clientimage_info;
#define U_http_content_type_len u_clientimage_info.http_info.flag[10]
#define U_http_accept_language_len u_clientimage_info.http_info.flag[11]
#define U_http_flag u_clientimage_info.http_info.flag[12]
#define U_http_usp_flag u_clientimage_info.http_info.flag[13]
#define U_http_len_user1 u_clientimage_info.http_info.flag[13]
#define U_http_len_user2 u_clientimage_info.http_info.flag[14]
#define U_http_len_user3 u_clientimage_info.http_info.flag[15]
#define U_http_len_user1 u_clientimage_info.http_info.flag[14]
#define U_http_len_user2 u_clientimage_info.http_info.flag[15]
enum HttpRequestType {
HTTP_IS_KEEP_ALIVE = 0x01,

View File

@ -151,6 +151,13 @@ public:
is_unsigned = false;
}
explicit UMySqlStatementBindParam(UString& s) : USqlStatementBindParam(s)
{
U_TRACE_CTOR(0, UMySqlStatementBindParam, "%V", s.rep)
type = U_UTF_VALUE;
}
explicit UMySqlStatementBindParam(const char* s, int n, bool bstatic) : USqlStatementBindParam(s, n, bstatic)
{
U_TRACE_CTOR(0, UMySqlStatementBindParam, "%.*S,%u,%b", n, s, n, bstatic)
@ -406,7 +413,10 @@ public:
virtual USqlStatementBindParam* creatSqlStatementBindParam(unsigned long long* v)
{ UMySqlStatementBindParam* r; U_NEW(UMySqlStatementBindParam, r, UMySqlStatementBindParam(v)); return r; }
virtual USqlStatementBindParam* creatSqlStatementBindParam(USqlStatement* pstmt, const char* s, int n, bool bstatic, int rebind);
virtual USqlStatementBindParam* creatSqlStatementBindParam(UString& s)
{ UMySqlStatementBindParam* r; U_NEW(UMySqlStatementBindParam, r, UMySqlStatementBindParam(s)); return r; }
virtual USqlStatementBindParam* creatSqlStatementBindParam(USqlStatement* pstmt, const char* s, uint32_t n, bool bstatic, int rebind);
// CREATE BIND RESULT

View File

@ -190,6 +190,13 @@ public:
length = sizeof(double);
}
explicit UPgSqlStatementBindParam(UString& s) : USqlStatementBindParam(s)
{
U_TRACE_CTOR(0, UPgSqlStatementBindParam, "%V", s.rep)
type = U_UTF_VALUE;
}
explicit UPgSqlStatementBindParam(const char* s, int n, bool bstatic) : USqlStatementBindParam(s, n, bstatic)
{
U_TRACE_CTOR(0, UPgSqlStatementBindParam, "%.*S,%u,%b", n, s, n, bstatic)
@ -471,7 +478,10 @@ public:
virtual USqlStatementBindParam* creatSqlStatementBindParam(unsigned long long* v)
{ UPgSqlStatementBindParam* r; U_NEW(UPgSqlStatementBindParam, r, UPgSqlStatementBindParam(v)); return r; }
virtual USqlStatementBindParam* creatSqlStatementBindParam(USqlStatement* pstmt, const char* s, int n, bool bstatic, int rebind);
virtual USqlStatementBindParam* creatSqlStatementBindParam(UString& s)
{ UPgSqlStatementBindParam* r; U_NEW(UPgSqlStatementBindParam, r, UPgSqlStatementBindParam(s)); return r; }
virtual USqlStatementBindParam* creatSqlStatementBindParam(USqlStatement* pstmt, const char* s, uint32_t n, bool bstatic, int rebind);
// CREATE BIND RESULT

View File

@ -132,7 +132,14 @@ public:
type = U_REAL_VALUE;
}
explicit USqliteStatementBindParam(const char* s, int n, bool bstatic) : USqlStatementBindParam(s, n, bstatic)
explicit USqliteStatementBindParam(UString& s) : USqlStatementBindParam(s)
{
U_TRACE_CTOR(0, USqliteStatementBindParam, "%V", s.rep)
type = U_UTF_VALUE;
}
explicit USqliteStatementBindParam(const char* s, uint32_t n, bool bstatic) : USqlStatementBindParam(s, n, bstatic)
{
U_TRACE_CTOR(0, USqliteStatementBindParam, "%.*S,%u,%b", n, s, n, bstatic)
@ -398,7 +405,10 @@ public:
virtual USqlStatementBindParam* creatSqlStatementBindParam(unsigned long long* v)
{ USqliteStatementBindParam* r; U_NEW(USqliteStatementBindParam, r, USqliteStatementBindParam(v)); return r; }
virtual USqlStatementBindParam* creatSqlStatementBindParam(USqlStatement* pstmt, const char* s, int n, bool bstatic, int rebind);
virtual USqlStatementBindParam* creatSqlStatementBindParam(UString& s)
{ USqliteStatementBindParam* r; U_NEW(USqliteStatementBindParam, r, USqliteStatementBindParam(s)); return r; }
virtual USqlStatementBindParam* creatSqlStatementBindParam(USqlStatement* pstmt, const char* s, uint32_t n, bool bstatic, int rebind);
// CREATE BIND RESULT

View File

@ -270,7 +270,6 @@ public:
#endif
void bindParam(long long& v);
void bindParam(struct tm& v);
void bindParam(UStringRep& v);
void bindParam(const char* s);
void bindParam(long double& v);
void bindParam(unsigned int& v);
@ -279,7 +278,10 @@ public:
void bindParam(unsigned short& v);
void bindParam(unsigned long long& v);
void bindParam(const char* b, const char* e);
void bindParam(const char* s, int n, bool bstatic, int rebind = -1);
void bindParam(const char* s, uint32_t n, bool bstatic, int rebind = -1);
void bindParam(UString& v);
void bindParam(UStringRep& v);
template <typename T> void bindParam(UOrmTypeHandler<T> t)
{
@ -855,7 +857,7 @@ public:
{
U_TRACE(0, "UOrmTypeHandler<UString>::bindParam(%p)", stmt)
stmt->bindParam(*((UString*)pval)->rep);
stmt->bindParam(*(UString*)pval);
}
void bindResult(UOrmStatement* stmt)

View File

@ -51,13 +51,29 @@ public:
is_unsigned = false;
}
explicit USqlStatementBindParam(const char* s, int n, bool bstatic);
explicit USqlStatementBindParam(UString& s)
{
U_TRACE_CTOR(0, USqlStatementBindParam, "%V", s.rep)
buffer = s.data();
length = s.capacity();
pstr = &s;
type = 0;
is_unsigned = false;
}
explicit USqlStatementBindParam(const char* s, uint32_t n, bool bstatic);
virtual ~USqlStatementBindParam()
{
U_TRACE_DTOR(0, USqlStatementBindParam)
if (pstr) U_DELETE(pstr)
if (pstr &&
type != U_UTF_VALUE)
{
U_DELETE(pstr)
}
}
// DEBUG
@ -323,12 +339,17 @@ public:
U_INTERNAL_ASSERT_POINTER(pstmt)
USqlStatementBindParam* ptr = creatSqlStatementBindParam();
pstmt->bindParam(ptr);
pstmt->bindParam(creatSqlStatementBindParam());
}
void bindParam(USqlStatement* pstmt, const char* s, int n, bool bstatic, int rebind)
void bindParam(USqlStatement* pstmt, UString& s)
{
U_TRACE(0, "UOrmDriver::bindParam(%p,%V)", pstmt, s.rep)
pstmt->bindParam(creatSqlStatementBindParam(s));
}
void bindParam(USqlStatement* pstmt, const char* s, uint32_t n, bool bstatic, int rebind)
{
U_TRACE(0, "UOrmDriver::bindParam(%p,%.*S,%u,%b,%d)", pstmt, n, s, n, bstatic, rebind)
@ -345,9 +366,7 @@ public:
U_INTERNAL_ASSERT_POINTER(pstmt)
USqlStatementBindParam* ptr = creatSqlStatementBindParam(v);
pstmt->bindParam(ptr);
pstmt->bindParam(creatSqlStatementBindParam(v));
}
template <typename T> void bindParam(USqlStatement* pstmt, T& v)
@ -356,9 +375,7 @@ public:
U_INTERNAL_ASSERT_POINTER(pstmt)
USqlStatementBindParam* ptr = creatSqlStatementBindParam(&v);
pstmt->bindParam(ptr);
pstmt->bindParam(creatSqlStatementBindParam(&v));
}
template <typename T> void bindResult(USqlStatement* pstmt, T* v)
@ -487,6 +504,7 @@ public:
virtual USqlStatementBindParam* creatSqlStatementBindParam(short* v) { return U_NULLPTR; }
virtual USqlStatementBindParam* creatSqlStatementBindParam(float* v) { return U_NULLPTR; }
virtual USqlStatementBindParam* creatSqlStatementBindParam(double* v) { return U_NULLPTR; }
virtual USqlStatementBindParam* creatSqlStatementBindParam(UString& s) { return U_NULLPTR; }
virtual USqlStatementBindParam* creatSqlStatementBindParam(long long* v) { return U_NULLPTR; }
virtual USqlStatementBindParam* creatSqlStatementBindParam(long double* v) { return U_NULLPTR; }
virtual USqlStatementBindParam* creatSqlStatementBindParam(unsigned int* v) { return U_NULLPTR; }
@ -495,7 +513,7 @@ public:
virtual USqlStatementBindParam* creatSqlStatementBindParam(unsigned short* v) { return U_NULLPTR; }
virtual USqlStatementBindParam* creatSqlStatementBindParam(unsigned long long* v) { return U_NULLPTR; }
virtual USqlStatementBindParam* creatSqlStatementBindParam(USqlStatement* pstmt, const char* s, int n, bool bstatic, int rebind);
virtual USqlStatementBindParam* creatSqlStatementBindParam(USqlStatement* pstmt, const char* s, uint32_t n, bool bstatic, int rebind);
// CREATE BIND RESULT

View File

@ -195,15 +195,15 @@ static inline char* u_itoa(uint32_t u, char* restrict p, uint32_t d, uint32_t n)
{
switch (n)
{
case 10: d = u / 100000000; p = out(d, p); /* FALLTHRU */
case 9: u -= d * 100000000; /* FALLTHRU */
case 8: d = u / 1000000; p = out(d, p); /* FALLTHRU */
case 7: u -= d * 1000000; /* FALLTHRU */
case 6: d = u / 10000; p = out(d, p); /* FALLTHRU */
case 5: u -= d * 10000; /* FALLTHRU */
case 4: d = u / 100; p = out(d, p); /* FALLTHRU */
case 3: u -= d * 100; /* FALLTHRU */
case 2: d = u / 1; p = out(d, p); /* FALLTHRU */
case 10: d = u / 100000000; p = out(d, p); /* FALL THRU */
case 9: u -= d * 100000000; /* FALL THRU */
case 8: d = u / 1000000; p = out(d, p); /* FALL THRU */
case 7: u -= d * 1000000; /* FALL THRU */
case 6: d = u / 10000; p = out(d, p); /* FALL THRU */
case 5: u -= d * 10000; /* FALL THRU */
case 4: d = u / 100; p = out(d, p); /* FALL THRU */
case 3: u -= d * 100; /* FALL THRU */
case 2: d = u / 1; p = out(d, p); /* FALL THRU */
case 1: ;
}

View File

@ -67,22 +67,22 @@ __pure unsigned long u_hex2int(const char* restrict s, uint32_t len) /* handle u
#ifndef U_COVERITY_FALSE_POSITIVE /* Control flow issues (MISSING_BREAK) */
switch (len)
{
case 16: val = (val << 4) | u__hexc2int(s[len-16]); /* FALLTHRU */
case 15: val = (val << 4) | u__hexc2int(s[len-15]); /* FALLTHRU */
case 14: val = (val << 4) | u__hexc2int(s[len-14]); /* FALLTHRU */
case 13: val = (val << 4) | u__hexc2int(s[len-13]); /* FALLTHRU */
case 12: val = (val << 4) | u__hexc2int(s[len-12]); /* FALLTHRU */
case 11: val = (val << 4) | u__hexc2int(s[len-11]); /* FALLTHRU */
case 10: val = (val << 4) | u__hexc2int(s[len-10]); /* FALLTHRU */
case 9: val = (val << 4) | u__hexc2int(s[len- 9]); /* FALLTHRU */
case 8: val = (val << 4) | u__hexc2int(s[len- 8]); /* FALLTHRU */
case 7: val = (val << 4) | u__hexc2int(s[len- 7]); /* FALLTHRU */
case 6: val = (val << 4) | u__hexc2int(s[len- 6]); /* FALLTHRU */
case 5: val = (val << 4) | u__hexc2int(s[len- 5]); /* FALLTHRU */
case 4: val = (val << 4) | u__hexc2int(s[len- 4]); /* FALLTHRU */
case 3: val = (val << 4) | u__hexc2int(s[len- 3]); /* FALLTHRU */
case 2: val = (val << 4) | u__hexc2int(s[len- 2]); /* FALLTHRU */
case 1: val = (val << 4) | u__hexc2int(s[len- 1]); /* FALLTHRU */
case 16: val = (val << 4) | u__hexc2int(s[len-16]); /* FALL THRU */
case 15: val = (val << 4) | u__hexc2int(s[len-15]); /* FALL THRU */
case 14: val = (val << 4) | u__hexc2int(s[len-14]); /* FALL THRU */
case 13: val = (val << 4) | u__hexc2int(s[len-13]); /* FALL THRU */
case 12: val = (val << 4) | u__hexc2int(s[len-12]); /* FALL THRU */
case 11: val = (val << 4) | u__hexc2int(s[len-11]); /* FALL THRU */
case 10: val = (val << 4) | u__hexc2int(s[len-10]); /* FALL THRU */
case 9: val = (val << 4) | u__hexc2int(s[len- 9]); /* FALL THRU */
case 8: val = (val << 4) | u__hexc2int(s[len- 8]); /* FALL THRU */
case 7: val = (val << 4) | u__hexc2int(s[len- 7]); /* FALL THRU */
case 6: val = (val << 4) | u__hexc2int(s[len- 6]); /* FALL THRU */
case 5: val = (val << 4) | u__hexc2int(s[len- 5]); /* FALL THRU */
case 4: val = (val << 4) | u__hexc2int(s[len- 4]); /* FALL THRU */
case 3: val = (val << 4) | u__hexc2int(s[len- 3]); /* FALL THRU */
case 2: val = (val << 4) | u__hexc2int(s[len- 2]); /* FALL THRU */
case 1: val = (val << 4) | u__hexc2int(s[len- 1]); /* FALL THRU */
}
#endif
@ -103,15 +103,15 @@ __pure unsigned long u__strtoul(const char* restrict s, uint32_t len) /* handle
#ifndef U_COVERITY_FALSE_POSITIVE /* Control flow issues (MISSING_BREAK) */
switch (len)
{
case 10: val += (s[len-10] - '0') * 1000000000UL; /* FALLTHRU */
case 9: val += (s[len- 9] - '0') * 100000000UL; /* FALLTHRU */
case 8: val += (s[len- 8] - '0') * 10000000UL; /* FALLTHRU */
case 7: val += (s[len- 7] - '0') * 1000000UL; /* FALLTHRU */
case 6: val += (s[len- 6] - '0') * 100000UL; /* FALLTHRU */
case 5: val += (s[len- 5] - '0') * 10000UL; /* FALLTHRU */
case 4: val += (s[len- 4] - '0') * 1000UL; /* FALLTHRU */
case 3: val += (s[len- 3] - '0') * 100UL; /* FALLTHRU */
case 2: val += (s[len- 2] - '0') * 10UL; /* FALLTHRU */
case 10: val += (s[len-10] - '0') * 1000000000UL; /* FALL THRU */
case 9: val += (s[len- 9] - '0') * 100000000UL; /* FALL THRU */
case 8: val += (s[len- 8] - '0') * 10000000UL; /* FALL THRU */
case 7: val += (s[len- 7] - '0') * 1000000UL; /* FALL THRU */
case 6: val += (s[len- 6] - '0') * 100000UL; /* FALL THRU */
case 5: val += (s[len- 5] - '0') * 10000UL; /* FALL THRU */
case 4: val += (s[len- 4] - '0') * 1000UL; /* FALL THRU */
case 3: val += (s[len- 3] - '0') * 100UL; /* FALL THRU */
case 2: val += (s[len- 2] - '0') * 10UL; /* FALL THRU */
case 1: val += (s[len- 1] - '0');
}
#endif
@ -133,26 +133,26 @@ __pure uint64_t u__strtoull(const char* restrict s, uint32_t len)
#ifndef U_COVERITY_FALSE_POSITIVE /* Control flow issues (MISSING_BREAK) */
switch (len)
{
case 20: val += (s[len-20] - '0') * 10000000000000000000ULL; /* FALLTHRU */
case 19: val += (s[len-19] - '0') * 1000000000000000000ULL; /* FALLTHRU */
case 18: val += (s[len-18] - '0') * 100000000000000000ULL; /* FALLTHRU */
case 17: val += (s[len-17] - '0') * 10000000000000000ULL; /* FALLTHRU */
case 16: val += (s[len-16] - '0') * 1000000000000000ULL; /* FALLTHRU */
case 15: val += (s[len-15] - '0') * 100000000000000ULL; /* FALLTHRU */
case 14: val += (s[len-14] - '0') * 10000000000000ULL; /* FALLTHRU */
case 13: val += (s[len-13] - '0') * 1000000000000ULL; /* FALLTHRU */
case 12: val += (s[len-12] - '0') * 100000000000ULL; /* FALLTHRU */
case 11: val += (s[len-11] - '0') * 10000000000ULL; /* FALLTHRU */
case 10: val += (s[len-10] - '0') * 1000000000ULL; /* FALLTHRU */
case 9: val += (s[len- 9] - '0') * 100000000ULL; /* FALLTHRU */
case 8: val += (s[len- 8] - '0') * 10000000ULL; /* FALLTHRU */
case 7: val += (s[len- 7] - '0') * 1000000ULL; /* FALLTHRU */
case 6: val += (s[len- 6] - '0') * 100000ULL; /* FALLTHRU */
case 5: val += (s[len- 5] - '0') * 10000ULL; /* FALLTHRU */
case 4: val += (s[len- 4] - '0') * 1000ULL; /* FALLTHRU */
case 3: val += (s[len- 3] - '0') * 100ULL; /* FALLTHRU */
case 2: val += (s[len- 2] - '0') * 10ULL; /* FALLTHRU */
case 1: val += (s[len- 1] - '0'); /* FALLTHRU */
case 20: val += (s[len-20] - '0') * 10000000000000000000ULL; /* FALL THRU */
case 19: val += (s[len-19] - '0') * 1000000000000000000ULL; /* FALL THRU */
case 18: val += (s[len-18] - '0') * 100000000000000000ULL; /* FALL THRU */
case 17: val += (s[len-17] - '0') * 10000000000000000ULL; /* FALL THRU */
case 16: val += (s[len-16] - '0') * 1000000000000000ULL; /* FALL THRU */
case 15: val += (s[len-15] - '0') * 100000000000000ULL; /* FALL THRU */
case 14: val += (s[len-14] - '0') * 10000000000000ULL; /* FALL THRU */
case 13: val += (s[len-13] - '0') * 1000000000000ULL; /* FALL THRU */
case 12: val += (s[len-12] - '0') * 100000000000ULL; /* FALL THRU */
case 11: val += (s[len-11] - '0') * 10000000000ULL; /* FALL THRU */
case 10: val += (s[len-10] - '0') * 1000000000ULL; /* FALL THRU */
case 9: val += (s[len- 9] - '0') * 100000000ULL; /* FALL THRU */
case 8: val += (s[len- 8] - '0') * 10000000ULL; /* FALL THRU */
case 7: val += (s[len- 7] - '0') * 1000000ULL; /* FALL THRU */
case 6: val += (s[len- 6] - '0') * 100000ULL; /* FALL THRU */
case 5: val += (s[len- 5] - '0') * 10000ULL; /* FALL THRU */
case 4: val += (s[len- 4] - '0') * 1000ULL; /* FALL THRU */
case 3: val += (s[len- 3] - '0') * 100ULL; /* FALL THRU */
case 2: val += (s[len- 2] - '0') * 10ULL; /* FALL THRU */
case 1: val += (s[len- 1] - '0'); /* FALL THRU */
}
#endif
@ -1941,7 +1941,7 @@ __pure bool u_dosmatch_ext(const char* restrict s, uint32_t n1, const char* rest
}
}
/* FALLTHRU */
/* FALL THRU */
default:
{

View File

@ -913,17 +913,17 @@ void UValue::fromFlatBufferToJSON(UFlatBuffer& fb)
switch (type)
{
case UFlatBufferValue::TYPE_VECTOR_INT4: setInt64( vec.AsTypedOrFixedVectorGet< int64_t>(i++)); sd[pos].tails = insertAfter(sd[pos].tails, o.ival); /* FALLTHRU */
case UFlatBufferValue::TYPE_VECTOR_INT3: setInt64( vec.AsTypedOrFixedVectorGet< int64_t>(i++)); sd[pos].tails = insertAfter(sd[pos].tails, o.ival); /* FALLTHRU */
case UFlatBufferValue::TYPE_VECTOR_INT2: setInt64( vec.AsTypedOrFixedVectorGet< int64_t>(i++)); sd[pos].tails = insertAfter(sd[pos].tails, o.ival); /* FALLTHRU */
case UFlatBufferValue::TYPE_VECTOR_INT4: setInt64( vec.AsTypedOrFixedVectorGet< int64_t>(i++)); sd[pos].tails = insertAfter(sd[pos].tails, o.ival); /* FALL THRU */
case UFlatBufferValue::TYPE_VECTOR_INT3: setInt64( vec.AsTypedOrFixedVectorGet< int64_t>(i++)); sd[pos].tails = insertAfter(sd[pos].tails, o.ival); /* FALL THRU */
case UFlatBufferValue::TYPE_VECTOR_INT2: setInt64( vec.AsTypedOrFixedVectorGet< int64_t>(i++)); sd[pos].tails = insertAfter(sd[pos].tails, o.ival); /* FALL THRU */
case UFlatBufferValue::TYPE_VECTOR_INT: setInt64( vec.AsTypedOrFixedVectorGet< int64_t>(i++)); sd[pos].tails = insertAfter(sd[pos].tails, o.ival); break;
case UFlatBufferValue::TYPE_VECTOR_UINT4: setUInt64(vec.AsTypedOrFixedVectorGet<uint64_t>(i++)); sd[pos].tails = insertAfter(sd[pos].tails, o.ival); /* FALLTHRU */
case UFlatBufferValue::TYPE_VECTOR_UINT3: setUInt64(vec.AsTypedOrFixedVectorGet<uint64_t>(i++)); sd[pos].tails = insertAfter(sd[pos].tails, o.ival); /* FALLTHRU */
case UFlatBufferValue::TYPE_VECTOR_UINT2: setUInt64(vec.AsTypedOrFixedVectorGet<uint64_t>(i++)); sd[pos].tails = insertAfter(sd[pos].tails, o.ival); /* FALLTHRU */
case UFlatBufferValue::TYPE_VECTOR_UINT4: setUInt64(vec.AsTypedOrFixedVectorGet<uint64_t>(i++)); sd[pos].tails = insertAfter(sd[pos].tails, o.ival); /* FALL THRU */
case UFlatBufferValue::TYPE_VECTOR_UINT3: setUInt64(vec.AsTypedOrFixedVectorGet<uint64_t>(i++)); sd[pos].tails = insertAfter(sd[pos].tails, o.ival); /* FALL THRU */
case UFlatBufferValue::TYPE_VECTOR_UINT2: setUInt64(vec.AsTypedOrFixedVectorGet<uint64_t>(i++)); sd[pos].tails = insertAfter(sd[pos].tails, o.ival); /* FALL THRU */
case UFlatBufferValue::TYPE_VECTOR_UINT: setUInt64(vec.AsTypedOrFixedVectorGet<uint64_t>(i++)); sd[pos].tails = insertAfter(sd[pos].tails, o.ival); break;
case UFlatBufferValue::TYPE_VECTOR_FLOAT4: setDouble(vec.AsTypedOrFixedVectorGet<double>( i++)); sd[pos].tails = insertAfter(sd[pos].tails, o.ival); /* FALLTHRU */
case UFlatBufferValue::TYPE_VECTOR_FLOAT3: setDouble(vec.AsTypedOrFixedVectorGet<double>( i++)); sd[pos].tails = insertAfter(sd[pos].tails, o.ival); /* FALLTHRU */
case UFlatBufferValue::TYPE_VECTOR_FLOAT2: setDouble(vec.AsTypedOrFixedVectorGet<double>( i++)); sd[pos].tails = insertAfter(sd[pos].tails, o.ival); /* FALLTHRU */
case UFlatBufferValue::TYPE_VECTOR_FLOAT4: setDouble(vec.AsTypedOrFixedVectorGet<double>( i++)); sd[pos].tails = insertAfter(sd[pos].tails, o.ival); /* FALL THRU */
case UFlatBufferValue::TYPE_VECTOR_FLOAT3: setDouble(vec.AsTypedOrFixedVectorGet<double>( i++)); sd[pos].tails = insertAfter(sd[pos].tails, o.ival); /* FALL THRU */
case UFlatBufferValue::TYPE_VECTOR_FLOAT2: setDouble(vec.AsTypedOrFixedVectorGet<double>( i++)); sd[pos].tails = insertAfter(sd[pos].tails, o.ival); /* FALL THRU */
case UFlatBufferValue::TYPE_VECTOR_FLOAT: setDouble(vec.AsTypedOrFixedVectorGet<double>( i++)); sd[pos].tails = insertAfter(sd[pos].tails, o.ival);
break;
}
@ -1461,21 +1461,21 @@ case_number:
# ifndef U_COVERITY_FALSE_POSITIVE // Control flow issues (MISSING_BREAK)
switch (decimalDigit)
{
case 15: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit-15] - '0'); /* FALLTHRU */
case 14: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit-14] - '0'); /* FALLTHRU */
case 13: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit-13] - '0'); /* FALLTHRU */
case 12: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit-12] - '0'); /* FALLTHRU */
case 11: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit-11] - '0'); /* FALLTHRU */
case 10: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit-10] - '0'); /* FALLTHRU */
case 9: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit- 9] - '0'); /* FALLTHRU */
case 8: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit- 8] - '0'); /* FALLTHRU */
case 7: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit- 7] - '0'); /* FALLTHRU */
case 6: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit- 6] - '0'); /* FALLTHRU */
case 5: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit- 5] - '0'); /* FALLTHRU */
case 4: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit- 4] - '0'); /* FALLTHRU */
case 3: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit- 3] - '0'); /* FALLTHRU */
case 2: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit- 2] - '0'); /* FALLTHRU */
case 1: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit- 1] - '0'); /* FALLTHRU */
case 15: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit-15] - '0'); /* FALL THRU */
case 14: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit-14] - '0'); /* FALL THRU */
case 13: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit-13] - '0'); /* FALL THRU */
case 12: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit-12] - '0'); /* FALL THRU */
case 11: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit-11] - '0'); /* FALL THRU */
case 10: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit-10] - '0'); /* FALL THRU */
case 9: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit- 9] - '0'); /* FALL THRU */
case 8: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit- 8] - '0'); /* FALL THRU */
case 7: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit- 7] - '0'); /* FALL THRU */
case 6: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit- 6] - '0'); /* FALL THRU */
case 5: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit- 5] - '0'); /* FALL THRU */
case 4: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit- 4] - '0'); /* FALL THRU */
case 3: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit- 3] - '0'); /* FALL THRU */
case 2: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit- 2] - '0'); /* FALL THRU */
case 1: integerPart = (integerPart << 3) + (integerPart << 1) + (p[decimalDigit- 1] - '0'); /* FALL THRU */
}
# endif

View File

@ -457,7 +457,7 @@ int UFCGIPlugIn::handlerRequest()
}
}
/* FALLTHRU */
/* FALL THRU */
case FCGI_UNKNOWN_TYPE:
case FCGI_GET_VALUES_RESULT:

View File

@ -109,9 +109,7 @@ private:
Content-Type: application/jsonrequest
-->
<!--#code
U_INTERNAL_DUMP("U_HTTP_CTYPE = %.*S", U_HTTP_CTYPE_TO_TRACE)
if (U_HTTP_CTYPE_STREQ("application/jsonrequest"))
if (U_HTTP_CTYPE_MEMEQ("application/jsonrequest"))
{
Request request;

View File

@ -1,90 +0,0 @@
// update.cpp - dynamic page translation (update.usp => update.cpp)
#include <ulib/net/server/usp_macro.h>
#include "world.h"
static char* pquery;
static char query[8192];
static UOrmStatement* pstmt_update;
static void usp_fork_update()
{
U_TRACE(5, "::usp_fork_update()")
World::handlerForkSql();
if (World::psql_query)
{
if (UOrmDriver::isAsyncPipelineModeAvaliable()) (void) memcpy(query, U_CONSTANT_TO_PARAM("UPDATE World SET randomNumber = v.randomNumber FROM (VALUES"));
else
{
U_NEW(UOrmStatement, pstmt_update, UOrmStatement(*World::psql_query, U_CONSTANT_TO_PARAM("UPDATE World SET randomNumber = ? WHERE id = ?")));
pstmt_update->use(World::pworld_query->randomNumber, World::pworld_query->id);
}
}
}
static void usp_end_update()
{
U_TRACE(5, "::usp_end_update()")
World::handlerEndSql();
if (pstmt_update)
{
U_DELETE(pstmt_update)
pstmt_update = U_NULLPTR;
}
}
extern "C" {
extern U_EXPORT void runDynamicPage_update(int param);
U_EXPORT void runDynamicPage_update(int param)
{
U_TRACE(0, "::runDynamicPage_update(%d)", param)
if (param)
{
if (param == U_DPAGE_DESTROY) { usp_end_update(); return; }
if (param == U_DPAGE_FORK) { usp_fork_update(); return; }
return;
}
U_ASSERT_EQUALS(UClientImage_Base::wbuffer->findEndHeader(),false)
U_http_info.endHeader = 34;
U_http_content_type_len = 1;
(void) UClientImage_Base::wbuffer->insert(0, U_CONSTANT_TO_PARAM("Content-Type: application/json\r\n\r\n"));
UClientImage_Base::setRequestNoCache();
uint32_t i, num_queries = UHTTP::getFormFirstNumericValue(1, 500);
World::initResult(num_queries);
if (UOrmDriver::isAsyncPipelineModeAvaliable() == false)
{
for (i = 0; i < num_queries; ++i)
{
World::pworld_query->id = World::rnumber[i];
World::pstmt_query->execute();
World::pworld_query->randomNumber = u_get_num_random(10000-1);
pstmt_update->execute();
World::handlerResultSql(i);
}
World::endResult();
return;
}
(void) World::pstmt_query->asyncPipelineMode(World::handlerResult);
pquery = query + U_CONSTANT_SIZE("UPDATE World SET randomNumber = v.randomNumber FROM (VALUES");
for (i = 0; i < num_queries; ++i)
{
*pquery++ = '(';
pquery = u_num2str32(World::pworld_query->id = World::rnumber[i], pquery);
(void) World::pstmt_query->asyncPipelineSendQueryPrepared(i);
*pquery++ = ',';
pquery = u_num2str32(World::pworld_query->randomNumber = u_get_num_random(10000-1), pquery);
u_put_unalignedp16(pquery, U_MULTICHAR_CONSTANT16(')',','));
pquery += 2;
World::handlerResultSql(i);
}
World::endResult();
(void) memcpy(pquery-1, ") AS v (id,randomNumber) WHERE World.id = v.id;",
U_CONSTANT_SIZE(") AS v (id,randomNumber) WHERE World.id = v.id;")+1);
(void) World::pstmt_query->asyncPipelineSendQuery(query, pquery+U_CONSTANT_SIZE(") AS v (id,randomNumber) WHERE World.id = v.id;")-1-query, num_queries);
} }

View File

@ -26,22 +26,6 @@ static void usp_fork_update()
}
}
}
#ifdef DEBUG
static void usp_end_update()
{
U_TRACE(5, "::usp_end_update()")
World::handlerEndSql();
if (pstmt_update)
{
U_DELETE(pstmt_update)
pstmt_update = U_NULLPTR;
}
}
#endif
-->
<!--#header
Content-Type: application/json

View File

@ -484,7 +484,7 @@ public:
(void) http_header.snprintf(U_CONSTANT_TO_PARAM("\n\tU_ASSERT_EQUALS(UClientImage_Base::wbuffer->findEndHeader(),false)"
"\n\tU_http_info.endHeader = %u;%.*s"
"\n\t(void) UClientImage_Base::wbuffer->insert(0, U_CONSTANT_TO_PARAM(%v));\n\t\n"), n,
(bheader ? U_CONSTANT_SIZE("\n\tU_http_content_type_len = 1;\n\t\n") : 0), "\n\tU_http_content_type_len = 1;\n\t\n",
(bheader ? U_CONSTANT_SIZE("\n\tU_http_usp_flag = 1;\n\t\n") : 0), "\n\tU_http_usp_flag = 1;\n\t\n",
encoded.rep);
}
else if (strncmp(directive, U_CONSTANT_TO_PARAM("number")) == 0)

View File

@ -204,7 +204,8 @@ UOrmDriver* UOrmDriverMySql::handlerConnect(const UString& option)
U_INTERNAL_ASSERT(pdrv->dbname.isNullTerminated())
if (U_SYSCALL(mysql_real_connect,"%p,%S,%S,%S,%S,%u,%S,%lu",(MYSQL*)pdrv->connection,host.data(),user.data(),password.data(),pdrv->dbname.data(),(unsigned int)port,U_NULLPTR,0L) == U_NULLPTR)
if (U_SYSCALL(mysql_real_connect,"%p,%S,%S,%S,%S,%u,%S,%lu", (MYSQL*)pdrv->connection, host.data(), user.data(),
password.data(), pdrv->dbname.data(), (unsigned int)port, U_NULLPTR, 0L) == U_NULLPTR)
{
pdrv->printError(__PRETTY_FUNCTION__);
@ -384,7 +385,7 @@ bool UMySqlStatement::setBindParam(UOrmDriver* pdrv)
U_RETURN(true);
}
USqlStatementBindParam* UOrmDriverMySql::creatSqlStatementBindParam(USqlStatement* pstmt, const char* s, int n, bool bstatic, int rebind)
USqlStatementBindParam* UOrmDriverMySql::creatSqlStatementBindParam(USqlStatement* pstmt, const char* s, uint32_t n, bool bstatic, int rebind)
{
U_TRACE(0, "UOrmDriverMySql::creatSqlStatementBindParam(%p,%.*S,%u,%b,%d)", pstmt, n, s, n, bstatic, rebind)

View File

@ -414,7 +414,7 @@ bool UPgSqlStatement::setBindParam(UOrmDriver* pdrv)
U_RETURN(true);
}
USqlStatementBindParam* UOrmDriverPgSql::creatSqlStatementBindParam(USqlStatement* pstmt, const char* s, int n, bool bstatic, int rebind)
USqlStatementBindParam* UOrmDriverPgSql::creatSqlStatementBindParam(USqlStatement* pstmt, const char* s, uint32_t n, bool bstatic, int rebind)
{
U_TRACE(0, "UOrmDriverPgSql::creatSqlStatementBindParam(%p,%.*S,%u,%b,%d)", pstmt, n, s, n, bstatic, rebind)

View File

@ -395,6 +395,16 @@ bool USqliteStatement::setBindParam(UOrmDriver* pdrv)
}
break;
case U_UTF_VALUE:
{
U_INTERNAL_ASSERT_POINTER(param->pstr)
param->buffer = param->pstr->data();
param->length = param->pstr->size();
}
/* FALL THRU */
case U_STRING_VALUE:
{
/**
@ -423,7 +433,7 @@ bool USqliteStatement::setBindParam(UOrmDriver* pdrv)
U_RETURN(true);
}
USqlStatementBindParam* UOrmDriverSqlite::creatSqlStatementBindParam(USqlStatement* pstmt, const char* s, int n, bool bstatic, int rebind)
USqlStatementBindParam* UOrmDriverSqlite::creatSqlStatementBindParam(USqlStatement* pstmt, const char* s, uint32_t n, bool bstatic, int rebind)
{
U_TRACE(0, "UOrmDriverSqlite::creatSqlStatementBindParam(%p,%.*S,%u,%b,%d)", pstmt, n, s, n, bstatic, rebind)
@ -499,6 +509,7 @@ bool USqliteStatement::setBindResult(UOrmDriver* pdrv)
}
if (sz > 0) (void) result->pstr->replace(ptr, sz);
else result->pstr->size_adjust(0);
}
break;
}

View File

@ -641,10 +641,11 @@ void UOrmStatement::bindParam(long double& v)
#endif
}
void UOrmStatement::bindParam(const char* s, int n, bool bstatic, int rebind)
void UOrmStatement::bindParam(const char* s, uint32_t n, bool bstatic, int rebind)
{
U_TRACE(0, "UOrmStatement::bindParam(%.*S,%u,%b,%d)", n, s, n, bstatic, rebind)
U_INTERNAL_ASSERT_MAJOR(n, 0)
U_INTERNAL_ASSERT_POINTER(pstmt)
U_INTERNAL_ASSERT_POINTER(psession->pdrv)
U_INTERNAL_ASSERT_EQUALS(pdrv, psession->pdrv)
@ -689,7 +690,22 @@ void UOrmStatement::bindParam(UStringRep& v)
U_INTERNAL_ASSERT_EQUALS(pdrv, psession->pdrv)
#if defined(USE_SQLITE) || defined(USE_MYSQL) || defined(USE_PGSQL)
pdrv->bindParam(pstmt, U_STRING_TO_PARAM(v), true, -1);
uint32_t sz = v.size();
pdrv->bindParam(pstmt, v.data(), sz, sz, -1);
#endif
}
void UOrmStatement::bindParam(UString& v)
{
U_TRACE(0, "UOrmStatement::bindParam(%V)", v.rep)
U_INTERNAL_ASSERT_POINTER(pstmt)
U_INTERNAL_ASSERT_POINTER(psession->pdrv)
U_INTERNAL_ASSERT_EQUALS(pdrv, psession->pdrv)
#if defined(USE_SQLITE) || defined(USE_MYSQL) || defined(USE_PGSQL)
pdrv->bindParam(pstmt, v);
#endif
}

View File

@ -306,7 +306,7 @@ UString UOrmDriver::getOptionValue(const char* _name, uint32_t len)
return UString::getStringNull();
}
USqlStatementBindParam::USqlStatementBindParam(const char* s, int n, bool bstatic)
USqlStatementBindParam::USqlStatementBindParam(const char* s, uint32_t n, bool bstatic)
{
U_TRACE_CTOR(0, USqlStatementBindParam, "%.*S,%u,%b", n, s, n, bstatic)
@ -327,7 +327,7 @@ USqlStatementBindParam::USqlStatementBindParam(const char* s, int n, bool bstati
}
}
USqlStatementBindParam* UOrmDriver::creatSqlStatementBindParam(USqlStatement* pstmt, const char* s, int n, bool bstatic, int rebind)
USqlStatementBindParam* UOrmDriver::creatSqlStatementBindParam(USqlStatement* pstmt, const char* s, uint32_t n, bool bstatic, int rebind)
{
U_TRACE(0, "UOrmDriver::creatSqlStatementBindParam(%p,%.*S,%u,%b,%d)", pstmt, n, s, n, bstatic, rebind)
@ -623,13 +623,11 @@ template <> void UOrmDriver::bindResult<unsigned long long>(USqlStatement* pstmt
template <> void UOrmDriver::bindResult<UStringRep>(USqlStatement* pstmt, UStringRep& v)
{
U_TRACE(0, "UOrmDriver::bindResult<UString>(%p,%V)", pstmt, &v)
U_TRACE(0, "UOrmDriver::bindResult<UStringRep>(%p,%V)", pstmt, &v)
U_INTERNAL_ASSERT_POINTER(pstmt)
USqlStatementBindResult* ptr = creatSqlStatementBindResult(v);
pstmt->bindResult(ptr);
pstmt->bindResult(creatSqlStatementBindResult(v));
}
#if defined(U_STDCPP_ENABLE) && defined(DEBUG)

View File

@ -7363,7 +7363,7 @@ void UHTTP::setDynamicResponse()
# if defined(DEBUG) && defined(USE_LIBMAGIC)
if (clength > 4 &&
U_http_content_type_len != 1) // NB: we assume that we don't have a HTTP content-type header...
U_http_usp_flag == 0) // NB: we assume that we don't have a HTTP content-type header...
{
const char* p = pEndHeader + U_http_info.endHeader;
@ -7421,7 +7421,7 @@ no_response:
next:
ptr = ext->pend();
if (U_http_content_type_len != 1)
if (U_http_usp_flag == 0)
{
// NB: we assume that we don't have a HTTP content-type header...
@ -10504,7 +10504,7 @@ loop:
if (u_get_unalignedp64(ptr) == U_MULTICHAR_CONSTANT64('e','n','t','-','T','y','p','e'))
{
U_http_content_type_len = 1;
U_http_usp_flag = 1;
ptr += U_CONSTANT_SIZE("ent-Type: ");

View File

@ -262,7 +262,7 @@ loop:
U_INTERNAL_DUMP("framing_state = %d", framing_state)
}
/* FALLTHRU */
/* FALL THRU */
case U_WS_DATA_FRAMING_PAYLOAD_LENGTH: // 2
{
@ -304,7 +304,7 @@ loop:
U_INTERNAL_DUMP("framing_state = %d", framing_state)
}
/* FALLTHRU */
/* FALL THRU */
case U_WS_DATA_FRAMING_PAYLOAD_LENGTH_EXT: // 3
{
@ -346,7 +346,7 @@ loop:
U_INTERNAL_DUMP("framing_state = %d", framing_state)
}
/* FALLTHRU */
/* FALL THRU */
case U_WS_DATA_FRAMING_MASK: // 0
{
@ -373,7 +373,7 @@ loop:
U_INTERNAL_DUMP("masking = %d framing_state = %d", masking, framing_state)
}
/* FALLTHRU */
/* FALL THRU */
case U_WS_DATA_FRAMING_EXTENSION_DATA: // 4
{
@ -396,7 +396,7 @@ loop:
U_INTERNAL_DUMP("framing_state = %d", framing_state)
}
/* FALLTHRU */
/* FALL THRU */
case U_WS_DATA_FRAMING_APPLICATION_DATA: // 5
{

View File

@ -1 +1 @@
0111
0118

View File

@ -26,22 +26,6 @@ static void usp_fork_update()
}
}
}
#ifdef DEBUG
static void usp_end_update()
{
U_TRACE(5, "::usp_end_update()")
World::handlerEndSql();
if (pstmt_update)
{
U_DELETE(pstmt_update)
pstmt_update = U_NULLPTR;
}
}
#endif
-->
<!--#header
Content-Type: application/json