Jump to content

AsyncSQL Improved


Recommended Posts

M2 Download Center

This is the hidden content, please
( Internal )

I just taked a look at AsyncSQL.H

dunno. The formatting certainly isn't. Also, abusing stdafx out-of-tree. Ugh. And OS-specific synch. Reserved identifiers. C-style structs. Mixing tabs and spaces. DWORD. Fucking m_sem not even used. Copying full async resultset into a container eagerly? Oh. And using mySql Storing SQLResult* in a vector, not honouring Rule Of Three. The fucking type not even polymorphic, so use vector, or stable_vector if you must. Not typedeffing the container or using auto for the iterators. Using strange names for iterators (past?). Nohting ever initializes m_pkSQL. So that's encapsulation disavowed then. What happened to smart pointers... uiResultsPos in the database layer?!?!##!@# Not using prepared statements and bound arguments. C-style error handling through multiple non-encapsulated field. Read: missing errorhandling. CAsyncSQL2 - naming fail. CAsyncSQL looks somewhat saner. Possibly because it was nicked from somewhere?

 

:))) Nice explain , here you have an improved async sql.

IMPROVED

Soon other libs re

  • Metin2 Dev 2
  • Love 7
Link to comment
Share on other sites

  • 2 weeks later...

Thanks i gona try that :)

 

Line 59 return vec_pkResult.at(uiResultPos];

should be return vec_pkResult.at(uiResultPos);

 

n with this i dont get errors

#ifndef __WIN32__
        pthread_t m_hThread;
        pthread_mutex_t    * m_mtxQuery;
        pthread_mutex_t    * m_mtxResult;
#else
        HANDLE m_hThread;
        CRITICAL_SECTION* m_mtxQuery;
        CRITICAL_SECTION* m_mtxResult;
#endif

 

Can u Post your AsyncSql.cpp aswell?

Otherwise m_sem needs to be included again for noobs like me :P

 

Link to comment
Share on other sites

42 minutes ago, thalooka said:

Thanks i gona try that :)

 

Line 59 return vec_pkResult.at(uiResultPos];

should be return vec_pkResult.at(uiResultPos);

 

n with this i dont get errors

#ifndef __WIN32__
        pthread_t m_hThread;
        pthread_mutex_t    * m_mtxQuery;
        pthread_mutex_t    * m_mtxResult;
#else
        HANDLE m_hThread;
        CRITICAL_SECTION* m_mtxQuery;
        CRITICAL_SECTION* m_mtxResult;
#endif

 

Can u Post your AsyncSql.cpp aswell?

Otherwise m_sem needs to be included again for noobs like me :P

 

I will post if u want. But you need c++1z to use.

Link to comment
Share on other sites

  • 1 month later...
On 07.11.2015 at 5:33 PM, ds_aim said:

I just taked a look at AsyncSQL.H

dunno. The formatting certainly isn't. Also, abusing stdafx out-of-tree. Ugh. And OS-specific synch. Reserved identifiers. C-style structs. Mixing tabs and spaces. DWORD. Fucking m_sem not even used. Copying full async resultset into a container eagerly? Oh. And using mySql Storing SQLResult* in a vector, not honouring Rule Of Three. The fucking type not even polymorphic, so use vector, or stable_vector if you must. Not typedeffing the container or using auto for the iterators. Using strange names for iterators (past?). Nohting ever initializes m_pkSQL. So that's encapsulation disavowed then. What happened to smart pointers... uiResultsPos in the database layer?!?!##!@# Not using prepared statements and bound arguments. C-style error handling through multiple non-encapsulated field. Read: missing errorhandling. CAsyncSQL2 - naming fail. CAsyncSQL looks somewhat saner. Possibly because it was nicked from somewhere?

 

:))) Nice explain , here you have an improved async sql.

IMPROVED

Soon other libs re

what happening with that? so need easy and short explain

Link to comment
Share on other sites

1 hour ago, ds_aim said:

auto .

nullptr

In those files i used just two c++14 features.

(Just a side note: both nullptr and auto is a C++11 feature :))

C++14 mostly IMPROVED the capability of auto. I mean, from now you can use auto as the return value of a function (only if it's obvious). Even there were some improvements with auto & lambda function connection, so now it's easier to use. And not to mention a quite interesting thing: [[deprecated]]. Have a look at it :) It's quite nice when it comes to a bigger project management, not only a small home-made :)

Another awesome feature of C++14 is that now you can initialize an int (or anything else) in binary format! Just like you create a hex 0xFFAA. now you can make 0b0011100110

 

But as far as I can see it's enough to have C++11 to compile that code :) (No offense)

Please tell me if I'm wrong :P

 

(P.s.: It's a really nice, clean & easily readable code!)

  • Love 1

spacer.png

Link to comment
Share on other sites

  • 2 months later...

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.