plugins/include/dbi.inc
changeset 1874 6bd98dba0f2a
parent 1449 247975f09abc
child 1912 506170374d35
     1.1 --- a/plugins/include/dbi.inc	Fri Feb 22 01:56:22 2008 +0000
     1.2 +++ b/plugins/include/dbi.inc	Fri Feb 22 02:23:17 2008 +0000
     1.3 @@ -235,8 +235,14 @@
     1.4  native bool:SQL_GetError(Handle:hndl, String:error[], maxlength);
     1.5  
     1.6  /**
     1.7 - * Quotes a database string for literal insertion.  This is not needed
     1.8 - * for binding strings in prepared statements.
     1.9 + * Escapes a database string for literal insertion.  This is not needed
    1.10 + * for binding strings in prepared statements.  
    1.11 + *
    1.12 + * Generally, database strings are inserted into queries enclosed in 
    1.13 + * single quotes (').  If user input has a single quote in it, the 
    1.14 + * quote needs to be escaped.  This function ensures that any unsafe 
    1.15 + * characters are safely escaped according to the database engine and 
    1.16 + * the database's character set.
    1.17   *
    1.18   * @param hndl			A database Handle.
    1.19   * @param string		String to quote.
    1.20 @@ -247,7 +253,24 @@
    1.21   *						The buffer must be at least 2*strlen(string)+1.
    1.22   * @error				Invalid database or statement Handle.
    1.23   */
    1.24 -native bool:SQL_QuoteString(Handle:database, const String:string[], String:buffer[], maxlength, &written=0);
    1.25 +native bool:SQL_EscapeString(Handle:database, 
    1.26 +							 const String:string[], 
    1.27 +							 String:buffer[], 
    1.28 +							 maxlength, 
    1.29 +							 &written=0);
    1.30 +
    1.31 +/**
    1.32 + * This is a backwards compatibility stock.  You should use SQL_EscapeString() 
    1.33 + * instead, as this function will probably be deprecated in SourceMod 1.1.
    1.34 + */
    1.35 +stock bool:SQL_QuoteString(Handle:database,
    1.36 +						   const String:string[],
    1.37 +						   String:buffer[],
    1.38 +						   maxlength,
    1.39 +						   &written=0)
    1.40 +{
    1.41 +	return SQL_EscapeString(database, string, buffer, maxlength, written);
    1.42 +}
    1.43  
    1.44  /**
    1.45   * Executes a query and ignores the result set.