In the module's config.xml
:
<global>
<resources>
<tpa_setup>
<setup>
<module>Vendor_Tpa</module>
</setup>
</tpa_setup>
<bot_db>
<connection>
<host><![CDATA[subdomain.rds.aws.com]]></host>
<username><![CDATA[some_name]]></username>
<password><![CDATA[some_pw]]></password>
<dbname><![CDATA[some_db_name]]></dbname>
<model>mysql4</model>
<type>pdo_mysql</type>
<active>1</active>
</connection>
</bot_db>
</resources>
<!-- ... -->
</global>
To access:
/** @var Varien_Db_Adapter_Pdo_Mysql $connection */
$connection = Mage::getSingleton('core/resource')->getConnection('bot_db');
$select = $connection->select()
->from(
'table_name',
[
'code' => 'drug_id',
'name' => 'description',
'unit_price' => 'unit_price',
'max_qty' => 'max_quantity',
'updated_at' => 'updated_at'
]
)
->where('drug_id IN (?)', array_column($items, 'code'));
$rows = $connection->fetchAssoc($select);
Posted by kiatng to OpenMage (2023-05-22 01:46)