CodeIgniter Forums
db->truncate produces error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: db->truncate produces error (/showthread.php?tid=13130)



db->truncate produces error - El Forum - 11-12-2008

[eluser]MaDe[/eluser]
Using $this->db->truncate('table') will report the following error in your logfile:

Quote:ERROR - 2008-11-12 15:16:40 --> Severity: Warning --> mysql_num_rows(): supplied argument is not a valid MySQL result resource path\to\CI\system\database\drivers\mysql\mysql_result.php 37

Using CI 1.7.0.

Bug?

Regards,
MaDe


db->truncate produces error - El Forum - 01-08-2009

[eluser]Unknown[/eluser]
change code:

/database/DB_driver.php->is_write_type() // cca line 620
old:
Code:
if ( ! preg_match('/^\s*"?(SET|INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|LOAD DATA|COPY|ALTER|GRANT|REVOKE|LOCK|UNLOCK)\s+/i', $sql))

new:
Code:
if ( ! preg_match('/^\s*"?(SET|INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|LOAD DATA|COPY|ALTER|GRANT|REVOKE|LOCK|UNLOCK|TRUNCATE)\s+/i', $sql))