PageRenderTime 52ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/ext/mysqli/mysqli_libmysql.h

http://github.com/php/php-src
C Header | 127 lines | 83 code | 18 blank | 26 comment | 4 complexity | a8b473da53e35e70ea3a34551798af18 MD5 | raw file
Possible License(s): BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, LGPL-2.1
  1. /*
  2. +----------------------------------------------------------------------+
  3. | Copyright (c) The PHP Group |
  4. +----------------------------------------------------------------------+
  5. | This source file is subject to version 3.01 of the PHP license, |
  6. | that is bundled with this package in the file LICENSE, and is |
  7. | available through the world-wide-web at the following url: |
  8. | http://www.php.net/license/3_01.txt |
  9. | If you did not receive a copy of the PHP license and are unable to |
  10. | obtain it through the world-wide-web, please send a note to |
  11. | license@php.net so we can mail you a copy immediately. |
  12. +----------------------------------------------------------------------+
  13. | Authors: Georg Richter <georg@php.net> |
  14. | Andrey Hristov <andrey@php.net> |
  15. | Ulf Wendel <uw@php.net> |
  16. +----------------------------------------------------------------------+
  17. */
  18. #ifndef MYSQLI_LIBMYSQL_H
  19. #define MYSQLI_LIBMYSQL_H
  20. /* These are unused */
  21. #define MYSQLI_CLOSE_EXPLICIT 0
  22. #define MYSQLI_CLOSE_IMPLICIT 1
  23. #define MYSQLI_CLOSE_DISCONNECTED 2
  24. #define MYSQLND_OPT_NUMERIC_AND_DATETIME_AS_UNICODE 200
  25. #define MYSQLND_OPT_INT_AND_YEAR_AS_INT 201
  26. /* r->data should be always NULL, at least in recent libmysql versions, the status changes once data is read*/
  27. #define mysqli_result_is_unbuffered(r) ((r)->handle && (r)->handle->status == MYSQL_STATUS_USE_RESULT && (r)->data == NULL)
  28. #define mysqli_result_is_unbuffered_and_not_everything_is_fetched(r) mysqli_result_is_unbuffered(r)
  29. #define mysqli_server_status(c) (c)->server_status
  30. #define mysqli_stmt_get_id(s) ((s)->stmt_id)
  31. #define mysqli_stmt_warning_count(s) mysql_warning_count((s)->mysql)
  32. #define mysqli_stmt_server_status(s) (s)->mysql->server_status
  33. #define mysqli_stmt_get_connection(s) (s)->mysql
  34. #define mysqli_close(c, is_forced) mysql_close((c))
  35. #define mysqli_stmt_close(c, implicit) mysql_stmt_close((c))
  36. #define mysqli_free_result(r, is_forced) mysql_free_result((r))
  37. #define mysqli_change_user_silent(c, u, p, d, p_len) mysql_change_user((c), (u), (p), (d))
  38. #define TRANS_START_NO_OPT 0
  39. #define TRANS_START_WITH_CONSISTENT_SNAPSHOT 1
  40. #define TRANS_START_READ_WRITE 2
  41. #define TRANS_START_READ_ONLY 4
  42. #define TRANS_COR_NO_OPT 0
  43. #define TRANS_COR_AND_CHAIN 1
  44. #define TRANS_COR_AND_NO_CHAIN 2
  45. #define TRANS_COR_RELEASE 4
  46. #define TRANS_COR_NO_RELEASE 8
  47. /*
  48. These functions also reside in ext/mysqlnd/mysqlnd_portability.h but since it is only made
  49. available if one wants to build mysqli against mysqlnd and they are useful for libmysql as
  50. well, we check whether they're not defined [build with libmysql is desired] and define them.
  51. Bit values are sent in reverted order of bytes, compared to normal !!!
  52. */
  53. #ifndef uint1korr
  54. #define uint1korr(A) (*(((uint8_t*)(A))))
  55. #endif
  56. #ifndef bit_uint2korr
  57. #define bit_uint2korr(A) ((uint16_t) (((uint16_t) (((unsigned char*) (A))[1])) +\
  58. ((uint16_t) (((unsigned char*) (A))[0]) << 8)))
  59. #endif
  60. #ifndef bit_uint3korr
  61. #define bit_uint3korr(A) ((uint32_t) (((uint32_t) (((unsigned char*) (A))[2])) +\
  62. (((uint32_t) (((unsigned char*) (A))[1])) << 8) +\
  63. (((uint32_t) (((unsigned char*) (A))[0])) << 16)))
  64. #endif
  65. #ifndef bit_uint4korr
  66. #define bit_uint4korr(A) ((uint32_t) (((uint32_t) (((unsigned char*) (A))[3])) +\
  67. (((uint32_t) (((unsigned char*) (A))[2])) << 8) +\
  68. (((uint32_t) (((unsigned char*) (A))[1])) << 16) +\
  69. (((uint32_t) (((unsigned char*) (A))[0])) << 24)))
  70. #endif
  71. #ifndef bit_uint5korr
  72. #define bit_uint5korr(A) ((uint64_t)(((uint32_t) (((unsigned char*) (A))[4])) +\
  73. (((uint32_t) (((unsigned char*) (A))[3])) << 8) +\
  74. (((uint32_t) (((unsigned char*) (A))[2])) << 16) +\
  75. (((uint32_t) (((unsigned char*) (A))[1])) << 24)) +\
  76. (((uint64_t) (((unsigned char*) (A))[0])) << 32))
  77. #endif
  78. #ifndef bit_uint6korr
  79. #define bit_uint6korr(A) ((uint64_t)(((uint32_t) (((unsigned char*) (A))[5])) +\
  80. (((uint32_t) (((unsigned char*) (A))[4])) << 8) +\
  81. (((uint32_t) (((unsigned char*) (A))[3])) << 16) +\
  82. (((uint32_t) (((unsigned char*) (A))[2])) << 24)) +\
  83. (((uint64_t) (((uint32_t) (((unsigned char*) (A))[1])) +\
  84. (((uint32_t) (((unsigned char*) (A))[0]) << 8)))) <<\
  85. 32))
  86. #endif
  87. #ifndef bit_uint7korr
  88. #define bit_uint7korr(A) ((uint64_t)(((uint32_t) (((unsigned char*) (A))[6])) +\
  89. (((uint32_t) (((unsigned char*) (A))[5])) << 8) +\
  90. (((uint32_t) (((unsigned char*) (A))[4])) << 16) +\
  91. (((uint32_t) (((unsigned char*) (A))[3])) << 24)) +\
  92. (((uint64_t) (((uint32_t) (((unsigned char*) (A))[2])) +\
  93. (((uint32_t) (((unsigned char*) (A))[1])) << 8) +\
  94. (((uint32_t) (((unsigned char*) (A))[0])) << 16))) <<\
  95. 32))
  96. #endif
  97. #ifndef bit_uint8korr
  98. #define bit_uint8korr(A) ((uint64_t)(((uint32_t) (((unsigned char*) (A))[7])) +\
  99. (((uint32_t) (((unsigned char*) (A))[6])) << 8) +\
  100. (((uint32_t) (((unsigned char*) (A))[5])) << 16) +\
  101. (((uint32_t) (((unsigned char*) (A))[4])) << 24)) +\
  102. (((uint64_t) (((uint32_t) (((unsigned char*) (A))[3])) +\
  103. (((uint32_t) (((unsigned char*) (A))[2])) << 8) +\
  104. (((uint32_t) (((unsigned char*) (A))[1])) << 16) +\
  105. (((uint32_t) (((unsigned char*) (A))[0])) << 24))) <<\
  106. 32))
  107. #endif
  108. #endif /* MYSQLI_LIBMYSQL_H */