易截截图软件、单文件、免安装、纯绿色、仅160KB

magento 在Magento中使用自己写的SQL语句


Magento的Models
和Collection
 很强大,使用它们可以很方便的查询和操作数据库。但是有些场合,因为一些特殊需求或对Magento的了解不够深,可能会需要自己手写SQL语句来查询和操作数据库。以下分别是读写数据库的代码。

// For Read
// fetch read database connection that is used in Mage_Core module
$read= Mage::getSingleton('core/resource')->getConnection('core_read');
$value=$read->query("SE...");
$row = $value->fetch();

print_r($row); // As Array
 
  
// For Write
// fetch write database connection that is used in Mage_Core module
$write = Mage::getSingleton('core/resource')->getConnection('core_write');

// now $write is an instance of Zend_Db_Adapter_Abstract
$write->query("insert into tablename values ('aaa','bbb','ccc')");
 


相关文档:

怎么将下面的sql改成Hql?

select * from ((select bill.id billId,bach.riskRate risk,bach.assureRate assure from AcptBillInfo bill,AcptBach  bach where bill.acptBatchId=bach.id and bill.rgctId=? )abach left outer join AcptSignMoney sig on abach.billId = sig.billId) ......

SQL查询语句精华使用简要


SQL查询语句精华使用简要
  简单的Transact-SQL查询只包括选择列表、from子句和WHERE子句。它们分别说明所查询列、查询的表或视图、以及搜索条件等。
  例如,下面的语句查询testtable表中姓名为“张三”的nickname字段和email字段。
  SELECT nickname,email
  [1] from testtable
  WHERE nam ......

关于SQL Server服务管理器的问题

问题: 一台服务器上运行了SQL Server,SQL Server Agent,Distributed Transaction,Coordinator这三个服务,请问这台服务器是一台什么样的服务器?这三个服务具体有什么作用?
这是一台数据库服务器.
SQL Server 这是主数据库服务,而且形成了SQL Server的支柱。它用于存储和提取数据。
SQL Server Agent 也叫SQL Server代 ......

sql基础

Student(S#,Sname,Sage,Ssex) 学生表
Course(C#,Cname,T#) 课程表
SC(S#,C#,score) 成绩表
Teacher(T#,Tname) 教师表
问题:
1、查询“001”课程比“002”课程成绩高的所有学生的学号;
  select a.S# from (select s#,score from SC where C#='001') a,(select s#,score
  fr ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号