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!
===Quoting=== <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_prep_int --> ====prep_int==== $mungedvalue = EPrints::Database::prep_int( $value ) Escape numerical <tt>$value</tt> for an SQL statement. <tt>undef</tt> becomes <tt>NULL</tt>. Anything else becomes a number (zero if needed). <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_prep_value --> ====prep_value==== $mungedvalue = EPrints::Database::prep_value( $value ) Escape <tt>$value</tt> for an SQL statement. Modify value such that <tt>"</tt> becomes <tt>\"</tt> and <tt>\</tt> becomes <tt>\\</tt> and <tt>'</tt> becomes <tt>\'</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_prep_like_value --> ====prep_like_value==== $mungedvalue = EPrints::Database::prep_like_value( $value ) Escape <tt>$value</tt> for an SQL <tt>LIKE</tt> clause. In addition to <tt>'</tt> <tt>"</tt> and <tt>\</tt> also escapes <tt>%</tt> and <tt>_</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_quote_value --> ====quote_value==== $str = $db->quote_value( $value ) Return a quoted version of <tt>$value</tt>. To quote a <tt>LIKE</tt> value you should use: $db->quote_value( EPrints::Database::prep_like_value( $foo ) . '%' ); <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_quote_int --> ====quote_int==== $str = $db->quote_int( $value ) Return a quoted integer for <tt>$value</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_quote_binary --> ====quote_binary==== $str = $db->quote_binary( $bytes ) Some databases (Oracle/PostgreSQL) require transforms of binary data to work correctly. This method should be called on data <tt>$bytes</tt> containing null bytes or back-slashes before being passed on [[API:EPrints/Database#quote_value|quote_value]]. <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_quote_ordervalue --> ====quote_ordervalue==== $str = $db->quote_ordervalue( $field, $value ) Some databases (Oracle) can't order by <tt>CLOB</tt>s so need special treatment when creating the ordervalues tables. This method allows any fixing-up required for string data <tt>$value</tt> for <tt>$field</tt> before it's inserted. <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_quote_identifier --> ====quote_identifier==== $str = $db->quote_identifier( @parts ) Quote a database identifier (e.g. table names). Multiple <tt>@parts</tt> will be joined by dots (<tt>.</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_prepare_regexp --> ====prepare_regexp==== $sql = $db->prepare_regexp( $col, $value ) The syntax used for regular expressions varies across databases. This method takes two quoted string and returns a SQL expression that will apply the quoted regexp <tt>$value</tt> to the quoted column <tt>$col</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_sql_as --> ====sql_as==== $sql = $db->sql_AS() Returns the syntactic glue to use when aliasing. SQL 92 databases will happily use <tt>AS</tt> but some databases (Oracle) will not accept it. <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_sql_like --> ====sql_like==== $sql = $db->sql_LIKE() Returns the syntactic glue to use when making a case-insensitive <tt>LIKE</tt>. PostgreSQL requires <tt>ILIKE</tt> while everything else uses <tt>LIKE</tt> and the column collation. <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_counters -->
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)