Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

cubrid_real_escape_string(3) [php man page]

CUBRID_REAL_ESCAPE_STRING(3)						 1					      CUBRID_REAL_ESCAPE_STRING(3)

cubrid_real_escape_string - Escape special characters in a string for use in an SQL statement

SYNOPSIS
string cubrid_real_escape_string (string $unescaped_string, [resource $conn_identifier]) DESCRIPTION
This function returns the escaped string version of the given string. It will escape the following characters: '. In general, single quo- tations are used to enclose character string. Double quotations may be used as well depending on the value of ansi_quotes, which is a parameter related to SQL statement. If the ansi_quotes value is set to no, character string enclosed by double quotations is handled as character string, not as an identifier. The default value is yes. If you want to include a single quote as part of a character string, enter two single quotes in a row. PARAMETERS
o $unescaped_string -The string that is to be escaped. o $conn_identifier - The CUBRID connection. If the connection identifier is not specified, the last connection opened by cubrid_connect(3) is assumed. RETURN VALUES
Escaped string version of the given string, on success. FALSE on failure. EXAMPLES
Example #1 cubrid_real_escape_string(3) example <?php $conn = cubrid_connect("localhost", 33000, "demodb"); $unescaped_str = ' !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~'; $escaped_str = cubrid_real_escape_string($unescaped_str); $len = strlen($unescaped_str); @cubrid_execute($conn, "DROP TABLE cubrid_test"); cubrid_execute($conn, "CREATE TABLE cubrid_test (t char($len))"); cubrid_execute($conn, "INSERT INTO cubrid_test (t) VALUES('$escaped_str')"); $req = cubrid_execute($conn, "SELECT * FROM cubrid_test"); $row = cubrid_fetch_assoc($req); var_dump($row); cubrid_close_request($req); cubrid_disconnect($conn); ?> The above example will output: array(1) { ["t"]=> string(95) " !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~" } PHP Documentation Group CUBRID_REAL_ESCAPE_STRING(3)

Check Out this Related Man Page

CUBRID_AFFECTED_ROWS(3) 						 1						   CUBRID_AFFECTED_ROWS(3)

cubrid_affected_rows - Return the number of rows affected by the last SQL statement

SYNOPSIS
int cubrid_affected_rows ([resource $conn_identifier]) DESCRIPTION
int cubrid_affected_rows ([resource $req_identifier]) The cubrid_affected_rows(3) function is used to get the number of rows affected by the SQL statement (INSERT, DELETE, UPDATE). PARAMETERS
o $conn_identifier -The CUBRID connection. If the connection identifier is not specified, the last link opend by cubrid_connect(3) is assumed. o $req_identifier - Request Identifier, could be returned from either cubrid_prepare(3) or cubrid_execute(3). If the request identifier is not spec- ified, the last identifier requested by cubrid_prepare(3) or cubrid_execute(3) is assumed. RETURN VALUES
Number of rows affected by the SQL statement, when process is successful. -1, when SQL statement is not INSERT, DELETE or UPDATE. FALSE, when the request identifier is not specified, and there is no last request. EXAMPLES
Example #1 cubrid_affected_rows(3) example <?php $conn = cubrid_connect('localhost', 33000, 'demodb', 'dba', ''); cubrid_execute($conn, "DROP TABLE IF EXISTS cubrid_test"); cubrid_execute($conn, "CREATE TABLE cubrid_test (d varchar)"); $sql_stmt = "INSERT INTO cubrid_test(d) VALUES('php-test')"; $req = cubrid_prepare($conn, $sql_stmt); for ($i = 0; $i < 10; $i++) { cubrid_execute($req); } cubrid_commit($conn); $req = cubrid_execute($conn, "DELETE FROM cubrid_test WHERE d='php-test'", CUBRID_ASYNC); var_dump(cubrid_affected_rows()); var_dump(cubrid_affected_rows($conn)); var_dump(cubrid_affected_rows($req)); cubrid_disconnect($conn); print "done!"; ?> The above example will output: Rows deleted: 5 SEE ALSO
cubrid_execute(3). PHP Documentation Group CUBRID_AFFECTED_ROWS(3)
Man Page