Libmysqlclient

From 탱이의 잡동사니
Revision as of 16:45, 7 November 2015 by Pchero (talk | contribs) (Created page with "== Overview == Mysql c 클라이언트 라이브러리 libmysqlclient 내용 정리 == Connect == === mysql_real_connect === <source lang=c> MYSQL *mysql_real_connect( MY...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Overview

Mysql c 클라이언트 라이브러리 libmysqlclient 내용 정리

Connect

mysql_real_connect

<source lang=c> MYSQL *mysql_real_connect(

   MYSQL *mysql, const char *host, const char *user, const char *passwd, const char *db, 
   unsigned int port, const char *unix_socket, unsigned long client_flag
   ) 

</source> 제일 마지막 인자 client_flag 는, 대부분의 경우 0으로 셋팅한다.

client_flag

client_flag 값의 경우, 대부분은 0으로 설정하지만, 아래의 옵션들이 사용 가능하다.

  • CAN_HANDLE_EXPIRED_PASSWORDS
The client can handle expired passwords. For more information, see Section 6.3.7, “Password Expiration and Sandbox Mode”.
  • CLIENT_COMPRESS Use compression protocol.
  • CLIENT_FOUND_ROWS Return the number of found (matched) rows, not the number of changed rows.
  • CLIENT_IGNORE_SIGPIPE Prevents the client library from installing a SIGPIPE signal handler. This can be used to avoid conflicts with a handler that the * application has already installed.
  • CLIENT_IGNORE_SPACE Permit spaces after function names. Makes all functions names reserved words.
  • CLIENT_INTERACTIVE Permit interactive_timeout seconds (instead of wait_timeout seconds) of inactivity before closing the connection. The client's * session wait_timeout variable is set to the value of the session interactive_timeout variable.
  • CLIENT_LOCAL_FILES Enable LOAD DATA LOCAL handling.
  • CLIENT_MULTI_RESULTS Tell the server that the client can handle multiple result sets from multiple-statement executions or stored procedures. This flag is automatically enabled if CLIENT_MULTI_STATEMENTS is enabled. See the note following this table for more information about this flag.
  • CLIENT_MULTI_STATEMENTS Tell the server that the client may send multiple statements in a single string (separated by “;”). If this flag is not set, multiple-statement execution is disabled. See the note following this table for more information about this flag.
  • CLIENT_NO_SCHEMA Do not permit the db_name.tbl_name.col_name syntax. This is for ODBC. It causes the parser to generate an error if you use that syntax, which is useful for trapping bugs in some ODBC programs.
  • CLIENT_ODBC Unused.
  • CLIENT_SSL Use SSL (encrypted protocol). Do not set this option within an application program; it is set internally in the client library. Instead, use mysql_ssl_set() before calling mysql_real_connect().
  • CLIENT_REMEMBER_OPTIONS Remember options specified by calls to mysql_options(). Without this option, if mysql_real_connect() fails, you must repeat the mysql_options() calls before trying to connect again. With this option, the mysql_options() calls need not be repeated.