Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

SQL functions in magento
 
Netismine
Sr. Member
 
Avatar
Total Posts:  174
Joined:  2008-10-28
 

Hi,

I recently started using magento and have found on forum how to do write read and fetch. But how to do, i.e mysql_num_rows, mysql_affected_rows, fetch numeric array, mysql_insert_id etc?

Maybe we can use this thread to make a small library of sql calls in Magento? Or if it’s just a pattern can someone give me an insight on the logic of forming sql calls in Magento? I don’t know Zend API, would I know how to create calls if I learnt Zend API for SQL? Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
Netismine
Sr. Member
 
Avatar
Total Posts:  174
Joined:  2008-10-28
 

I’ve used get_class_methods() function to obtain the following method names of getSingleton(’core/resource’):

beginTransaction
commit
rollback
convertDate
convertDateTime
raw_query
raw_fetchRow
query
multi_query
dropForeignKey
dropKey
addConstraint
tableColumnExists
addColumn
dropColumn
changeColumn
getKeyList
addKey
select
quoteInto
getQuoteIdentifierSymbol
listTables
describeTable
limit
closeConnection
prepare
lastInsertId
setFetchMode
supportsParameters
__construct
getConnection
getConfig
setProfiler
getProfiler
insert
update
delete
getFetchMode
fetchAll
fetchRow
fetchAssoc
fetchCol
fetchPairs
fetchOne
quote
quoteIdentifier
quoteColumnAs
quoteTableAs
lastSequenceId
nextSequenceId
foldCase

still missing mysql_num_rows() ...

 
Magento Community Magento Community
Magento Community
Magento Community
 
Damian Culotta
Enthusiast
 
Total Posts:  878
Joined:  2008-12-10
Argentina
 

Magento use the Zend framework.
About database, apllies the Zend::Db abstraction layer.
You won’t find any sql query as is. But if you browse on the code, there are some ways to see how Zend::Db builds the queries.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top