From 062f646f6790ebcf462441f2650aeca40299e9df Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Sat, 3 Mar 2007 11:10:20 +0100 Subject: [PATCH] [svn r11361] Added escape_string() method. Now we have a full range of database methods that can add a layer between the code and the database. --- main/inc/lib/database.lib.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/main/inc/lib/database.lib.php b/main/inc/lib/database.lib.php index ed3721fd26..942f4f7535 100644 --- a/main/inc/lib/database.lib.php +++ b/main/inc/lib/database.lib.php @@ -27,6 +27,10 @@ ============================================================================== * This is the main database library for Dokeos. * Include/require it in your code to use its functionality. +* Because this library contains all the basic database calls, it could be +* replaced by another library for say, PostgreSQL, to actually use Dokeos +* with another database (this is not ready yet because a lot of code still +* uses the MySQL database functions extensively). * * @package dokeos.library * @todo the table constants have all to start with TABLE_ @@ -576,6 +580,16 @@ class Database { return mysql_insert_id(); } + /** + * Escapes a string to insert into the database as text + * @param string The string to escape + * @return string The escaped string + * @author Yannick Warnier + */ + function escape_string($string) + { + return mysql_escape_string($string); + } /** * Gets the array from a SQL result (as returned by api_sql_query) - help achieving database independence * @param resource The result from a call to sql_query (e.g. api_sql_query)