GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing redbeanphp.com — RedBeanPHP :: Database
DatabaseThis chapter discusses general database functionality of RedBeanPHP. Server version (5.6+)Due to slight difference appearing between MySQL and MariaDB it might sometimes by handy to obtain the database server version string. You can use R::getDatabaseServerVersion() for this. ReflectionTo get all the columns of table 'book': To get all tables: Multiple databases
There are two important methods to keep in mind when working with multiple databases:
addDatabase() and selectDatabase().
To select a database, use the key you have previously specified: If you used R::setup() to connect to your database you can switch back to this database using: TransactionsRedBeanPHP offers three simple methods to use database transactions: begin(), commit() and rollback(). Usage: Because RedBeanPHP throws exceptions, you can catch the exceptions thrown by methods like R::store(), R::trash(), or one of your 'fuse' methods, and perform a rollback(). The rollback() will completely undo all the pending database changes. If you use caching, don't forget to call R::getWriter()->flushCache(); after rolling back! Otherwise, the database cache might still return old data. Transaction closureYou can also use this variation: The transaction() method supports nested transactions.
Note about auto-commits:
Column Functions (version 4.1+)
As of RedBeanPHP 4.1 you can bind an SQL function to a column.
This is useful for wrapping values when reading from / writing to
the database.
While this method has been implemented to support MySQL spatial
data types, you can use it for other purposes as well. As you have seen in the previous chapters RedBeanPHP will keep changing the schema to fit your needs, this is called 'fluid mode'. While this is great for development, you don't want this to happen on your production server. Learn how to freeze your database for deployment. Query counter (4.2+)To count get number of queries processed use: Logging (4.2+)Logging has always been possible with RedBeanPHP, however from 4.2 on there is an easier way to setup logging: Partial Beans (5+)Toggles 'partial bean mode'. If this mode has been selected the repository will only update the fields of a bean that have been changed rather than the entire bean. This method will return the previous mode (TRUE/FALSE). In RedBeanPHP 5.2+ you can also set the 4th parameter of setup() to TRUE to enable partial beans. back to main menu
Donate to RedBeanPHP using Monero: RedBeanPHP Easy ORM for PHP © 2026 Gabor de Mooij
() and the RedBeanPHP community
(credits) - Licensed New BSD/GPLv2 -
RedBeanPHP Archives
|
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |