|
@@ -33,8 +33,6 @@ public:
|
|
Fortune(const Fortune& f) : id(f.id), message(f.message)
|
|
Fortune(const Fortune& f) : id(f.id), message(f.message)
|
|
{
|
|
{
|
|
U_TRACE_CTOR(5, Fortune, "%p", &f)
|
|
U_TRACE_CTOR(5, Fortune, "%p", &f)
|
|
-
|
|
|
|
- U_MEMORY_TEST_COPY(f)
|
|
|
|
}
|
|
}
|
|
|
|
|
|
~Fortune()
|
|
~Fortune()
|
|
@@ -152,34 +150,32 @@ public:
|
|
{
|
|
{
|
|
u_put_unalignedp64(ptr, U_MULTICHAR_CONSTANT64('C','o','n','t','e','n','t','-'));
|
|
u_put_unalignedp64(ptr, U_MULTICHAR_CONSTANT64('C','o','n','t','e','n','t','-'));
|
|
u_put_unalignedp64(ptr+8, U_MULTICHAR_CONSTANT64('L','e','n','g','t','h',':',' '));
|
|
u_put_unalignedp64(ptr+8, U_MULTICHAR_CONSTANT64('L','e','n','g','t','h',':',' '));
|
|
- u_put_unalignedp64(ptr+16, U_MULTICHAR_CONSTANT64('1','2','2','7','\r','\n','C','o'));
|
|
|
|
- u_put_unalignedp64(ptr+24, U_MULTICHAR_CONSTANT64('n','t','e','n','t','-','T','y'));
|
|
|
|
- u_put_unalignedp64(ptr+32, U_MULTICHAR_CONSTANT64('p','e',':',' ','t','e','x','t'));
|
|
|
|
- u_put_unalignedp64(ptr+40, U_MULTICHAR_CONSTANT64('/','h','t','m','l',';',' ','c'));
|
|
|
|
- u_put_unalignedp64(ptr+48, U_MULTICHAR_CONSTANT64('h','a','r','s','e','t','=','U'));
|
|
|
|
- u_put_unalignedp64(ptr+56, U_MULTICHAR_CONSTANT64('T','F','-','8','\r','\n','\r','\n'));
|
|
|
|
- u_put_unalignedp64(ptr+64, U_MULTICHAR_CONSTANT64('<','!','d','o','c','t','y','p'));
|
|
|
|
- u_put_unalignedp64(ptr+72, U_MULTICHAR_CONSTANT64('e',' ','h','t','m','l','>','<'));
|
|
|
|
- u_put_unalignedp64(ptr+80, U_MULTICHAR_CONSTANT64('h','t','m','l','>','<','h','e'));
|
|
|
|
- u_put_unalignedp64(ptr+88, U_MULTICHAR_CONSTANT64('a','d','>','<','t','i','t','l'));
|
|
|
|
- u_put_unalignedp64(ptr+96, U_MULTICHAR_CONSTANT64('e','>','F','o','r','t','u','n'));
|
|
|
|
- u_put_unalignedp64(ptr+104, U_MULTICHAR_CONSTANT64('e','s','<','/','t','i','t','l'));
|
|
|
|
- u_put_unalignedp64(ptr+112, U_MULTICHAR_CONSTANT64('e','>','<','/','h','e','a','d'));
|
|
|
|
- u_put_unalignedp64(ptr+120, U_MULTICHAR_CONSTANT64('>','<','b','o','d','y','>','<'));
|
|
|
|
- u_put_unalignedp64(ptr+128, U_MULTICHAR_CONSTANT64('t','a','b','l','e','>','<','t'));
|
|
|
|
- u_put_unalignedp64(ptr+136, U_MULTICHAR_CONSTANT64('r','>','<','t','h','>','i','d'));
|
|
|
|
- u_put_unalignedp64(ptr+144, U_MULTICHAR_CONSTANT64('<','/','t','h','>','<','t','h'));
|
|
|
|
- u_put_unalignedp64(ptr+152, U_MULTICHAR_CONSTANT64('>','m','e','s','s','a','g','e'));
|
|
|
|
- u_put_unalignedp64(ptr+160, U_MULTICHAR_CONSTANT64('<','/','t','h','>','<','/','t'));
|
|
|
|
- u_put_unalignedp16(ptr+168, U_MULTICHAR_CONSTANT16('r','>'));
|
|
|
|
-
|
|
|
|
- pwbuffer = ptr + U_CONSTANT_SIZE("Content-Length: 1227\r\nContent-Type: text/html; charset=UTF-8\r\n\r\n"
|
|
|
|
|
|
+ u_put_unalignedp64(ptr+16, U_MULTICHAR_CONSTANT64('x','x','x','x','x','x','x','x'));
|
|
|
|
+ u_put_unalignedp64(ptr+24, U_MULTICHAR_CONSTANT64('\r','\n','C','o','n','t','e','n'));
|
|
|
|
+ u_put_unalignedp64(ptr+32, U_MULTICHAR_CONSTANT64('t','-','T','y','p','e',':',' '));
|
|
|
|
+ u_put_unalignedp64(ptr+40, U_MULTICHAR_CONSTANT64('t','e','x','t','/','h','t','m'));
|
|
|
|
+ u_put_unalignedp64(ptr+48, U_MULTICHAR_CONSTANT64('l',';',' ','c','h','a','r','s'));
|
|
|
|
+ u_put_unalignedp64(ptr+56, U_MULTICHAR_CONSTANT64('e','t','=','U','T','F','-','8'));
|
|
|
|
+ u_put_unalignedp64(ptr+64, U_MULTICHAR_CONSTANT64('\r','\n','\r','\n','<','!','d','o'));
|
|
|
|
+ u_put_unalignedp64(ptr+72, U_MULTICHAR_CONSTANT64('c','t','y','p','e',' ','h','t'));
|
|
|
|
+ u_put_unalignedp64(ptr+80, U_MULTICHAR_CONSTANT64('m','l','>','<','h','t','m','l'));
|
|
|
|
+ u_put_unalignedp64(ptr+88, U_MULTICHAR_CONSTANT64('>','<','h','e','a','d','>','<'));
|
|
|
|
+ u_put_unalignedp64(ptr+96, U_MULTICHAR_CONSTANT64('t','i','t','l','e','>','F','o'));
|
|
|
|
+ u_put_unalignedp64(ptr+104, U_MULTICHAR_CONSTANT64('r','t','u','n','e','s','<','/'));
|
|
|
|
+ u_put_unalignedp64(ptr+112, U_MULTICHAR_CONSTANT64('t','i','t','l','e','>','<','/'));
|
|
|
|
+ u_put_unalignedp64(ptr+120, U_MULTICHAR_CONSTANT64('h','e','a','d','>','<','b','o'));
|
|
|
|
+ u_put_unalignedp64(ptr+128, U_MULTICHAR_CONSTANT64('d','y','>','<','t','a','b','l'));
|
|
|
|
+ u_put_unalignedp64(ptr+136, U_MULTICHAR_CONSTANT64('e','>','<','t','r','>','<','t'));
|
|
|
|
+ u_put_unalignedp64(ptr+144, U_MULTICHAR_CONSTANT64('h','>','i','d','<','/','t','h'));
|
|
|
|
+ u_put_unalignedp64(ptr+152, U_MULTICHAR_CONSTANT64('>','<','t','h','>','m','e','s'));
|
|
|
|
+ u_put_unalignedp64(ptr+160, U_MULTICHAR_CONSTANT64('s','a','g','e','<','/','t','h'));
|
|
|
|
+ u_put_unalignedp64(ptr+168, U_MULTICHAR_CONSTANT64('>','<','/','t','r','>','\0','\0'));
|
|
|
|
+
|
|
|
|
+ pwbuffer = ptr + U_CONSTANT_SIZE("Content-Length: xxxxxxxx\r\nContent-Type: text/html; charset=UTF-8\r\n\r\n"
|
|
"<!doctype html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr>");
|
|
"<!doctype html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr>");
|
|
}
|
|
}
|
|
|
|
|
|
U_INTERNAL_ASSERT_EQUALS(u_get_unalignedp64(UClientImage_Base::wbuffer->data()), U_MULTICHAR_CONSTANT64('C','o','n','t','e','n','t','-'))
|
|
U_INTERNAL_ASSERT_EQUALS(u_get_unalignedp64(UClientImage_Base::wbuffer->data()), U_MULTICHAR_CONSTANT64('C','o','n','t','e','n','t','-'))
|
|
-
|
|
|
|
- UClientImage_Base::wbuffer->size_adjust_constant(U_CONSTANT_SIZE("Content-Length: 1227\r\nContent-Type: text/html; charset=UTF-8\r\n\r\n") + 1227);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
static void endQuery()
|
|
static void endQuery()
|
|
@@ -196,6 +192,7 @@ public:
|
|
pvfortune->sort(Fortune::cmp_obj);
|
|
pvfortune->sort(Fortune::cmp_obj);
|
|
|
|
|
|
char* ptr = pwbuffer;
|
|
char* ptr = pwbuffer;
|
|
|
|
+ uint32_t content_length = U_CONSTANT_SIZE("<!doctype html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr>");
|
|
|
|
|
|
for (uint32_t sz, i = 0, n = pvfortune->size(); i < n; ++i)
|
|
for (uint32_t sz, i = 0, n = pvfortune->size(); i < n; ++i)
|
|
{
|
|
{
|
|
@@ -221,6 +218,17 @@ public:
|
|
u_put_unalignedp64(ptr, U_MULTICHAR_CONSTANT64('<','/','t','a','b','l','e','>'));
|
|
u_put_unalignedp64(ptr, U_MULTICHAR_CONSTANT64('<','/','t','a','b','l','e','>'));
|
|
u_put_unalignedp64(ptr+8, U_MULTICHAR_CONSTANT64('<','/','b','o','d','y','>','<'));
|
|
u_put_unalignedp64(ptr+8, U_MULTICHAR_CONSTANT64('<','/','b','o','d','y','>','<'));
|
|
u_put_unalignedp64(ptr+16, U_MULTICHAR_CONSTANT64('/','h','t','m','l','>','\0','\0'));
|
|
u_put_unalignedp64(ptr+16, U_MULTICHAR_CONSTANT64('/','h','t','m','l','>','\0','\0'));
|
|
|
|
+
|
|
|
|
+ content_length += (ptr - pwbuffer) + U_CONSTANT_SIZE("</table></body></html>");
|
|
|
|
+
|
|
|
|
+ ptr = pwbuffer - U_CONSTANT_SIZE("xxxxxxxx\r\nContent-Type: text/html; charset=UTF-8\r\n\r\n"
|
|
|
|
+ "<!doctype html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr>");
|
|
|
|
+
|
|
|
|
+ u_put_unalignedp64(ptr, U_MULTICHAR_CONSTANT64(' ',' ',' ',' ',' ',' ',' ',' '));
|
|
|
|
+
|
|
|
|
+ (void) u_num2str32(content_length, ptr);
|
|
|
|
+
|
|
|
|
+ UClientImage_Base::wbuffer->size_adjust_constant(U_CONSTANT_SIZE("Content-Length: xxxxxxxx\r\nContent-Type: text/html; charset=UTF-8\r\n\r\n") + content_length);
|
|
}
|
|
}
|
|
|
|
|
|
static void doQuery(vPF handlerQuery)
|
|
static void doQuery(vPF handlerQuery)
|
|
@@ -239,10 +247,7 @@ public:
|
|
# ifdef U_STATIC_ORM_DRIVER_PGSQL
|
|
# ifdef U_STATIC_ORM_DRIVER_PGSQL
|
|
U_INTERNAL_DUMP("UServer_Base::handler_db2 = %p", UServer_Base::handler_db2)
|
|
U_INTERNAL_DUMP("UServer_Base::handler_db2 = %p", UServer_Base::handler_db2)
|
|
|
|
|
|
- if (UServer_Base::handler_db2 == U_NULLPTR)
|
|
|
|
- {
|
|
|
|
- U_NEW(UEventDB, UServer_Base::handler_db2, UEventDB);
|
|
|
|
- }
|
|
|
|
|
|
+ if (UServer_Base::handler_db2 == U_NULLPTR) UServer_Base::handler_db2 = new UEventDB();
|
|
# endif
|
|
# endif
|
|
}
|
|
}
|
|
|
|
|
|
@@ -250,15 +255,15 @@ public:
|
|
{
|
|
{
|
|
U_TRACE_NO_PARAM(5, "Fortune::handlerFork()")
|
|
U_TRACE_NO_PARAM(5, "Fortune::handlerFork()")
|
|
|
|
|
|
- U_NEW_STRING(pmessage, UString(101U));
|
|
|
|
|
|
+ pmessage = new UString(101U);
|
|
|
|
|
|
- U_NEW(UVector<Fortune*>, pvfortune, UVector<Fortune*>);
|
|
|
|
|
|
+ pvfortune = new UVector<Fortune*>();
|
|
|
|
|
|
Fortune* elem;
|
|
Fortune* elem;
|
|
|
|
|
|
for (uint32_t i = 0; i < 13; ++i)
|
|
for (uint32_t i = 0; i < 13; ++i)
|
|
{
|
|
{
|
|
- U_NEW(Fortune, elem, Fortune(i+1));
|
|
|
|
|
|
+ elem = new Fortune(i+1);
|
|
|
|
|
|
pvfortune->push(elem);
|
|
pvfortune->push(elem);
|
|
}
|
|
}
|
|
@@ -270,7 +275,7 @@ public:
|
|
|
|
|
|
if (psql_fortune == U_NULLPTR)
|
|
if (psql_fortune == U_NULLPTR)
|
|
{
|
|
{
|
|
- U_NEW(UOrmSession, psql_fortune, UOrmSession(U_CONSTANT_TO_PARAM("fortune")));
|
|
|
|
|
|
+ psql_fortune = new UOrmSession(U_CONSTANT_TO_PARAM("fortune"));
|
|
|
|
|
|
if (psql_fortune->isReady() == false)
|
|
if (psql_fortune->isReady() == false)
|
|
{
|
|
{
|
|
@@ -283,7 +288,7 @@ public:
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- U_NEW(UOrmStatement, pstmt_fortune, UOrmStatement(*psql_fortune, U_CONSTANT_TO_PARAM("SELECT id, message FROM Fortune")));
|
|
|
|
|
|
+ pstmt_fortune = new UOrmStatement(*psql_fortune, U_CONSTANT_TO_PARAM("SELECT id, message FROM Fortune"));
|
|
|
|
|
|
handlerFork();
|
|
handlerFork();
|
|
|
|
|