Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Wyświetalnie zapytań PDO
thoriam
post 10.03.2012, 12:00:47
Post #1





Grupa: Zarejestrowani
Postów: 20
Pomógł: 0
Dołączył: 23.02.2012

Ostrzeżenie: (0%)
-----


Ostatnio zacząłem kombinować z PDO i jestem ciekawy czy można wyświetlać całe zapytanie (nawet te bez błędów). Mająć np. taki kod
  1. $query = $db->prepare('SELECT COUNT(`id`) AS `count` FROM `players` WHERE `last_active`> :last');
  2. $time = time() - (60*5);
  3. $query->execute(array('last'=>$time);
  4.  
  5. var_dump($query->queryString);

wypluje mi coś takiego
  1. SELECT COUNT(`id`) AS `count` FROM `players` WHERE `last_active`> :last'

a mi wychodzi żeby wypluło mi całe zapytanie jakie idzie do bazy czyli np.:
  1. SELECT COUNT(`id`) AS `count` FROM `players` WHERE `last_active`>12435675'

Da radę zrobić coś takiego za pomocą PDO?
Go to the top of the page
+Quote Post
viking
post 10.03.2012, 12:05:06
Post #2





Grupa: Zarejestrowani
Postów: 6 377
Pomógł: 1116
Dołączył: 30.08.2006

Ostrzeżenie: (0%)
-----


Nie bezpośrednio, tym bardziej że zapytań takich możesz naście wywołać. Zobacz http://stackoverflow.com/questions/210564/...s/210693#210693


--------------------
Go to the top of the page
+Quote Post
kaem
post 10.03.2012, 12:46:07
Post #3





Grupa: Zarejestrowani
Postów: 248
Pomógł: 38
Dołączył: 29.06.2008

Ostrzeżenie: (0%)
-----


http://www.php.net/manual/en/pdostatement....gdumpparams.php
Go to the top of the page
+Quote Post
thoriam
post 10.03.2012, 12:50:32
Post #4





Grupa: Zarejestrowani
Postów: 20
Pomógł: 0
Dołączył: 23.02.2012

Ostrzeżenie: (0%)
-----


czyli nie ma innego wyjścia jak napisać jakaś klasę do przetwarzania tego questionmark.gif
Go to the top of the page
+Quote Post
viking
post 10.03.2012, 12:57:11
Post #5





Grupa: Zarejestrowani
Postów: 6 377
Pomógł: 1116
Dołączył: 30.08.2006

Ostrzeżenie: (0%)
-----


Albo użyć gotowca. Propel http://www.propelorm.org/documentation/08-logging.html, Zend_Db http://framework.zend.com/manual/en/zend.db.profiler.html


--------------------
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 12.06.2025 - 13:42