我正在开发一个站点,它将从各大知名汽车经销商(即Fordham丰田,Westchester丰田,丰田曼哈顿等),从CitySeach,经销商Rater ,内部人员页面,Yelp,雅虎本地,Google+等。基本上这个网站的功能是让企业主可以在主要的评论网站上监控他们的在线评论。无法使用codeigniter数据映射器从mysql数据库中删除记录
我在这个项目中使用codeigniter和datamapper(版本1.8),并面临从mysql数据库中删除数据的一些问题。
这里是我的表结构的部分内容如下:
+----------+ +----------------+ +--------------+
| Profile | | profiles_users | | users |
+----------+ +----------------+ +--------------+
| id |<---- | id |----->| id |
| name | | profile_id | | name |
+----------+ | user_id | | email |
| +----------------+ | password |
| +--------------+
+--> +--------------+
| reviews |
+--------------+
| id |
| title |
| author |
| review |
| rating |
| date |
| profile_id |
+--------------+
在“档案”表,我储存delar名称(即像福特汉姆丰田,丰田威等),并在“用户”表我存储了企业主的名字。我正在使用API获取评论,并将它们存储在“评论”表格中,并带有“profile-id”。
可能有超过20000条评论为每个配置文件。目前我有平均。每个配置文件12000条评论。
每当我要删除一个配置文件,该配置文件的审查应被删除,但在这里我得到这样的错误消息:
“致命的错误:让内存耗尽134217728个字节大小(试图分配20字节)在/ home/business/public_html/system/database/DB_active_rec.php在线1999“
任何人都可以请建议我这方面。
显示我们查询,也许我们可以优化它! –
这里是我的代码如下: $ profile = new Profile($ id);如果($ key ==='user') 继续;如果($ profile-> result_count()> 0){foreach($ profile-> has_many as $ key => $ value){ $ profile - > {$ key} - > delete_all(); $ profile-> delete($ profile - > {$ key} - > all); } $ profile-> delete(); } – user2198137
可能的重复[无法使用codeigniter datamapper从mysql数据库中删除超过20000条记录](http://stackoverflow.com/questions/17940067/unable-to-delete-more-than-20000-records-from- mysql-database-using-codeigniter-d) – Wietse