OneThird In CMS, O / Since R have not use the mapper tied in terms of SQL issued There is almost no
To use the SQL statement, please use the normal following command
sql_select_all ... Search system
sql_update ... Update system
Please access and use the $database of database objects
Example:
$ar = $database->sql_select_all( "select mode,block_type,date,metadata,link,title,type,id,pv_count from ".DBX."data_items where id=? ", $p_page ); if ($database->sql_update("update ".DBX."data_items set id=? where id=?", $r['chg_id'], $r['id'])) { 正常処理 }
For sql_select_all, you can use the extended form in v1.29 or later
Examples of extended format: You can pass in the array (which is useful if you want to adjust the SQL statement in the conditions)
$sql = array(" select id,metadata,date from ".DBX."user_log "); $sql[1] = array("where type=0 and att='coming' and circle=? ", $p_circle); if (isset($key)) { $sql[2] = array("and data=? ", $key); }
O / R mapper does not, but the command in order to absorb the difference of SQL format of SQLite and MySQL are available
$ut->sql_timestamp
Example:
$sql = array("select id, title from ".DBX."data_items where "); $sql[] = array(" {$ut->sql_timestamp("date")} < {$ut->sql_timestamp('?')}",date('Y-m-d 00:00:00', time()));
Time stamp, but I can choose two of text format and UNIX timestamp format (int type)
$sql = array("select id, title from ".DBX."data_items where "); $sql[] = array(" {$ut->sql_timestamp("date")} > {$ut->sql_timestamp(time())}");
Deburu frequently used in OneThird CMS will data_items, into two user_log
Please do not modify as directly as possible because otherwise the table will be the management information
data_items the page data, user_log is the data record that is hanging in the page data
Page data has taken a hierarchical structure, There are three types of the underlying page
Normal of the underlying page is displayed in a hierarchical structure in a separate page in the page folder plug-ins and page list plug-in
Do not appear in the list to other, there is inner pages to be displayed as part of the parent page
inner page is set to block_type 5
If you open by specifying a page number the inner page, and then redirected to the parent page
Finally, there is a hidden page
hidden page is usually page type is set to No. 50 (HIDDEN_ID) has been set that can not be displayed
The hidden page by specifying a page number if you open directly, it becomes 404 error
user_log is a table that has been prepared in order to add the data to the page
and hidden page, user_log Although you can have nearly the same use, because the direction of user_log the table length is in the compact, usually I think safe is better to use the user_log
In contrast, the more useful of using the hidden page when it is necessary according to the search data tied to the page
For column additional data_items, It does not matter to add a direct column in the database manager
Even then, the backup manager can do successfully backed up, including the added column
You should always column information if you want to restore the backup data that was backed up in the state where there is the added column is consistent
In addition, you can also add an entirely new table (enabled by v1.3x)
To the new Deburu to be backed up
As below, please add the table to files / 1 / plugin / plugin.php
Example: to add a table called test, test2
$params['database_backup_tables'] = array('test','test2');
In addition, be sure the table you want to add, you must provide a column that link
If the link is set to 0, it will be backed up at the time of full backup (and not backed up by the differential backup)
If you set the page number in the link, it will be backed up by being linked to the page number