<< previous page   --   table of contents   --   next page >>
| | | | | | | |
  • Return to Table of Contents
  • Table of Contents

    1. General Information
    2. MySQL Installation
    3. Tutorial Introduction
    4. Database Administration
    5. MySQL Optimisation
    6. MySQL Language Reference
    7. MySQL Table Types
    8. MySQL APIs
    9. Extending MySQL

    592 MySQL Technical Reference for Version 4.0.3 appended.  Characters encoded are NUL (ASCII 0), `\n', `\r', `\', `'', `"', and Control-Z (see Section 6.1.1 [Literals], page 376). The string pointed to by from must be length bytes long.  You must allocate the to bu er to  be  at  least  length*2+1  bytes  long.   (In  the  worse  case,  each  character  may  need  to be encoded as using two bytes, and you need room for the terminating null byte.)  When mysql_escape_string() returns, the contents of to will be a null-terminated string.  The return value is the length of the encoded string, not including the terminating null character. Example char query[1000],*end; end = strmov(query,"INSERT INTO test_table values("); *end++ = '\''; end += mysql_real_escape_string(&mysql, end,"What's this",11); *end++ = '\''; *end++ = ','; *end++ = '\''; end += mysql_real_escape_string(&mysql, end,"binary data: \0\r\n",16); *end++ = '\''; *end++ = ')'; if (mysql_real_query(&mysql,query,(unsigned int) (end - query))) { fprintf(stderr, "Failed to insert row, Error: %s\n", mysql_error(&mysql)); } The  strmov()  function used in the example is included in the  mysqlclient  library and works like strcpy() but returns a pointer to the terminating null of the rst parameter. Return Values The length of the value placed into to, not including the terminating null character. Errors None. 8.4.3.43  mysql_real_query() int mysql_real_query(MYSQL *mysql, const char *query, unsigned long length) Description Executes the SQL query pointed to by query, which should be a string length bytes long. The  query  must  consist  of  a  single  SQL  statement.   You  should  not  add  a  terminating semicolon (`;') or \g to the statement.
     

    Customer Support CentreMySQL Reference Manual

    Web Hosting Services
    UNIX WEB HOSTING
    MERCHANT ACCOUNTS
    DEDICATED SERVERS
    E-COMMERCE HOSTING
    SUPPORT & FAQ's
    TERMS OF USE
    Domain Services
    DOMAIN
    REGISTRATION
    MANAGE
    YOUR ACCOUNT
    SUPPORT & FAQ's
    TERMS OF USE
    Corporate Info
    ABOUT US
    OUR NETWORK
    CONTACT US
    SITE MAP
    Copyright © 2002 Dyntex Group, Inc. All Rights Reserved
  • Return to Table of Contents
  • Back to top

  • Web Hosting: Manuals & FAQ's

    1. Unix-Based Web Hosting
    2. Unix Dedicated Servers
    3. Windows Dedicated Servers
    4. CuteFTP User’s Guide
    5. CuteHTML User’s Guide
    6. WS_FTP Pro User's Guide
    7. Miva Order User's Guide
    8. Miva Merchant User's Guide