The world's most popular open source database
#include <my_global.h>#include <my_sys.h>#include <my_time.h>#include <mysys_err.h>#include <m_string.h>#include <m_ctype.h>#include "mysql.h"#include "mysql_version.h"#include "mysqld_error.h"#include "errmsg.h"#include <violite.h>#include <sys/stat.h>#include <signal.h>#include <time.h>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>#include <netdb.h>#include <sql_common.h>#include "client_settings.h"#include <errno.h>Include dependency graph for libmysql.c:

Go to the source code of this file.
| #define BIND_RESULT_DONE 1 |
Definition at line 1761 of file libmysql.c.
| #define DEFAULT_PREFETCH_ROWS (ulong) 1 |
Definition at line 1702 of file libmysql.c.
| #define INADDR_NONE -1 |
Definition at line 59 of file libmysql.c.
| #define IS_TRUNCATED | ( | value, | |||
| is_unsigned, | |||||
| min, | |||||
| max, | |||||
| umax | ) |
| #define MAX_DATE_REP_LENGTH 5 |
Definition at line 1739 of file libmysql.c.
| #define MAX_DATETIME_REP_LENGTH 12 |
Definition at line 1751 of file libmysql.c.
| #define MAX_DOUBLE_STRING_REP_LENGTH 331 |
Definition at line 1753 of file libmysql.c.
| #define MAX_LONG_DATA_LENGTH 8192 |
Definition at line 91 of file libmysql.c.
| #define MAX_TIME_REP_LENGTH 13 |
Definition at line 1745 of file libmysql.c.
| #define NOT_FIXED_DEC 31 |
| #define REPORT_DATA_TRUNCATION 2 |
Definition at line 1767 of file libmysql.c.
| #define RESET_LONG_DATA 2 |
Definition at line 1728 of file libmysql.c.
| #define RESET_SERVER_SIDE 1 |
Definition at line 1727 of file libmysql.c.
| #define RESET_STORE_RESULT 4 |
Definition at line 1729 of file libmysql.c.
| #define SOCKET_ERROR -1 |
Definition at line 84 of file libmysql.c.
Definition at line 92 of file libmysql.c.
| typedef struct st_default_local_infile default_local_infile_data |
| static unsigned int alloc_stmt_fields | ( | MYSQL_STMT * | stmt | ) | [static] |
Definition at line 2108 of file libmysql.c.
References alloc_root(), st_mysql_stmt::bind, st_mysql_field::charsetnr, st_mysql_field::db, st_mysql_field::decimals, st_mysql_field::def, st_mysql::field_count, st_mysql_stmt::field_count, st_mysql::fields, st_mysql_stmt::fields, st_mysql_field::flags, st_mysql::last_used_con, st_mysql_field::length, st_mysql_field::max_length, st_mysql_stmt::mem_root, st_mysql_stmt::mysql, mysql, st_mysql_field::name, st_mysql_field::org_name, st_mysql_field::org_table, strdup_root(), st_mysql_field::table, and st_mysql_field::type.
02109 { 02110 MYSQL_FIELD *fields, *field, *end; 02111 MEM_ROOT *alloc= &stmt->mem_root; 02112 MYSQL *mysql= stmt->mysql->last_used_con; 02113 02114 stmt->field_count= mysql->field_count; 02115 02116 /* 02117 Get the field information for non-select statements 02118 like SHOW and DESCRIBE commands 02119 */ 02120 if (!(stmt->fields= (MYSQL_FIELD *) alloc_root(alloc, 02121 sizeof(MYSQL_FIELD) * 02122 stmt->field_count)) || 02123 !(stmt->bind= (MYSQL_BIND *) alloc_root(alloc, 02124 sizeof(MYSQL_BIND) * 02125 stmt->field_count))) 02126 return 0; 02127 02128 for (fields= mysql->fields, end= fields+stmt->field_count, 02129 field= stmt->fields; 02130 field && fields < end; fields++, field++) 02131 { 02132 field->db = strdup_root(alloc,fields->db); 02133 field->table = strdup_root(alloc,fields->table); 02134 field->org_table= strdup_root(alloc,fields->org_table); 02135 field->name = strdup_root(alloc,fields->name); 02136 field->org_name = strdup_root(alloc,fields->org_name); 02137 field->charsetnr= fields->charsetnr; 02138 field->length = fields->length; 02139 field->type = fields->type; 02140 field->flags = fields->flags; 02141 field->decimals = fields->decimals; 02142 field->def = fields->def ? strdup_root(alloc,fields->def): 0; 02143 field->max_length= 0; 02144 } 02145 return stmt->field_count; 02146 }
Here is the call graph for this function:

| static void append_wild | ( | char * | to, | |
| char * | end, | |||
| const char * | wild | |||
| ) | [static] |
Definition at line 240 of file libmysql.c.
References strmov().
00241 { 00242 end-=5; /* Some extra */ 00243 if (wild && wild[0]) 00244 { 00245 to=strmov(to," like '"); 00246 while (*wild && to < end) 00247 { 00248 if (*wild == '\\' || *wild == '\'') 00249 *to++='\\'; 00250 *to++= *wild++; 00251 } 00252 if (*wild) /* Too small buffer */ 00253 *to++='%'; /* Nicer this way */ 00254 to[0]='\''; 00255 to[1]=0; 00256 } 00257 }
Here is the call graph for this function:

| MYSQL_FIELD* cli_list_fields | ( | MYSQL * | mysql | ) |
Definition at line 1197 of file libmysql.c.
References cli_read_rows(), st_mysql::field_alloc, st_mysql::field_count, mysql, NULL, protocol_41, query, st_mysql::server_capabilities, and unpack_fields().
01198 { 01199 MYSQL_DATA *query; 01200 if (!(query= cli_read_rows(mysql,(MYSQL_FIELD*) 0, 01201 protocol_41(mysql) ? 8 : 6))) 01202 return NULL; 01203 01204 mysql->field_count= (uint) query->rows; 01205 return unpack_fields(query,&mysql->field_alloc, 01206 mysql->field_count, 1, mysql->server_capabilities); 01207 }
Here is the call graph for this function:

| int cli_read_binary_rows | ( | MYSQL_STMT * | stmt | ) |
Definition at line 4628 of file libmysql.c.
References st_mysql_data::alloc, alloc_root(), cli_safe_read(), CR_OUT_OF_MEMORY, st_mysql_rows::data, st_mysql_data::data, DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, err, st_net::last_errno, st_net::last_error, st_mysql::last_used_con, st_mysql_rows::length, memcpy, st_mysql_stmt::mysql, mysql, st_mysql::net, st_mysql_rows::next, packet_error, st_net::read_pos, st_mysql_stmt::result, st_mysql_data::rows, st_mysql::server_status, set_stmt_errmsg(), set_stmt_error(), st_net::sqlstate, uint2korr, unknown_sqlstate, and st_mysql::warning_count.
04629 { 04630 ulong pkt_len; 04631 uchar *cp; 04632 MYSQL *mysql= stmt->mysql; 04633 MYSQL_DATA *result= &stmt->result; 04634 MYSQL_ROWS *cur, **prev_ptr= &result->data; 04635 NET *net = &mysql->net; 04636 DBUG_ENTER("cli_read_binary_rows"); 04637 04638 mysql= mysql->last_used_con; 04639 04640 while ((pkt_len= cli_safe_read(mysql)) != packet_error) 04641 { 04642 cp= net->read_pos; 04

