Articles tagged with "database", sorted by date (updated)X
Displaying 11-20 of 21 result(s).

Multiple-database support in Yii

Updated 5 years ago by phazeiHow-tos18 comments – viewed 112,340 times – ( +29 / -1 ) – version 1.1
The customary configuration of a Yii application includes just a single database section in the protected/config/main.php file, but it's easy to extend this to support more than one, tying each Model to one of the databases.
tags: Database

Auto set model fields values

Updated 5 years ago by vibhaJadwaniTutorials3 comments – viewed 21,156 times – ( +9 / -1 ) – version 1.1
This is a tutorial for how to auto set model values without any code.

Update two models with one view

Updated 5 years ago by SebKTips11 comments – viewed 43,043 times – ( +10 / -3 ) – version 1.1
Suppose to have two models: Users and Emails. You do not want to store email in a Users model. And User can have 0 or many emails. This is the form generated to create a new user (just username).
tags: database, model, view, form

How to catch and log MySQL deadlock errors

Updated 5 years ago by sebTips1 comment – viewed 13,542 times – ( +4 / -1 ) – version 1.1
This method allows to log InnoDB monitor output when deadlock error occured. This way we will have much more useful data to find and fix deadlock.
tags: database

Use application on production/development environment without making changes

Updated 6 years ago by ifdatticTips3 comments – viewed 54,654 times – ( +8 / -2 ) – version 1.1
I like programing on my localhost, however it really bugged me to make changes to index.php & config files on my production server. After combining all available wiki articles on this topic and some trial and error this is what I use for my applications so I could just upload it to production server and it will work without any changes.

Application-driven database with CDbMigration and an extended CActiveRecord

Updated 6 years ago by Tudor IlisoiOthers0 comments – viewed 11,791 times – ( +8 / -1 ) – version 1.1
This is an incipient implementation of application-driven database with Yii.
tags: database, model

Sub-domains with different databases in Yii!

Updated 6 years ago by jwerdHow-tos5 comments – viewed 17,600 times – ( +2 / -1 ) – version 1.1
Sub-domains with different databases in Yii!

Single table inheritance

Updated 6 years ago by samdarkHow-tos8 comments – viewed 39,336 times – ( +41 / -1 ) – version 1.1
Relational databases do not support inheritance so if we need to represent it, we have to somehow store meta info while keeping performance by minimizing JOINs. One way to solve this problem is using single table inheritance. All fields for the whole class tree are stored in a single table. Class name is stored in the type field of the same table.

Getting nulls from database instead of empty strings

Updated 6 years ago by samdarkTips2 comments – viewed 12,916 times – ( +13 / -1 ) – version 1.1
To get null from database instead of empty strings you need to set up your DB connection as follows:
tags: database, null

A simple class to use a different db for a module

Updated 6 years ago by Maurizio Domba CerinTips3 comments – viewed 19,967 times – ( +10 / -1 ) – version 1.1
What would you do if you want/need to have a different than the main database connection in an module's models?