cppcms-users Mailing List for CppCMS C++ Web Framework (Page 84)
Brought to you by:
artyom-beilis
You can subscribe to this list here.
2009 |
Jan
|
Feb
(22) |
Mar
|
Apr
(3) |
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
(15) |
Nov
(16) |
Dec
(13) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 |
Jan
(4) |
Feb
|
Mar
(8) |
Apr
(8) |
May
(8) |
Jun
(36) |
Jul
(63) |
Aug
(126) |
Sep
(47) |
Oct
(66) |
Nov
(46) |
Dec
(42) |
2011 |
Jan
(87) |
Feb
(24) |
Mar
(54) |
Apr
(21) |
May
(22) |
Jun
(18) |
Jul
(22) |
Aug
(101) |
Sep
(57) |
Oct
(33) |
Nov
(34) |
Dec
(66) |
2012 |
Jan
(64) |
Feb
(76) |
Mar
(73) |
Apr
(105) |
May
(93) |
Jun
(83) |
Jul
(84) |
Aug
(88) |
Sep
(57) |
Oct
(59) |
Nov
(35) |
Dec
(49) |
2013 |
Jan
(67) |
Feb
(17) |
Mar
(49) |
Apr
(64) |
May
(87) |
Jun
(64) |
Jul
(93) |
Aug
(23) |
Sep
(15) |
Oct
(16) |
Nov
(62) |
Dec
(73) |
2014 |
Jan
(5) |
Feb
(23) |
Mar
(21) |
Apr
(11) |
May
(1) |
Jun
(19) |
Jul
(27) |
Aug
(16) |
Sep
(5) |
Oct
(37) |
Nov
(12) |
Dec
(9) |
2015 |
Jan
(7) |
Feb
(7) |
Mar
(44) |
Apr
(28) |
May
(5) |
Jun
(12) |
Jul
(8) |
Aug
|
Sep
(39) |
Oct
(34) |
Nov
(30) |
Dec
(34) |
2016 |
Jan
(66) |
Feb
(23) |
Mar
(33) |
Apr
(15) |
May
(11) |
Jun
(15) |
Jul
(26) |
Aug
(4) |
Sep
(1) |
Oct
(30) |
Nov
(10) |
Dec
|
2017 |
Jan
(52) |
Feb
(9) |
Mar
(24) |
Apr
(16) |
May
(9) |
Jun
(12) |
Jul
(33) |
Aug
(8) |
Sep
|
Oct
(1) |
Nov
(2) |
Dec
(6) |
2018 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
(14) |
Jun
(1) |
Jul
(9) |
Aug
(1) |
Sep
(13) |
Oct
(8) |
Nov
(2) |
Dec
(2) |
2019 |
Jan
(1) |
Feb
(1) |
Mar
(3) |
Apr
(3) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
2020 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(9) |
Jul
(6) |
Aug
(25) |
Sep
(10) |
Oct
(10) |
Nov
(6) |
Dec
|
2021 |
Jan
|
Feb
|
Mar
(7) |
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(9) |
Oct
(1) |
Nov
|
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ele...@ex...> - 2012-05-28 09:40:46
|
But there is { "service" : { "api" : "fastcgi", "socket" : "/tmp/crafty-fcgi-socket" }, } |
From: Leon <le...@wl...> - 2012-05-28 01:27:01
|
+1 On Mon, May 28, 2012 at 3:09 AM, augustin <aug...@ov...>wrote: > On Monday, May 28, 2012 01:57:06 AM doug livesey wrote: > > thankyou very much, and thanks in general for being so helpful & patient > > with new users -- it's really appreciated. > > +1 > Artyom's patience is noteworthy. > > Blessings, > > Augustin. > > > > -- > Friends: http://www.reuniting.info/ > My projects: > http://astralcity.org/ http://lesenjeux.fr/ http://linux.overshoot.tv/ > http://overshoot.tv/ http://charityware.info/ http://masquilier.org/ > http://openteacher.info/ http://minguo.info/ http://jacqueslemaire.fr/ > http://www.wechange.org/ http://searching911.info/ > > > > > > > > > > > > > . > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: augustin <aug...@ov...> - 2012-05-27 19:10:10
|
On Monday, May 28, 2012 01:57:06 AM doug livesey wrote: > thankyou very much, and thanks in general for being so helpful & patient > with new users -- it's really appreciated. +1 Artyom's patience is noteworthy. Blessings, Augustin. -- Friends: http://www.reuniting.info/ My projects: http://astralcity.org/ http://lesenjeux.fr/ http://linux.overshoot.tv/ http://overshoot.tv/ http://charityware.info/ http://masquilier.org/ http://openteacher.info/ http://minguo.info/ http://jacqueslemaire.fr/ http://www.wechange.org/ http://searching911.info/ . |
From: doug l. <bi...@gm...> - 2012-05-27 17:57:33
|
Perfectly correct on both counts, thankyou very much, and thanks in general for being so helpful & patient with new users -- it's really appreciated. Doug. On 27 May 2012 13:12, Artyom Beilis <art...@ya...> wrote: > What is the web server? > Have you tried to provide a full path? > > Most web servers require the document-root to be a full path. > > Also note: Do not run cppcms_run as root... It is a bad idea. You don't > need to run > it as root. If you are using nginx, it may give some warnings but it yet > runs. > > > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > > > >________________________________ > > From: doug livesey <bi...@gm...> > >To: cpp...@li... > >Sent: Sunday, May 27, 2012 1:19 PM > >Subject: [Cppcms-users] cppcms_run not accepting document root > configuration switch > > > > > >Hi -- I want to serve public files from the public/ directory in my app. > > > > > >So, for instance, my main stylesheet would be at > public/stylesheets/main.css, and I link to it in my view like so: > > <link href="/stylesheets/main.css" rel="Stylesheet" type="text/css"> > > > > > >However, when I start cppcms_run like so: > > sudo cppcms_run -r public app -c config/cucumber-config.js > > > > > >and go to the browser, it doesn't find the stylesheet. The same happens > if I try to specify the folder like "public/" or "./public". > >If I copy the contents of the public directory to the root directory, and > run cppcms_run without the document root switch, everything works. > >It also works if I link to the subfolders in public from the root > directory. > >However, if I then try to specify the -r option, these stop working again. > >So the -r option is obviously doing something, but not what I would > expect it to do. > >Can anybody please advise me as to what I'm doing wrong? > >Thanks very much, > > Doug. > > >------------------------------------------------------------------------------ > >Live Security Virtual Conference > >Exclusive live event will cover all the ways today's security and > >threat landscape has changed and how IT managers can respond. Discussions > >will include endpoint security, mobile security and the latest in malware > >threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > >_______________________________________________ > >Cppcms-users mailing list > >Cpp...@li... > >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: Artyom B. <art...@ya...> - 2012-05-27 12:12:18
|
What is the web server? Have you tried to provide a full path? Most web servers require the document-root to be a full path. Also note: Do not run cppcms_run as root... It is a bad idea. You don't need to run it as root. If you are using nginx, it may give some warnings but it yet runs. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: doug livesey <bi...@gm...> >To: cpp...@li... >Sent: Sunday, May 27, 2012 1:19 PM >Subject: [Cppcms-users] cppcms_run not accepting document root configuration switch > > >Hi -- I want to serve public files from the public/ directory in my app. > > >So, for instance, my main stylesheet would be at public/stylesheets/main.css, and I link to it in my view like so: > <link href="/stylesheets/main.css" rel="Stylesheet" type="text/css"> > > >However, when I start cppcms_run like so: > sudo cppcms_run -r public app -c config/cucumber-config.js > > >and go to the browser, it doesn't find the stylesheet. The same happens if I try to specify the folder like "public/" or "./public". >If I copy the contents of the public directory to the root directory, and run cppcms_run without the document root switch, everything works. >It also works if I link to the subfolders in public from the root directory. >However, if I then try to specify the -r option, these stop working again. >So the -r option is obviously doing something, but not what I would expect it to do. >Can anybody please advise me as to what I'm doing wrong? >Thanks very much, > Doug. >------------------------------------------------------------------------------ >Live Security Virtual Conference >Exclusive live event will cover all the ways today's security and >threat landscape has changed and how IT managers can respond. Discussions >will include endpoint security, mobile security and the latest in malware >threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |
From: doug l. <bi...@gm...> - 2012-05-27 10:19:49
|
Hi -- I want to serve public files from the public/ directory in my app. So, for instance, my main stylesheet would be at public/stylesheets/main.css, and I link to it in my view like so: <link href="/stylesheets/main.css" rel="Stylesheet" type="text/css"> However, when I start cppcms_run like so: sudo cppcms_run -r public app -c config/cucumber-config.js and go to the browser, it doesn't find the stylesheet. The same happens if I try to specify the folder like "public/" or "./public". If I copy the contents of the public directory to the root directory, and run cppcms_run without the document root switch, everything works. It also works if I link to the subfolders in public from the root directory. However, if I then try to specify the -r option, these stop working again. So the -r option is obviously doing something, but not what I would expect it to do. Can anybody please advise me as to what I'm doing wrong? Thanks very much, Doug. |
From: augustin <aug...@ov...> - 2012-05-27 02:53:53
|
On Sunday, May 27, 2012 06:13:35 AM Artyom Beilis wrote: > Are you sure it crashes altogether? > It should work. > > If it does not can you create a small example that reproduces the problem. > Because the scheme above works for me 100% Indeed it does. I tried with a small example and it worked. I finally traced the bug to something else down the line (I was using the DB connection anyway!). Thank you for confirming that it should work :) and sorry for the noise. :-/ Augustin. -- Friends: http://www.reuniting.info/ My projects: http://astralcity.org/ http://lesenjeux.fr/ http://linux.overshoot.tv/ http://overshoot.tv/ http://charityware.info/ http://masquilier.org/ http://openteacher.info/ http://minguo.info/ http://jacqueslemaire.fr/ http://www.wechange.org/ http://searching911.info/ . |
From: Artyom B. <art...@ya...> - 2012-05-26 22:13:42
|
----- Original Message ----- > From: augustin <aug...@ov...> > To: cpp...@li... > Cc: > Sent: Saturday, May 26, 2012 8:36 AM > Subject: [Cppcms-users] Trying cppdb connection & catch exceptions > > Hello Artyom and all, > > I wish to test my DB connection (e.g. to check that the connection string is > working), and catch any exception arising. > > Here is the code: > > > // Testing that the connection string actually allows us to connect to > the DB. > try { > cppdb::session sql(connection_string); > } > //catch (std::exception const &e) { > catch (cppdb::cppdb_error const& e) { > _bInit_db = false; > return; > } > > However, when the connection string is wrong, the application crashes > altogether: > > cppdb::mysql::Access denied for user 'WRONG'@'localhost' (using > password: YES) > > How to test the DB connection and gracefully handle failed DB connections? > Are you sure it crashes altogether? Because try { cppdb::session sql(connection_string); } catch (cppdb::cppdb_error const& e) { // fail } // ok Should work. If it does not can you create a small example that reproduces the problem. Because the scheme above works for me 100% > Thanks, > > Augustin. > Artyom |
From: augustin <aug...@ov...> - 2012-05-26 06:01:38
|
Hello Artyom and all, I wish to test my DB connection (e.g. to check that the connection string is working), and catch any exception arising. Here is the code: // Testing that the connection string actually allows us to connect to the DB. try { cppdb::session sql(connection_string); } //catch (std::exception const &e) { catch (cppdb::cppdb_error const& e) { _bInit_db = false; return; } However, when the connection string is wrong, the application crashes altogether: cppdb::mysql::Access denied for user 'WRONG'@'localhost' (using password: YES) How to test the DB connection and gracefully handle failed DB connections? Thanks, Augustin. -- Friends: http://www.reuniting.info/ My projects: http://astralcity.org/ http://lesenjeux.fr/ http://linux.overshoot.tv/ http://overshoot.tv/ http://charityware.info/ http://masquilier.org/ http://openteacher.info/ http://minguo.info/ http://jacqueslemaire.fr/ http://www.wechange.org/ http://searching911.info/ . |
From: Artyom B. <art...@ya...> - 2012-05-23 14:08:59
|
>________________________________ > From: le ba <hma...@gm...> > > >By default cppcms::rpc::json_rpc_server don't dispatches Url by default like cppcms::application. >My problem is how to dispatch a dynamic page and activate the json_rpc call after. > > JSON-RPC protocol returns JSON object in output and receives JSON object as input... Dynamic page returns HTML output to the client and optionally receives some POST data as input... Decide what do you want to do. If you want some pages return HTML and others use JSON-RPC protocol read the documentation about application hierarchy http://cppcms.com/wikipp/en/page/cppcms_1x_tut_hierarchy Applications that should handle JSON-RPC should be derived from cppcms::rpc::json_rpc_server others should behave as normal applications. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ |
From: le ba <hma...@gm...> - 2012-05-23 12:49:40
|
By default cppcms::rpc::json_rpc_server don't dispatches Url by default like cppcms::application. My problem is how to dispatch a dynamic page and activate the json_rpc call after. ---------- Forwarded message ---------- From: le ba <hma...@gm...> Date: 2012/5/23 Subject: Re: [Cppcms-users] Fwd: cppcms::rpc::json_rpc_server usage. To: Artyom Beilis <art...@ya...>, cpp...@li... Hi, What is the wrong in my code?: This is my code. class master : public cppcms::rpc::json_rpc_server { public: master(cppcms::service &s); ~master(); void init(); void clear(); void ini(content::master &c); cppdb::session sql; std::string connection; }; master::master(cppcms::service &s) : cppcms::rpc::json_rpc_server(s) { connection="odbc:dsn=ajaxex;user=root;password=root"; } master::~master(){ } void master::init() { sql.open(connection); if (sql.is_open()) { std::cout << "Data Base ouverte" << std::endl; } else { std::cout << "Data Base non ouverte" << std::endl; } } void master::clear() { sql.close(); } void master::ini(content::master &c) { c.title = "My Web Site"; c.image = settings().get<std::string>("myjsonappli.image"); c.media = settings().get<std::string>("myjsonappli.media"); c.scrpt = settings().get<std::string>("myjsonappli.scrpt"); } class pages : public master { public: pages(cppcms::service &s) : master(s) { bind("softwares",cppcms::rpc::json_method(&pages::softwares,this),method_role);//methode that I would to call with ajax dispatcher().assign("/page",&pages::page,this); mapper().assign("page","/page"); } void softwares(int id) { cppdb::result r; cppcms::json::value val; cppcms::json::array softs; std::cout << id << std::endl; r = sql<< "SELECT id,name,idEditor " "FROM ajax_example_softwares WHERE idEditor=?" "ORDER BY id" << id; int i=0; while(r.next()) { cppcms::json::value soft; soft["id"] = r.get<int>("id"); soft["name"] = r.get<std::string>("name"); soft["ideditor"] = r.get<int>("idEditor"); softs.push_back(soft); std::cout << soft << std::endl; i++; } std::cout << "Nombre de ligne " << i << std::endl; val.array(softs); return_result(val); } void page() { content::page c; ini(c); c.page_title = "Multiflex-3 Update-7 / Header-1"; c.page_content = "<p>A page about this web site</p>"; render("page",c); } void main(std::string url) { cppcms::http::content_type ct = request().content_type_parsed(); if(!dispatcher().dispatch(url)){ response().make_error_response(cppcms::http::response::not_found); } cppcms::rpc::json_rpc_server::main(url); std::string type = ct.type(); std::cout<<type<<std::endl; std::string subtype = ct.subtype(); std::cout<<subtype<<std::endl; std::cout<<request().request_method()<<std::endl; } }; Thank in advance for your help Artyom. 2012/5/22 Artyom Beilis <art...@ya...> > > > > > > > void main(std:string url) > > { > > if(!dispatcher().dispatch(url)) { > >response().make_error_response(http::response::not_found); > > } > > cppcms::rpc::json_rpc_server::main(url); > > } > >}; > > > > > You really mixing stuff incorrectly because you will never > > be able to execute cppcms::rpc::json_rpc_server::main(url); properly > as you already have an output > Artyom > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: le ba <hma...@gm...> - 2012-05-23 12:24:21
|
Hi, What is the wrong in my code?: This is my code. class master : public cppcms::rpc::json_rpc_server { public: master(cppcms::service &s); ~master(); void init(); void clear(); void ini(content::master &c); cppdb::session sql; std::string connection; }; master::master(cppcms::service &s) : cppcms::rpc::json_rpc_server(s) { connection="odbc:dsn=ajaxex;user=root;password=root"; } master::~master(){ } void master::init() { sql.open(connection); if (sql.is_open()) { std::cout << "Data Base ouverte" << std::endl; } else { std::cout << "Data Base non ouverte" << std::endl; } } void master::clear() { sql.close(); } void master::ini(content::master &c) { c.title = "My Web Site"; c.image = settings().get<std::string>("myjsonappli.image"); c.media = settings().get<std::string>("myjsonappli.media"); c.scrpt = settings().get<std::string>("myjsonappli.scrpt"); } class pages : public master { public: pages(cppcms::service &s) : master(s) { bind("softwares",cppcms::rpc::json_method(&pages::softwares,this),method_role);//methode that I would to call with ajax dispatcher().assign("/page",&pages::page,this); mapper().assign("page","/page"); } void softwares(int id) { cppdb::result r; cppcms::json::value val; cppcms::json::array softs; std::cout << id << std::endl; r = sql<< "SELECT id,name,idEditor " "FROM ajax_example_softwares WHERE idEditor=?" "ORDER BY id" << id; int i=0; while(r.next()) { cppcms::json::value soft; soft["id"] = r.get<int>("id"); soft["name"] = r.get<std::string>("name"); soft["ideditor"] = r.get<int>("idEditor"); softs.push_back(soft); std::cout << soft << std::endl; i++; } std::cout << "Nombre de ligne " << i << std::endl; val.array(softs); return_result(val); } void page() { content::page c; ini(c); c.page_title = "Multiflex-3 Update-7 / Header-1"; c.page_content = "<p>A page about this web site</p>"; render("page",c); } void main(std::string url) { cppcms::http::content_type ct = request().content_type_parsed(); if(!dispatcher().dispatch(url)){ response().make_error_response(cppcms::http::response::not_found); } cppcms::rpc::json_rpc_server::main(url); std::string type = ct.type(); std::cout<<type<<std::endl; std::string subtype = ct.subtype(); std::cout<<subtype<<std::endl; std::cout<<request().request_method()<<std::endl; } }; Thank in advance for your help Artyom. 2012/5/22 Artyom Beilis <art...@ya...> > > > > > > > void main(std:string url) > > { > > if(!dispatcher().dispatch(url)) { > >response().make_error_response(http::response::not_found); > > } > > cppcms::rpc::json_rpc_server::main(url); > > } > >}; > > > > > You really mixing stuff incorrectly because you will never > > be able to execute cppcms::rpc::json_rpc_server::main(url); properly > as you already have an output > Artyom > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: Marcel H. <ke...@co...> - 2012-05-23 11:11:14
|
Am 23.05.2012 13:03, schrieb Zheng Ping: > Hi, all: > I am a green hand to cppcms. I want to generate a random string by > using cppcms::urandom_device. my codes are: > char buf[32]; > cppcms::urandom_device random_device; > random_device.generate(buf, 16); > std::string output(buf); > std::cout << output << std::endl; > .... ... > The above codes will output garbled codes, I don't know how to get > readable random string by using cppcms::urandom_device, who can give > me an advise? > > -- > with kind regards > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > > > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users what does a random device does? It "prints" out chars in range from 0 to 1 << CHAR_BIT -1 What is "printable"? http://www.asciitable.com/ nums in range from 33 - 126 and some extended ascii codes. A char is nothing different than unsigned int with the length of CHAR_BIT ("normally" 8). What you can do is, define an array with all the letters you want to print and then create a random number in range from 0 to array.length() and then print it out via direct array access. Hope it helpes a bit. Regards |
From: Zheng P. <ky...@gm...> - 2012-05-23 11:03:58
|
Hi, all: I am a green hand to cppcms. I want to generate a random string by using cppcms::urandom_device. my codes are: char buf[32]; cppcms::urandom_device random_device; random_device.generate(buf, 16); std::string output(buf); std::cout << output << std::endl; .... ... The above codes will output garbled codes, I don't know how to get readable random string by using cppcms::urandom_device, who can give me an advise? -- with kind regards |
From: <ele...@ex...> - 2012-05-23 10:16:35
|
> http://cppcms.com/wikipp/en/page/cppcms_1x_build#Getting.The.Sources > Ooops, should have read that! Oh well long day... Cheers, |
From: Artyom B. <art...@ya...> - 2012-05-23 09:42:41
|
----- Original Message ----- > From: "ele...@ex..." <ele...@ex...> > To: cpp...@li... > Cc: > Sent: Wednesday, May 23, 2012 12:30 PM > Subject: [Cppcms-users] compiling cppcms-trunk fails on cppcms_boost > http://cppcms.com/wikipp/en/page/cppcms_1x_build#Getting.The.Sources Artyom Beilis ------------- Support CppCMS by donating money: https://sourceforge.net/donate/index.php?group_id=209965 |
From: <ele...@ex...> - 2012-05-23 09:31:05
|
[ 17%] Building CXX object CMakeFiles/cppcms.dir/src/service.cpp.o In file included from /home/petr/Downloads/cppcms/cppcms-trunk/src/service.cpp:35: /home/petr/Downloads/cppcms/cppcms-trunk/private/prefork_acceptor.h:28:33: error: cppcms_boost/bind.hpp: No such file or directory In file included from /home/petr/Downloads/cppcms/cppcms-trunk/src/service.cpp:35: /home/petr/Downloads/cppcms/cppcms-trunk/private/prefork_acceptor.h:30: error: 'cppcms_boost' is not a namespace-name /home/petr/Downloads/cppcms/cppcms-trunk/private/prefork_acceptor.h:30: error: expected namespace-name before ';' token /home/petr/Downloads/cppcms/cppcms-trunk/private/prefork_acceptor.h: In member function 'void cppcms::impl::prefork_acceptor::start()': /home/petr/Downloads/cppcms/cppcms-trunk/private/prefork_acceptor.h:73: error: 'boost' has not been declared /home/petr/Downloads/cppcms/cppcms-trunk/private/prefork_acceptor.h: In member function 'void cppcms::impl::prefork_acceptor::run()': /home/petr/Downloads/cppcms/cppcms-trunk/private/prefork_acceptor.h:95: warning: comparison between signed and unsigned integer expressions /home/petr/Downloads/cppcms/cppcms-trunk/private/prefork_acceptor.h:188: error: 'boost' has not been declared /home/petr/Downloads/cppcms/cppcms-trunk/src/service.cpp: At global scope: /home/petr/Downloads/cppcms/cppcms-trunk/src/service.cpp:79: error: 'cppcms_boost' is not a namespace-name /home/petr/Downloads/cppcms/cppcms-trunk/src/service.cpp:79: error: expected namespace-name before ';' token /home/petr/Downloads/cppcms/cppcms-trunk/src/service.cpp: In member function 'void cppcms::service::setup_exit_handling()': /home/petr/Downloads/cppcms/cppcms-trunk/src/service.cpp:383: error: 'boost' has not been declared /home/petr/Downloads/cppcms/cppcms-trunk/booster/booster/system_error.h: At global scope: /home/petr/Downloads/cppcms/cppcms-trunk/booster/booster/system_error.h:73: warning: 'booster::system::posix_category' defined but not used /home/petr/Downloads/cppcms/cppcms-trunk/booster/booster/aio/aio_category.h:51: warning: 'booster::aio::aio_error_cat' defined but not used What to do here? |
From: <ele...@ex...> - 2012-05-23 08:56:57
|
I ssh'd into my workstation and installed cppdb-trunk, tested it and now it correctly displayes 2 rows every time. So I guess this bug is squashed! Petr |
From: <ele...@ex...> - 2012-05-23 08:46:20
|
Thanks for all the explanation. I did notice another thing. On one of my statements I forgot to terminate with cppdb::row and then a check for r.blank() was true. Is this expected? Petr |
From: Artyom B. <art...@ya...> - 2012-05-23 08:32:26
|
----- Original Message ----- > From: "ele...@ex..." <ele...@ex...> > To: cpp...@li... > Cc: Artyom Beilis <art...@ya...> > Sent: Wednesday, May 23, 2012 11:18 AM > Subject: Re: [Cppcms-users] Bizarre prepared statement problem > >T ried to build cppdb-trunk got this error: > > [ 34%] Building CXX object CMakeFiles/cppdb.dir/drivers/odbc_backend.cpp.o > /home/petr/Downloads/cppdb/cppdb-trunk/drivers/odbc_backend.cpp:46: error: > size of array 'assert_on_sqlwchar_is_16' is negative > /home/petr/Downloads/cppdb/cppdb-trunk/drivers/odbc_backend.cpp: In > function 'std::basic_string<wchar_t, std::char_traits<wchar_t>, > std::allocator<wchar_t> > cppdb::odbc_backend::tosqlwide(const > std::string&)': > /home/petr/Downloads/cppdb/cppdb-trunk/drivers/odbc_backend.cpp:333: > warning: dereferencing type-punned pointer will break strict-aliasing > rules > > Any ideas? > > System is FreeBSD 9. gcc 4.2.1 > > Petr > > You are using iODBC instead of UnixODBC. ODCB standard requires that SQLWCHAR_T is 16 bit value, iODBC implements this incorrectly: - Either install UnixODBC instead of iODBC - Disable ODBC in cppdb with an option -DDISABLE_ODBC=ON Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ |
From: Artyom B. <art...@ya...> - 2012-05-23 08:29:46
|
----- Original Message ----- > From: "ele...@ex..." <ele...@ex...> > >> Fixed in svn trunk in chageneset 2178. >> >> Please take it and see if it solve the problem (it should) >> >> I switched from using SQLITE_STATIC to full copy. >> >> I think I'm going to release a hot fix release for cppdb >> because some assumptions on the scope of the statement >> were incorrect. >> > > Thanks Artyom, > > I will test the patch ASAP, (although Im not at home right now), so I will > report back tomorrow. > > Can you tell me what you changed? Is returning cppdb::result without > calling next() expected to work now? Yes, the change is not in the behavior of the next but rather copying the value (see mo other mail) > > I did also want to ask you why did you not design cppdb::result as an > STL-like container with iterators? > Because using an iterator would require something like: for(cppdb::result::iterator p=res.begin();p!=res.end();++p) { cppdb::row r = *p; r >> .... } There are several problems with it: What is row, is it copied? Is it a reference? Where it is stored what "r >> val" changes? I agree that is is not "STL-complient" but iterator semantics was not working well there, so I took more JDBC like approach and it works well. > The way it is now I find it a little strange. For example if I run a query > and terminate with cppdb::row, calling next() will return false even if a > row exists. The semantics between cppdb::result::row and cppdb::result::query is very different. Calling cppdb::result::row() calls next and checks if the next row exists. If for example you call cppdb::result r = sql << "SELECT name from users " << cppdb::row; Instead of cppdb::result r = sql << "SELECT name from users where id=?" << id << cppdb::row; It would throw if the result is multi-row result (if backend supports such checks) The behavior with row is to do something like cppdb::result r = sql << "SELECT name from users where id=?" << id << cppdb::row; if(!r.empty()) { // we got user r >> name; } You can even run sql << "SELECT name from users where id=?" << id << cppdb::row >> name; (Of course the last one would throw if there is no such user) It has different semantics If you call next() on row result you are expected to get false as it is a single row. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ |
From: Artyom B. <art...@ya...> - 2012-05-23 08:19:14
|
----- Original Message ----- > From: "ele...@ex..." <ele...@ex...> > Subject: Re: [Cppcms-users] Bizarre prepared statement problem > > Read about SQLITE_STATIC vs SQLITE_TRANSIENT, interesting stuff. > > Petr > See: http://thread.gmane.org/gmane.comp.db.sqlite.general/74538 The problem that unlike in all other databases, sqlite3 requires that binded value expected to be valid during all the statement execution process. That is very different from the semantics in MySQL, PostrgreSQL and ODBC drivers. The semantics of cppdb::statement requires that binded string value be valid until query()/exec()/row() or operator result() is executed. This worked 100% for all other DB but not for sqlite3. That is why full copy semantics now applied. > Does this mean that doing a manual cppdb::statement and bind() is now > going to work with temporaries as well? > No, it may work now for sqlite3 but still may be changed in future. For example if at some point result() would contain only table with all the results and not actually call sqlite3_step() I would be able to use SQLITE_STATIC again. Also it is not promised with other DB. So do not relay on such a behavior Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ |
From: <ele...@ex...> - 2012-05-23 08:18:19
|
Tried to build cppdb-trunk got this error: [ 34%] Building CXX object CMakeFiles/cppdb.dir/drivers/odbc_backend.cpp.o /home/petr/Downloads/cppdb/cppdb-trunk/drivers/odbc_backend.cpp:46: error: size of array 'assert_on_sqlwchar_is_16' is negative /home/petr/Downloads/cppdb/cppdb-trunk/drivers/odbc_backend.cpp: In function 'std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > cppdb::odbc_backend::tosqlwide(const std::string&)': /home/petr/Downloads/cppdb/cppdb-trunk/drivers/odbc_backend.cpp:333: warning: dereferencing type-punned pointer will break strict-aliasing rules Any ideas? System is FreeBSD 9. gcc 4.2.1 Petr |
From: <ele...@ex...> - 2012-05-23 08:02:10
|
Read about SQLITE_STATIC vs SQLITE_TRANSIENT, interesting stuff. Does this mean that doing a manual cppdb::statement and bind() is now going to work with temporaries as well? Petr |
From: <ele...@ex...> - 2012-05-23 07:46:18
|
> Fixed in svn trunk in chageneset 2178. > > Please take it and see if it solve the problem (it should) > > I switched from using SQLITE_STATIC to full copy. > > I think I'm going to release a hot fix release for cppdb > because some assumptions on the scope of the statement > were incorrect. > Thanks Artyom, I will test the patch ASAP, (although Im not at home right now), so I will report back tomorrow. Can you tell me what you changed? Is returning cppdb::result without calling next() expected to work now? I did also want to ask you why did you not design cppdb::result as an STL-like container with iterators? The way it is now I find it a little strange. For example if I run a query and terminate with cppdb::row, calling next() will return false even if a row exists. Thanks, petr |