• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Close connection

#11
(08-18-2018, 05:03 AM)InsiteFX Wrote: You would need to keep track of your query caches maybe in an array etc;

Then you could just grab it from your array etc; Then delete that special one.

Can i get query string after run it?
Example:
$this->db->where('ID','1');
$res = $this->db->get('user');
echo $this->db->get_compiled_select(); //here i need last query string
Reply

#12
Did you try using:

PHP Code:
$lastQuery $this->db->last_query() 

The compiled method only allow getting insert, update and delete methods.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#13
(08-19-2018, 04:17 AM)InsiteFX Wrote: Did you try using:

PHP Code:
$lastQuery $this->db->last_query() 

The compiled method only allow getting insert, update and delete methods.

Oh yes it is returning last query
So i have to save query for when i need remove cache
Thanks
Reply

#14
(08-17-2018, 05:21 AM)kaitenz Wrote:
(08-17-2018, 05:07 AM)omid_student Wrote: Hi
Is it important for close connection after query?
Example
$res = $this->db->query('')->result_array();
$this->db->close();

Also i have other question
How do i can delete cache only for special query?
at the moment we can delete all cache

AFAIK, Query builder automatically close the database after use (correct me if I'm wrong)

For special queries, assign your special query to a variable:
PHP Code:
$special_query $this->db->query(); 

Then if you want to use 
PHP Code:
$this->db->flush_cache(); 

You can still use your special query:
PHP Code:
$special_query->result(); 

But I didn't try this before (but I use query caching a lot), so try it for yourself.
AFAIK, Query builder automatically close the database after use 
== Agree with you,but I can not find the code , can you tell me when and where did query builder automatically close the database connection?
Reply

#15
(08-18-2018, 05:03 AM)InsiteFX Wrote: You would need to keep track of your query caches maybe in an array etc;

Then you could just grab it from your array etc; Then delete that special one.

Yes Thank you
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.