Differences

This shows you the differences between the selected revision and the current version of the page.

punbb13:database_helpers 2010/04/12 06:55 punbb13:database_helpers 2020/02/06 11:04 current
Line 214: Line 214:
<code php>function drop_field($table_name, $field_name, $no_prefix = false)</code> <code php>function drop_field($table_name, $field_name, $no_prefix = false)</code>
-Deletes the ''$field_name'' field from the ''$table_name'' table.+Removes the ''$field_name'' field from the ''$table_name'' table.
-Here are some examples of the fields manipulation.+Here are examples of the fields manipulation.
-<code php>// Taken from db_update.php+<code php>// Taken from admin/db_update.php
$forum_db->alter_field('posts', 'poster_ip', 'VARCHAR(39)', true); $forum_db->alter_field('posts', 'poster_ip', 'VARCHAR(39)', true);
$forum_db->alter_field('users', 'registration_ip', 'VARCHAR(39)', false, '0.0.0.0');</code> $forum_db->alter_field('users', 'registration_ip', 'VARCHAR(39)', false, '0.0.0.0');</code>
Line 233: Line 233:
<code php>function index_exists($table_name, $index_name, $no_prefix = false)</code> <code php>function index_exists($table_name, $index_name, $no_prefix = false)</code>
 +
 +Checks if the index ''$index_name'' is present in the table ''$table_name''.
 +
<code php>function add_index($table_name, $index_name, $index_fields, $unique = false, $no_prefix = false)</code> <code php>function add_index($table_name, $index_name, $index_fields, $unique = false, $no_prefix = false)</code>
 +
 +Adds an index to the ''$table_name'' table. ''$index_fields'' is the array of fields to be added to the index.
 +
<code php>function drop_index($table_name, $index_name, $no_prefix = false)</code> <code php>function drop_index($table_name, $index_name, $no_prefix = false)</code>
 +Removes the ''$index_name'' index from the ''$table_name'' table.
 +
 +Here are examples of the indexes manipulation.
<code php>// Taken from admin/db_update.php <code php>// Taken from admin/db_update.php

Personal Tools