Magento – Database Queries

Share
Posted on May 11th, 2013 | Posted by admin

Magento is a complete and awesome MVC application. It’s fully moduler and easy to extend its features and functionality. All the CRUD operations are performed using the modules, model classes. But many a time it requires a developer to execute the db query in traditional form.

Here is the list of methods and queries.

In magento to Read or Write any query we need database connection.

<?php
//database read adapter
$read = Mage::getSingleton('core/resource')->getConnection('core_read')
//database write adapter
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
?>

These connections return special instances of the Mage_Core_Model_Resource class, that contains functions used to execute raw Database Queries.

Convert Magento Database to Innodb

Share
Posted on March 31st, 2013 | Posted by admin

Convert Magento Database to Innodb

ALTER TABLE `admin_assert` ENGINE=InnoDB;
ALTER TABLE `admin_role` ENGINE=InnoDB;
ALTER TABLE `admin_rule` ENGINE=InnoDB;
ALTER TABLE `admin_user` ENGINE=InnoDB;
ALTER TABLE `adminnotification_inbox` ENGINE=InnoDB;
ALTER TABLE `api_assert` ENGINE=InnoDB;
ALTER TABLE `api_role` ENGINE=InnoDB;
ALTER TABLE `api_rule` ENGINE=InnoDB;
ALTER TABLE `api_user` ENGINE=InnoDB;
ALTER TABLE `catalog_category_entity` ENGINE=InnoDB;
ALTER TABLE `catalog_category_entity_datetime` ENGINE=InnoDB;
ALTER TABLE `catalog_category_entity_decimal` ENGINE=InnoDB;
ALTER TABLE `catalog_category_entity_int` ENGINE=InnoDB;

Export and Importing MySQL Database via SSH

Share
Posted on October 17th, 2012 | Posted by admin

There are times when the usual methods of backing up a database do not cut the mustard – especially when it comes to Magento databases. Normally a Magento database can be backed up via the tool>backups module within the backend – however you may find that on some servers the process of backing up the database might time-out in your browser.
At times like these it is useful to know the following techniques for backing up and restoring via SSH.
First of all to backup your database you will need to firstly connect to your website via SSH – normally like so (on MAC):

ssh username@ip.add.re.ss

– enter your password
This will normally get you in to your website – that is if you have SSH enabled for your domain on your chosen hosting platform.
Next we will perform a nice clean backup – what I tend to do if it is a Magento website is to navigate to the backups folder within the Magento var folder by doing the following:

External Database Connector FAQ’s

Share
Posted on March 28th, 2012 | Posted by admin

We have been receiving a lots of comments on how to “install” External Database Connector (Formarly, TTT_EDB) in Magento. So we thought why not clear that out some of the questions we received here and lets see if this will help you and all.

First of all we would like to say that this is not a fully functional module (Don’t Panic..), meaning you will not be able work with tables of external database just by configuring the settings of the module. You will have to code your associated Model/Collection classes based on the Magento External Database Connector Released.

Few things which came and we would want to clear out.

Magento External Database Connector Released

Share
Posted on March 19th, 2012 | Posted by admin

Formarly Known as The Three Tree External Database Connector

Magento External Database Connector module will be helpful for the “Developers” who want to connect to the external Database server (other than the database used by Magento). This module will help the developer to set up a connection object (Read & Write) with the configuration configured in Admin Settings and use that connection to do database transactions on external database.

All you have to do is set the settings of your external database connection in your Magento Settings and extend your model/collection class with the class of this module and use other codes as you have been using in Magento to select/update/delete records.

It will be as simple as Mage::getModel(‘mymodule/mymodel’)->setData(‘name’,’The Next Tree’)->save()

Page 1 of 3123»