Commit Graph

330 Commits

Author SHA1 Message Date
Particle_G
41d9d7ec58
Add support for custom SQL query (#1241) 2022-05-21 15:23:34 +08:00
DualWu
86dbf9875b
add typename for clang-14 (#1226)
Co-authored-by: dualwu <dualwu@zelostech.com>
2022-04-25 19:28:06 +08:00
Omar Mohamed Khallaf
d51bae1016
Enable automatic reconnect in mysql (#1217)
Setting MYSQL_OPT_RECONNECT option to true will allow the connection to
be restablished once before giving up and returning an error.

This is useful in cases where the database is behind a loadbalancer
(e.g. ipvs) and the tcp connection is terminated after some period of
time.
2022-04-22 11:12:49 +08:00
LE GARREC Vincent
8c4896dfec
Fix tolower with cfi sanitizer (#1209) (#1210)
and update trantor with same patch.
2022-04-22 11:08:40 +08:00
davidschedler
b8a6188ad5
Add ‘not like‘ criteria (#1182) 2022-02-23 09:34:51 +08:00
Ichiro
4b31f93767
Add Not In for ORM Criteria (#1176) 2022-02-12 21:59:49 +08:00
pao-lu
720ce4e9ed
Destroy fastdb client on quit (#1142) 2021-12-31 12:31:32 +08:00
Nitromelon
7455355419
Add more method for mapper (#1112) 2021-12-08 00:54:01 +08:00
NitroMelon
e9fafc643d
Support CoroMapper method chaining (#1103) 2021-12-04 20:54:25 +08:00
An Tao
7cf0a64ab6
Fix orm tests (#1099) 2021-12-01 11:18:35 +08:00
Martin Chang
8913abc400
Mark all awaiters as nodiscard (#1098) 2021-12-01 08:40:09 +08:00
An Tao
d6b09c9e1b
Fix an error when binding a function pointer to SqlBinder (#1097) 2021-12-01 08:39:42 +08:00
An Tao
7d137362bd
Fix the error with multiple results when calling a procedure in mysql (#1091) 2021-11-28 16:26:23 +08:00
NitroMelon
ec8146774a
Add overloads for SqlBinder::operator<< with non-const ref parameter. (#1089) 2021-11-25 19:18:30 +08:00
An Tao
895552dcae
Export some symbols for Windows (#1088) 2021-11-24 23:59:00 +08:00
L0ric0
953000e3fb
Fix compiler warnings (#1081)
* Fix narrowing conversion warning.

The `static_cast` does not change the behavior of the programm only explictly stating that the behavior is intended.
This change is needed as some compiler settings will treat this warning as an error.

* Do not redeclare `result` variable in insertFormattedString as it shadows variable in outer scope.

This fixes a compiler warning for shadowing variables declared in an outer scope. This change does not change the behaviour of the programm as the shadowd variable is not reused after the inner scope ends. Also the new version should represent the intention of the code better.
This change is needed as some compiler settings will treat this warning as an error.
2021-11-21 09:14:57 +08:00
Martin Chang
6b0e38fc8f
Experimental HaikuOS Support (#1002) 2021-08-28 11:47:24 +08:00
Philip Kovacs
a70a2844b1
Fix compiler warnings (#886)
Co-authored-by: an-tao <antao2002@gmail.com>
Co-authored-by: Martin Chang <marty1885@users.noreply.github.com>
2021-06-09 19:14:15 +08:00
Martin Chang
ffc410a66e
Improve WebSocket mask handling (#875) 2021-05-29 15:11:41 +08:00
Philip Kovacs
802e2ae87a
change some #ifdef's to #if in db_test (#873) 2021-05-28 08:21:09 +08:00
Martin Chang
0b5075bfa9
Drogon test framework (#869) 2021-05-27 20:09:57 +08:00
An Tao
afb7e853ec
Add the int type for the Row index parameter (#872) 2021-05-27 10:10:23 +08:00
An Tao
65a7dadbfb
Modify the way to create sqlite3 client (#867) 2021-05-25 00:21:11 +08:00
An Tao
dc732fc954
Add l-reference version of optional<T> and r-reference version of Json::Value to SqlBinder operator '<<' (#863) 2021-05-22 16:10:39 +08:00
An Tao
8052c38f49
Make Json::Value as a SQL parameters type (#861) 2021-05-22 13:08:17 +08:00
An Tao
cd093fc97e
Add the PreSendingAdvice to AOP (#853) 2021-05-16 19:38:16 +08:00
Philip Kovacs
2c53cf086a
Add missing mutex include (#845) 2021-05-11 09:24:14 +08:00
An Tao
471488eef1
Use two-phase construction for the DbClientImpl and the RedisClientImpl (#844) 2021-05-10 08:31:21 +08:00
An Tao
51814b76da
Add the setTimeout() method to the ReidsClient class (#830) 2021-04-30 08:00:11 +08:00
Martin Chang
60c877f920
Use make_exception_ptr instead of throw/catch when possible (#828) 2021-04-29 17:01:18 +08:00
An Tao
685aaaa3da
Add the setTimeout() method to the DbClient class (#823) 2021-04-29 10:13:34 +08:00
Martin Chang
1eea826a52
Fix ORM with SQLite3 not compiling on Arch Linux (#822) 2021-04-27 16:41:16 +08:00
An Tao
b2c1c8de9e
Fix an unused-parameter warning when no sqlite library (#811) 2021-04-19 13:27:11 +08:00
Bertrand Darbon
44a8a2d5f7
Add GNU -Werror & fix warnings (#801) 2021-04-15 19:27:15 +08:00
An Tao
8f2609d1bd
Fix a bug of the Transaction class (#798) 2021-04-13 15:54:50 +08:00
An Tao
4b8d08f20f
Add CoroMapper to models friends (#790) 2021-04-09 16:54:40 +08:00
Bertrand Darbon
54727a5dbe
Add exports macro to allow Shared Library with hidden symbols by default (e.g. Windows) (#745)
Co-authored-by: an-tao <antao2002@gmail.com>
2021-04-09 10:17:28 +08:00
An Tao
6d9aa3b44c
Add redis support (#719) 2021-03-13 19:13:54 +08:00
双草酸酯
1901801d59
Fix compile warnings in SQL client (#741) 2021-03-11 18:43:56 +08:00
an-tao
e28b9aa59c Fix the same bug in the DbClientLockFree class 2021-03-07 20:40:35 +08:00
An Tao
b30c92a9a2
Fix a bug of DbClientImpl class (#735) 2021-03-07 01:28:49 +08:00
Martin Chang
98da3490e7
return awaiter from coroutine instead of resumable (#733) 2021-03-05 22:21:02 +08:00
An Tao
ffda84627b
Modify Mapper and CoroMapper templates (#722) 2021-02-20 10:00:28 +08:00
An Tao
3b8b63d17d
Add drogon::orm::CoroMapper<T> template (#712)
Co-authored-by: marty1885 <marty188586@gmail.com>
2021-02-13 18:22:17 +08:00
An Tao
cfb71cc619
Add transactions test of coroutines (#711) 2021-02-10 23:24:15 +08:00
interfector18
6542236b20
Add default value interface to sqlbinder for mysql and postgresql (#704) 2021-02-07 10:34:49 +08:00
Martin Chang
a2142dd93e
Coroutine support (#693)
* app().registerHttpHandler() accepts coroutine as handlers
* HttpController can use coroutine as handlers'
* Http request handlers with coroutine catches exception instead of crashing the entire app
* DbClient now has execSqlCoro that is awaitable
* DbClient now has newTransactionCoro that is awaitable
* HttpClient have awaitable sendRequestCoro
* WebSocketClient have awaitable connectToServerCoro
* WebSocketClient have setAsyncMessageHandler and setAsyncConnectionClosedHandler
* drogon::AsyncTask and drogon::Task<T> as our corutine types
* Related tests
* Misc

Future work
* Coroutine for WebSocket server
* Known issues

co_future() and sync_wait may crash. It looks like GCC bug but I'm not sure.
Workarround: Make an coroutine of AsyncTask. Then launch said coroutine.
Not sure why wrapping the exact same thing in function crashes things.

Co-authored-by: an-tao <antao2002@gmail.com>
2021-02-06 17:05:58 +08:00
Joakim L. Gilje
f9d714ab74
sqlite3: Insert into stmtsMap_ as string_view (#657) 2020-12-14 08:50:58 +08:00
An Tao
ce704aff5b
Update trantor (#656)
* Update trantor
* Make some minor modifications.
2020-12-14 08:49:33 +08:00
An Tao
566297d4df
Create cmake.yml (#653) 2020-12-13 18:12:30 +08:00
ivanka2012
292894c426
Fix MinGW ORM building by enabling htonll and ntohll (#650) 2020-12-11 16:13:00 +08:00
An Tao
8b7ffb28d7
Add support in the SqlBinder class and the Session class (#644) 2020-12-06 11:41:06 +08:00
An Tao
69d687dbcb
Fix a stack-overflow error when high concurrency happening on sqlite3 (#633) 2020-11-22 20:47:38 +08:00
Joakim L. Gilje
886dfc3648
Support OpenBSD (#626)
Co-authored-by: an-tao <antao2002@gmail.com>
2020-11-15 12:18:01 +08:00
An Tao
594911b7a2
Fix a bug in the Mapper::insertFuture() (#620) 2020-10-29 20:09:16 +08:00
An Tao
0fe3f6fd8f
Use explicit lambda capture lists (#590) 2020-10-02 11:45:07 +08:00
An Tao
465d2ebfe8
Disable TLS1.0/1.1 on HTTPS by default (#588) 2020-10-01 23:40:46 +08:00
Martin Chang
ada35c43fa
Fix failing to connect to DB if parameters contains spaces (#589) 2020-10-01 19:47:51 +08:00
An Tao
bbb338bf12
Bump version to 1.0.0 (#584) 2020-09-27 22:51:09 +08:00
An Tao
4a9ba2088c
Remove the expired std::iterator template (#554) 2020-08-26 20:53:04 +08:00
An Tao
4d8707df4b
Fix a bug when losting connection to MySQL server during query (#550) 2020-08-25 23:35:07 +08:00
An Tao
f1a7462c4c
Modify the Result class in orm (#541) 2020-08-16 20:00:14 +08:00
An Tao
857cacfda7
Fix boost::string_view compilation error of MysqlConnection class (#530) 2020-08-10 09:53:45 +08:00
An Tao
dddc62a9fe
Fix a mysql issue when connections are lost (#525) 2020-08-04 20:04:43 +08:00
An Tao
9c54fb8c69
Modify generation of models and the DbClient class (#498)
* Add setter method for automatical fields of models

* Put SQL queries into buffer before any connection being established

* Update trantor
2020-07-03 12:19:40 +08:00
Rick Zhuang
630beed867
Add the header <cctype> to resolve build errors in VS2017 (#495) 2020-06-27 11:43:49 +08:00
An Tao
3424d3f2c4
Add a way to set the character set when creating DbClient objects (#486) 2020-06-20 20:21:14 +08:00
antao
be6f0966d5 Fix a compilation issue on windows 2020-06-09 10:09:17 +08:00
An Tao
b3d1f151b5
Fix the count() method of Mysql ORM (#468) 2020-06-09 00:54:12 +08:00
An Tao
adab48e187
Fix a Mysql connection error on Windows (#449) 2020-06-02 22:05:03 +08:00
Vedran Miletić
e286fe869a
Fix building of ORM on FreeBSD (#444) 2020-05-25 00:00:00 +08:00
antao
84e503a948 Bump version to 1.0.0-beta17 2020-05-23 10:47:24 +08:00
An Tao
4423d836f4
Add methods to get DbClient connection status (#436) 2020-05-18 08:31:18 +08:00
An Tao
26dca0a910
Fix a connection bug of mariadb clients (#438) 2020-05-17 21:08:12 +08:00
An Tao
cddd17eb55
Fix some compilation warnings (#432) 2020-05-16 10:11:50 +08:00
An Tao
4f8290b589
Remove non standard macros (#415) 2020-04-25 02:12:44 +08:00
interfector18
17b8c337f9
Standardize Row and Result api (#409)
* Standardize Row and Result api, throw specific exceptions

* Fix drogon_ctl for sqlite3 models

* Add mysql and sqlite3 tests, add exception throwing tests

* configure mysql in travis-ci

Co-authored-by: antao <antao2002@gmail.com>
2020-04-11 11:46:47 +08:00
An Tao
06bf158676
Fix issues in the MysqlConnection class (#394) 2020-03-20 23:12:05 +08:00
An Tao
bb8b5ded79
Fix a fatal bug in the MysqlConnection class (#379) 2020-03-11 12:41:20 +08:00
An Tao
77063e28d0
Optimize the rendering of HTTP responses (#371) 2020-03-07 20:49:05 +08:00
An Tao
810896c94c
Fix warnings on Windows (#368) 2020-03-01 11:50:47 +08:00
Wang Gao
d5cd882248
Add support for MSVC 2015 (#365)
Co-authored-by: An Tao <antao2002@gmail.com>
2020-02-26 12:36:46 +08:00
An Tao
58702dc41e
Port drogon to Windows (#335)
Co-authored-by: mcirsta <mforce2@gmail.com>
2020-01-25 11:58:20 +08:00
An Tao
f07d9e03e1
Use shorter stmt names in postgresql connections(#326) 2020-01-04 09:36:14 +08:00
An Tao
bc7ec6975a
Modify the SqlBinder class (#324) 2020-01-03 10:29:06 +08:00
An Tao
53e9dcca08
Optimize database connections (#323) 2020-01-02 17:09:10 +08:00
An Tao
fd6df92bbc
Fix an error in the batch mode of libpq. (#317) 2019-12-11 14:23:52 +08:00
An Tao
40ffb2d2af
Modify some code styles (#298) 2019-11-21 11:27:47 +08:00
antao
0133e47e8f Update drogon version to v1.0.0-beta10 2019-11-04 10:19:20 +08:00
Marwan Rabbâa
fc8abadaeb fix(compilation on alpine): Replace non standard u_short alias (#292) 2019-11-03 23:32:37 +08:00
An Tao
a71e37d86e
Modify some type names to meet the Google Style (#291) 2019-11-01 19:19:25 +08:00
An Tao
4868aa964d
Fix a busy loop bug when connections to mysql server are timeout (#286) 2019-10-21 19:10:59 +08:00
An Tao
d830c4f057
Fix some race conditions (#280)
* Fix a race condition of static files

* Fix a race condition of 404 pages
2019-10-17 09:23:14 +08:00
An Tao
e8a6bdc245
Fix some race conditions (#270) 2019-10-04 14:17:48 +08:00
Daniel Mensinger
656bd2462b Do not use smart pointers in thread storage (#269) 2019-10-03 19:22:37 +08:00
An Tao
d6e5c1959c
Modify some code of responses cache (#268) 2019-10-03 17:50:55 +08:00
An Tao
323bf0693a
Use the IOThreadStorage for responses caching and fast database clients storage (#267) 2019-10-03 10:17:54 +08:00
An Tao
f9d7f589a2
Add the getCurrentThreadIndex() method (#264) 2019-10-01 20:33:25 +08:00
An Tao
70eda27427
Add the ability to create restful API controllers (#244)
* Add the ability to create restful API controllers

* Update the model.json template file

* Modify the 'create controller' command of the drogon_ctl

* access column values by column array indexes instead of column names when constructing an instance of a model class

* Fix a bug of mysql database

* Add some static SQL into models

* Add validations to models

* Add setToNull method to models

* Support 'where in' substatement

* Delay rendering from json to the response body. This allows users to modify the json object before sending a response.

* Add synchronous method to the HttpClient class
2019-09-30 21:34:30 +08:00
An Tao
93573c99bf
Fix the fail in travis ci (#260) 2019-09-28 20:35:05 +08:00