API:EPrints/Database/mysql

From EPrints Documentation
Revision as of 09:56, 22 January 2013 by Tdb01r (talk | contribs)
Jump to: navigation, search

EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects


API: Core API

Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki


NAME

EPrints::Database::mysql - custom database methods for MySQL DB


SYNOPSIS

$c->{dbdriver} = 'mysql';
# $c->{dbhost} = 'localhost';
# $c->{dbport} = '3316';
$c->{dbname} = 'myrepo';
$c->{dbuser} = 'bob';
$c->{dbpass} = 'asecret';
# $c->{dbengine} = 'InnoDB';


DESCRIPTION

MySQL database wrapper.

Foreign keys will be defined if you use a DB engine that supports them (e.g. InnoDB).


MySQL-specific Annoyances

MySQL does not support sequences.

MySQL is (by default) lax about truncation.


METHODS

get_server_version

$version = $db->get_server_version

Return the database server version.


create_counters

$n = $db->create_counters()

Create and initialise the counters.


has_table

$boolean = $db->has_table( $tablename )

Return true if the a table of the given name exists in the database.


has_column

$boolean = $db->has_column( $tablename, $columnname )

Return true if the a table of the given name has a column named $columnname in the database.


has_counter

$success = $db->has_counter( $counter )

Returns true if $counter exists.


counter_next

$n = $db->counter_next( $counter )

Return the next unused value for the named counter. Returns undef if the counter doesn't exist.


counter_minimum

$db->counter_minimum( $counter, $value )

Ensure that the counter is set no lower that $value. This is used when importing eprints which may not be in scrict sequence.


counter_reset

$db->counter_reset( $counter )

Return the counter. Use with cautiuon.


COPYRIGHT

Copyright 2000-2011 University of Southampton.

This file is part of EPrints http://www.eprints.org/.

EPrints is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

EPrints is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with EPrints. If not, see http://www.gnu.org/licenses/.