Wiki articles tagged with "database"

Showing 1-20 of 20 items.

Active Record snapshotting (Model data base history)

Created 9 years ago by Bizley, updated 9 years ago by Bizley.

One of the common tasks the web application might be required to perform, especially the app using some kind of a CMS, is to save the history of data changes. Your client for sure will want the answer to this simple question - If I mess this up or delete by accident can we bring it back? Well, DB backup is one thing and quick recovery is another - let's talk about latter one.

1 0
5 followers
Viewed: 17 014 times
Version: 1.1
Category: Tutorials

CRUD operation in Yii framework

Created 10 years ago by Mohammad Fareed, updated 5 years ago by samdark.

Simple Yii Script for performing CRUD operations:

0 4
6 followers
Viewed: 33 434 times
Version: 1.1
Category: Tutorials

Insert data from database to another database table

Created 10 years ago by Kostas Apazidis (KonApaz), updated 10 years ago by Kostas Apazidis (KonApaz).

According to below wiki we could migrate database schema to another database

1 0
2 followers
Viewed: 16 162 times
Version: 1.1
Category: Tutorials

Generate CTreeview from database table and update a model

Created 10 years ago by Kostas Apazidis (KonApaz), updated 10 years ago by Kostas Apazidis (KonApaz).

Suppose we want to set a category to product (or an item in general term), Also suppose categories has sub-categories (multi-level)

1 0
1 follower
Viewed: 14 020 times
Version: 1.1
Category: How-tos

How to avoid a database update if the ActiveRecord was not modified

Created 10 years ago by tomvdp, updated 10 years ago by tomvdp.

The classic Yii way for doing an update action is as follows:

1 0
3 followers
Viewed: 27 484 times
Version: 1.1
Category: How-tos

Multi Data Provider

Created 11 years ago by Sharon Lavie, updated 8 years ago by Sharon Lavie.

Lately, i needed to deal with the following scenario: read from two databases (db1,db2), and write to a third database (db3).

1 0
4 followers
Viewed: 18 838 times
Version: 1.1
Category: Tips

Multiple Database Connection : Select database based on login user id, Dynamic

Created 11 years ago by Rajith R, updated 10 years ago by parthshah.

create a class file under protected\components named RActiveRecord.php

7 0
13 followers
Viewed: 45 433 times
Version: 1.1
Category: How-tos

How to display static pages in Yii with database content?

Created 12 years ago by yasen, updated 11 years ago by yasen.

To extend further static pages as shown by Qiang http://www.yiiframework.com/wiki/22/how-to-display-static-pages-in-yii/ here're the steps to take:

3 0
13 followers
Viewed: 43 052 times
Version: 1.1
Category: Tutorials

Auto set model fields values

Created 12 years ago by vibhaJadwani, updated 12 years ago by vibhaJadwani.

This is a tutorial for how to auto set model values without any code.

5 0
11 followers
Viewed: 31 642 times
Version: 1.1
Category: Tutorials

How to catch and log MySQL deadlock errors

Created 12 years ago by seb, updated 12 years ago by seb.

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.

4 0
7 followers
Viewed: 21 232 times
Version: 1.1
Category: Tips
Tags: database

Update two models with one view

Created 12 years ago by sensorario, updated 12 years ago by SebK.

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).

9 3
13 followers
Viewed: 56 287 times
Version: 1.1
Category: Tips

Use application on production/development environment without making changes

Created 12 years ago by ifdattic, updated 12 years ago by ifdattic.

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.

8 1
11 followers
Viewed: 77 487 times
Version: 1.1
Category: Tips

Application-driven database with CDbMigration and an extended CActiveRecord

Created 13 years ago by Tudor Ilisoi, updated 13 years ago by Tudor Ilisoi.

This is an incipient implementation of application-driven database with Yii.

8 0
10 followers
Viewed: 16 804 times
Version: 1.1
Category: Others

Guidelines for good schema design

Created 13 years ago by Steve Friedl, updated 6 years ago by softark.

Virtually all Yii applications are built on top of a database, and though Yii is very flexible in how it addresses your DB, some design choices make things more convenient than others.

124 0
71 followers
Viewed: 123 601 times
Version: 1.1
Category: Tips

Sub-domains with different databases in Yii!

Created 13 years ago by jwerd, updated 13 years ago by jwerd.

I used another example posted here a while back where the person was modifying the index.php and adding in a switch case for different domains and loading separate config files. This was actually too much for me, because all my portals are the exact same (as far as routes, modules, extensions, etc) and if I ever wanted to add another route it wouldn't be feasible opening up all the config files t...

2 0
12 followers
Viewed: 26 251 times
Version: 1.1
Category: How-tos

Single table inheritance

Created 13 years ago by samdark, updated 13 years ago by samdark.

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...

34 0
35 followers
Viewed: 53 778 times
Version: 1.1
Category: How-tos

A simple class to use a different db for a module

Created 13 years ago by tydeas_dr, updated 13 years ago by Maurizio Domba Cerin.

What would you do if you want/need to have a different than the main database connection in an module's models?

8 0
12 followers
Viewed: 30 390 times
Version: 1.1
Category: Tips

Getting nulls from database instead of empty strings

Created 13 years ago by samdark, updated 13 years ago by samdark.

To get null from database instead of empty strings you need to set up your DB connection as follows:

13 0
11 followers
Viewed: 20 651 times
Version: 1.1
Category: Tips
Tags: database, null

Multiple-database support in Yii

Created 13 years ago by Steve Friedl, updated 12 years ago by phazei.

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.

20 0
39 followers
Viewed: 147 335 times
Version: 1.1
Category: How-tos
Tags: database

Multiple Databases and Multiple Domains

Created 14 years ago by got 2 doodle, updated 13 years ago by Maurizio Domba Cerin.

Add these lines in /config/main.php

'components'=>array(
.........
		'db'=>array(
			'connectionString' => 'mysql:host=localhost;dbname=database1',
			'emulatePrepare' => true,
			'username' => 'root',
			'password' => 'itsasecret',
			'charset' => 'utf8',
		),
		'db2'=>array(
		    'class' => 'CDbConnection',
			'connectionString' => 'mysql:host=localhost;dbname=databa...
13 2
15 followers
Viewed: 56 566 times
Version: 1.1
Category: Tutorials
Tags: database