Jump to content
Wiki Home
EPrints Home
Bazaar
Files
Main menu
Main menu
move to sidebar
hide
Navigation
Front Page
EPrints 3 Manual
EPrints Training Course
EPrints Glossary
Installing EPrints
How-to Configure EPrints
EPrints 3.2+ API
EPrints 3 Reference
EPrints Plugins
Wiki
All categories
Recent changes
Main Page
Help
EPrints Documentation
Search
Search
Appearance
Log in
Request account
Personal tools
Log in
Request account
Pages for logged out editors
learn more
Contributions
Talk
Editing
API:EPrints/Database
(section)
Page
Discussion
British English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Database Schema Manipulation=== <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> <span style='display:none'>User Comments</span> <!-- Edit below this comment --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_has_sequence --> ====has_sequence==== $boolean = $db->has_sequence( $name ) Returns <tt>true</tt> if a sequence of the given <tt>$name</tt> exists in the database. Otherwise, returns <tt>false</tt>. <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> <span style='display:none'>User Comments</span> <!-- Edit below this comment --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_create_sequence --> ====create_sequence==== $success = $db->create_sequence( $name ) Creates a new sequence object with <tt>$name</tt> and initialises to zero. <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> <span style='display:none'>User Comments</span> <!-- Edit below this comment --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_drop_sequence --> ====drop_sequence==== $success = $db->drop_sequence( $name ) Deletes a sequence object with <tt>$name</tt>. <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> <span style='display:none'>User Comments</span> <!-- Edit below this comment --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_has_column --> ====has_column==== $boolean = $db->has_column( $table, $column ) Return <tt>true</tt> if the named <tt>$table</tt> has the named <tt>$column</tt> in the database. <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> <span style='display:none'>User Comments</span> <!-- Edit below this comment --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_drop_column --> ====drop_column==== $success = $db->drop_column( $table, $column ) Drops the named <tt>$column</tt> from the named <tt>$table</tt>. <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> <span style='display:none'>User Comments</span> <!-- Edit below this comment --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_get_primary_key --> ====get_primary_key==== @columns = $db->get_primary_key( $tablename ) Returns a list of column names that comprise the primary key for the <tt>$tablename</tt>. Returns an empty list if no primary key exists. <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> <span style='display:none'>User Comments</span> <!-- Edit below this comment --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_index_name --> ====index_name==== $name = $db->index_name( $table, @cols ) Returns the name of the first index that starts with named columns <tt>@cols</tt> in the named <tt>$table</tt>. Returns <tt>undef</tt> if no index exists. <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> <span style='display:none'>User Comments</span> <!-- Edit below this comment --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_get_index_ids --> ====get_index_ids==== $ids = $db->get_index_ids( $table, $condition ) Return a reference to an array of the distinct primary keys from the named SQL <tt>$table</tt> which match the specified <tt>$condition</tt>. <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> <span style='display:none'>User Comments</span> <!-- Edit below this comment --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_create_index --> ====create_index==== $success = $db->create_index( $table, @columns ) Creates an index over <tt>@columns</tt> for named <tt>$table</tt>. Returns <tt>true</tt> on success, <tt>false</tt> otherwise. <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> <span style='display:none'>User Comments</span> <!-- Edit below this comment --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_create_unique_index --> ====create_unique_index==== $success = $db->create_unique_index( $tablename, @columns ) Creates a unique index over <tt>@columns</tt> for named <tt>$table</tt>. Returns <tt>true</tt> on success, <tt>false</tt> otherwise. <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> <span style='display:none'>User Comments</span> <!-- Edit below this comment --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_create_foreign_key --> ====create_foreign_key==== $ok = $db->create_foreign_key( $main_table, $table, $key_field ) Create a foreign key relationship between named <tt>$main_table</tt> and named <tt>$table</tt> using <tt>$key_field</tt>. This will cause records in <tt>$table</tt> to be deleted if the equivalent record is deleted from <tt>$main_table</tt>. <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> <span style='display:none'>User Comments</span> <!-- Edit below this comment --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_get_tables --> ====get_tables==== @tables = $db->get_tables( [ $dbname ] ) Returns a list of all the tables in the database. <tt>$dbname</tt> specifies a particular database name of current connection has access to more than one database. <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> <span style='display:none'>User Comments</span> <!-- Edit below this comment --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_has_table --> ====has_table==== $boolean = $db->has_table( $tablename ) Returns boolean dependent on whether a table of the <tt>$tablename</tt> exists in the database. <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> <span style='display:none'>User Comments</span> <!-- Edit below this comment --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_create_table --> ====create_table==== $success = $db->create_table( $tablename, $setkey, @fields ); Creates a new table with <tt>$tablename</tt> based on <tt>@fields</tt>. The first <tt>$setkey</tt> number of fields are used for its primary key. <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> <span style='display:none'>User Comments</span> <!-- Edit below this comment --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_drop_table --> ====drop_table==== $db->drop_table( @tables ) Delete the named <tt>@tables</tt>. Use with caution! <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> <span style='display:none'>User Comments</span> <!-- Edit below this comment --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_rename_table --> ====rename_table==== $db->rename_table( $table_from, $table_to ) Renames the table named <tt>$table_from</tt> to <tt>$table_to</tt>. <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> <span style='display:none'>User Comments</span> <!-- Edit below this comment --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_swap_table --> ====swap_table==== $db->swap_table( $table_a, $table_b ) Renames table named <tt>$table_a</tt> to <tt>$table_b</tt> and vice-versa. <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> <span style='display:none'>User Comments</span> <!-- Edit below this comment --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=head_eprints_schema_manipulation -->
Summary:
Please note that all contributions to EPrints Documentation may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
EPrints Documentation:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)