• MySQL매뉴얼
    • MySQL 5.6 매뉴얼
    • MySQL 5.1 매뉴얼
    • MySQL 5.0 매뉴얼
    • MySQL HA 매뉴얼
  • 기술문서
    • Xtrabackup 구성
    • 메모리 사용량 모니터링
  • 서비스
    • MySQL유지보수
    • MySQL라이선스
  • 온라인문의
  • 회사소개
  • → 목 록 (MySQL5.1 한글메뉴얼) [close]
  • 1. MySQL 5.1 Reference Manual
  • 2. Installing and MySQL 업그레이드하기
  • 3. 사용 설명서 (Tutorial)
  • 4. MySQL 프로그램 사용하기
  • 5. 데이터베이스 관리
  • 6. 리플리케이션
  • 7. 최적화 (Optimization)
  • 8. 클라이언트 및 유틸리티 프로그램
  • 9. 언어 구조 (Language Structure)
  • 10. 문자 셋 지원
  • 24. API 및 라이브러리
  • 1. libmysqld, 임베디드 MySQL 서버 라이브러리
    2. MySQL C API
    1. C API 데이터 타입
    2. C API 함수 개요
    3. C API 함수 상세 내용
    4. C API 프리페어드 명령문
    5. C API 프리페어드 명령문 데이터 타입
    6. C API 프리페어드 명령문 함수 개요
    7. C API 프리페어드 명령문 함수 상세 내용
    8. C API 프리페어드 명령문의 문제점
    9. C API 멀티 명령문 실행
    10. C API 데이터 및 타입 값 처리
    11. C API 쓰레드 함수 상세 내역
    12. C API 임베디드 서버 함수 상세 내역
    13. 자동 재 접속 동작 제어
    14. C API를 사용할 때 자주 발생하는 문제점
    15. 클라이언트 프로그램 구축하기
    16. 쓰레디드 클라이언트 만들기
    3. MySQL PHP API
    4. MySQL Perl API
    5. MySQL C++ API
    6. MySQL Python API
    7. MySQL Tcl API
    8. MySQL Eiffel Wrapper
    9. MySQL프로그램 개발 유틸리티
  • 25. Connectors

24.2.2. C API 함수 개요

 

아래의 리스트는 C API에서 사용할 수 있는 함수를 나타낸 것이며, 각 함수에 대한 상세 설명은 다음 섹션에서 하기로 한다.

 

Function

Description

my_init()

Initialize global variables, and thread handler in thread-safe programs.

mysql_affected_rows()

Returns the number of rows changed/deleted/inserted by the last UPDATE, DELETE, or INSERT query.

mysql_autocommit()

Toggles autocommit mode on/off.

mysql_change_user()

Changes user and database on an open connection.

mysql_close()

Closes a server connection.

mysql_commit()

Commits the transaction.

mysql_connect()

Connects to a MySQL server. This function is deprecated; use mysql_real_connect() instead.

mysql_create_db()

Creates a database. This function is deprecated; use the SQL statement CREATE DATABASE instead.

mysql_data_seek()

Seeks to an arbitrary row number in a query result set.

mysql_debug()

Does a DBUG_PUSH with the given string.

mysql_drop_db()

Drops a database. This function is deprecated; use the SQL statement DROP DATABASE instead.

mysql_dump_debug_info()

Makes the server write debug information to the log.

mysql_eof()

Determines whether the last row of a result set has been read. This function is deprecated; mysql_errno() or mysql_error() may be used instead.

mysql_errno()

Returns the error number for the most recently invoked MySQL function.

mysql_error()

Returns the error message for the most recently invoked MySQL function.

mysql_escape_string()

Escapes special characters in a string for use in an SQL statement.

mysql_fetch_field()

Returns the type of the next table field.

mysql_fetch_field_direct()

Returns the type of a table field, given a field number.

mysql_fetch_fields()

Returns an array of all field structures.

mysql_fetch_lengths()

Returns the lengths of all columns in the current row.

mysql_fetch_row()

Fetches the next row from the result set.

mysql_field_seek()

Puts the column cursor on a specified column.

mysql_field_count()

Returns the number of result columns for the most recent statement.

mysql_field_tell()

Returns the position of the field cursor used for the last mysql_fetch_field().

mysql_free_result()

Frees memory used by a result set.

mysql_get_client_info()

Returns client version information as a string.

mysql_get_client_version()

Returns client version information as an integer.

mysql_get_host_info()

Returns a string describing the connection.

mysql_get_server_version()

Returns version number of server as an integer.

mysql_get_proto_info()

Returns the protocol version used by the connection.

mysql_get_server_info()

Returns the server version number.

mysql_info()

Returns information about the most recently executed query.

mysql_init()

Gets or initializes a MYSQL structure.

mysql_insert_id()

Returns the ID generated for an AUTO_INCREMENT column by the previous query.

mysql_kill()

Kills a given thread.

mysql_library_end()

Finalize the MySQL C API library.

mysql_library_init()

Initialize the MySQL C API library.

mysql_list_dbs()

Returns database names matching a simple regular expression.

mysql_list_fields()

Returns field names matching a simple regular expression.

mysql_list_processes()

Returns a list of the current server threads.

mysql_list_tables()

Returns table names matching a simple regular expression.

mysql_more_results()

Checks whether any more results exist.

mysql_next_result()

Returns/initiates the next result in multiple-statement executions.

mysql_num_fields()

Returns the number of columns in a result set.

mysql_num_rows()

Returns the number of rows in a result set.

mysql_options()

Sets connect options for mysql_connect().

mysql_ping()

Checks whether the connection to the server is working, reconnecting as necessary.

mysql_query()

Executes an SQL query specified as a null-terminated string.

mysql_real_connect()

Connects to a MySQL server.

mysql_real_escape_string()

Escapes special characters in a string for use in an SQL statement, taking into account the current character set of the connection.

mysql_real_query()

Executes an SQL query specified as a counted string.

mysql_refresh()

Flush or reset tables and caches.

mysql_reload()

Tells the server to reload the grant tables.

mysql_rollback()

Rolls back the transaction.

mysql_row_seek()

Seeks to a row offset in a result set, using value returned from mysql_row_tell().

mysql_row_tell()

Returns the row cursor position.

mysql_select_db()

Selects a database.

mysql_server_end()

Finalize the MySQL C API library.

mysql_server_init()

Initialize the MySQL C API library.

mysql_set_local_infile_default()

Set the LOAD DATA LOCAL INFILE handler callbacks to their default values.

mysql_set_local_infile_handler()

Install application-specific LOAD DATA LOCAL INFILE handler callbacks.

mysql_set_server_option()

Sets an option for the connection (like multi-statements).

mysql_sqlstate()

Returns the SQLSTATE error code for the last error.

mysql_shutdown()

Shuts down the database server.

mysql_stat()

Returns the server status as a string.

mysql_store_result()

Retrieves a complete result set to the client.

mysql_thread_end()

Finalize thread handler.

mysql_thread_id()

Returns the current thread ID.

mysql_thread_init()

Initialize thread handler.

mysql_thread_safe()

Returns 1 if the clients are compiled as thread-safe.

mysql_use_result()

Initiates a row-by-row result set retrieval.

mysql_warning_count()

Returns the warning count for the previous SQL statement.

 

어플리케이션은 아래와 같은 방식으로 MySQL과 상호 작용을 한다:

1.     mysql_library_init()를 호출해서 MySQL 라이브러리를 초기화 시킨다. 이 함수는 mysqlclient C 클라이언트 라이브러리와 mysqld 임베디드 서버 라이브러리에 모두 존재하기 때문에, -libmysqlclient 플래그와 링크를 해서 레귤러 클라이언트 프로그램을 구축하거나, 또는 -libmysqld 플래그와 링크해서 임베디드 서버 어플리케이션을 구축할 때 사용할 수가 있다.

2.     mysql_init()를 호출해서 연결 핸들러를 초기화 시킨 후에 mysql_real_connect()를 호출해서 서버와 연결한다.

3.     SQL 명령문을 실행한다.

4.     mysql_close()를 호출해서 MySQL 서버와의 연결을 종료한다.

5.     mysql_library_end()를 호출해서 MySQL 라이브러리 사용을 마친다.

서울시 강남구 영동대로 602 6층  TEL: 02-6061-0006
주식회사 이노클러스터  등록번호 : 727-86-02261
Copyright © innocluster Co. ltd. all rights reserved