第11月第20天 sqlite3_open xcode mysql connector
1.
sqlite3_open 死锁
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
frame #0: 0x0000000116e22c22 libsystem_kernel.dylib`__psynch_mutexwait + 10
frame #1: 0x0000000116e57dfa libsystem_pthread.dylib`_pthread_mutex_lock_wait + 100
* frame #2: 0x000000010d550e3a MLPlayer`sqlite3Malloc [inlined] sqlite3_mutex_enter(p=<unavailable>) at sqlite3.c:21778 [opt]
frame #3: 0x000000010d550e2f MLPlayer`sqlite3Malloc(n=127) at sqlite3.c:23035 [opt]
frame #4: 0x000000010d55a7db MLPlayer`sqlite3DbMallocRaw(db=0x00007f9cf7617ed0, n=<unavailable>) at sqlite3.c:23374 [opt]
frame #5: 0x000000010d559402 MLPlayer`sqlite3DbMallocZero(db=<unavailable>, n=127) at sqlite3.c:23318 [opt]
frame #6: 0x000000010d59c943 MLPlayer`sqlite3FindCollSeq [inlined] findCollSeqEntry at sqlite3.c:92028 [opt]
frame #7: 0x000000010d59c8f7 MLPlayer`sqlite3FindCollSeq(db=<unavailable>, enc=<unavailable>, zName=<unavailable>, create=<unavailable>) at sqlite3.c:92079 [opt]
frame #8: 0x000000010d55ffe5 MLPlayer`createCollation(db=<unavailable>, zName=<unavailable>, enc=<unavailable>, pCtx=<unavailable>, xCompare=<unavailable>, xDel=<unavailable>) at sqlite3.c:124965 [opt]
frame #9: 0x000000010d55f84b MLPlayer`openDatabase(zFilename="/Users/temp/Library/Developer/CoreSimulator/Devices/F31C98A5-1D5C-4053-B6E2-1E622E430721/data/Containers/Data/Application/CCAE5F2D-0E09-4EBE-866A-C89D4E59AD38/Documents/xx.db", ppDb=<unavailable>, flags=<unavailable>, zVfs=0x0000000000000000) at sqlite3.c:125438 [opt]
frame #10: 0x000000010d0f82d8 MLPlayer`-[PAFMDatabase open](self=0x000060000008ece0, _cmd="open") at PAFMDatabase.m:144
http://bbs.csdn.net/topics/370165256
2. xcode mysql connector
. 编译Connector/C(因为Connector/C++依赖Connector/C)
解压缩源码, 比如释放到F盘, 并改名为mysqlc(纯粹为了方便说明)
打开CMAKE-GUI(在安装目录里找), Source Path选择"F:\mysqlc", Build Path选择"F:\buildc"
Build Path可以和Source Path一样
点Configure, 选择编译器与平台, 点Finish, 出现"Configuring done"后点Generate
出现"Generating done"后, CMAKE部分完事儿
在"F:\buildc"里找项目文件(sln), 打开, 编译(注意Debug与Release), C组件搞定
http://blog.csdn.net/sidyhe/article/details/50845583
http://mirrors.sohu.com/mysql/Connector-C/mysql-connector-c-6.1.6-src.tar.gz
3.
ulong
cli_safe_read_with_ok(MYSQL *mysql, my_bool parse_ok,
my_bool *is_data_packet)
{
...
if (net->read_pos[] == )
{
/*
After server reprts an error, usually it is ready to accept new commands and
we set stage to READY_FOR_COMMAND. This can be modified by the caller of
cli_safe_read().
*/
MYSQL_TRACE_STAGE(mysql, READY_FOR_COMMAND); if (len > )
{
uchar *pos= net->read_pos+;
net->last_errno=uint2korr(pos);
pos+=;
len-=;
if (protocol_41(mysql) && pos[] == '#')
{
strmake(net->sqlstate, (char*)pos+, SQLSTATE_LENGTH);
pos+= SQLSTATE_LENGTH+;
}
else
{
/*
The SQL state hasn't been received -- it should be reset to HY000
(unknown error sql state).
*/ my_stpcpy(net->sqlstate, unknown_sqlstate);
} (void) strmake(net->last_error,(char*) pos,
MY_MIN((uint) len,(uint) sizeof(net->last_error)-));
}
else
set_mysql_error(mysql, CR_UNKNOWN_ERROR, unknown_sqlstate);
/*
Cover a protocol design error: error packet does not
contain the server status. Therefore, the client has no way
to find out whether there are more result sets of
a multiple-result-set statement pending. Luckily, in 5.0 an
error always aborts execution of a statement, wherever it is
a multi-statement or a stored procedure, so it should be
safe to unconditionally turn off the flag here.
*/
mysql->server_status&= ~SERVER_MORE_RESULTS_EXISTS; DBUG_PRINT("error",("Got error: %d/%s (%s)",
net->last_errno,
net->sqlstate,
net->last_error));
return(packet_error);
}
(lldb) p net->buff
(unsigned char *) $0 = 0x0000000101809000 "\377z\x04#42S02Table 'test.address_book_group_00' doesn't exist"
(lldb) p net->buff[0]
(unsigned char) $1 = '\xff'
(lldb) p net->buff[1]
(unsigned char) $2 = 'z'
(lldb) p net->buff[2]
(unsigned char) $3 = '\x04'
(lldb) p net->buff[5]
(unsigned char) $4 = '2'
(lldb) p net->buff[6]
(unsigned char) $5 = 'S'
(lldb) p net->buff[7]
(unsigned char) $6 = '0'
(lldb) p net->buff[8]
(unsigned char) $7 = '2'
(lldb) p net->buff[9]
(unsigned char) $8 = 'T'
(lldb) p net->buff[10]
(unsigned char) $9 = 'a'
(lldb) p net->buff[11]
(unsigned char) $10 = 'b'
(lldb) p net->buff[12]
(unsigned char) $11 = 'l'
(lldb) p net->buff[13]
(unsigned char) $12 = 'e'
(lldb) p pos
(uchar *) $13 = 0x0000000101809003 "#42S02Table 'test.address_book_group_00' doesn't exist"
(lldb) p pos
(uchar *) $14 = 0x0000000101809009 "Table 'test.address_book_group_00' doesn't exist"
cli_read_query_result: error: Got error: 1146/42S02 (Table 'test.address_book_group_00' doesn't exist)
1146=0x47a=z\x04 net->last_errno
\377=\xff=255 net->read_pos[0] == 255
42S02 net->sqlstate
https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_basic_err_packet.html
| Type | Name | Description |
|---|---|---|
| int<1> | header | 0xFF ERR packet header |
| int<2> | error_code | error-code |
| if capabilities & CLIENT_PROTOCOL_41 { | ||
| string[1] | sql_state_marker | # marker of the SQL state |
| string[5] | sql_state | SQL state |
| } | ||
| string<EOF> | error_message | human readable error message |
MYSQL * STDCALL
CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
const char *passwd, const char *db,
uint port, const char *unix_socket,ulong client_flag)
{
...
pkt_end= (char*)net->read_pos + pkt_length;
/* Check if version of protocol matches current one */
mysql->protocol_version= net->read_pos[];
DBUG_DUMP("packet",(uchar*) net->read_pos,);
DBUG_PRINT("info",("mysql protocol version %d, server=%d",
PROTOCOL_VERSION, mysql->protocol_version));
if (mysql->protocol_version != PROTOCOL_VERSION)
{
set_mysql_extended_error(mysql, CR_VERSION_ERROR, unknown_sqlstate,
ER(CR_VERSION_ERROR), mysql->protocol_version,
PROTOCOL_VERSION);
goto error;
}
server_version_end= end= strend((char*) net->read_pos+);
mysql->thread_id=uint4korr((uchar*) end + );
end+=;
/*
Scramble is split into two parts because old clients do not understand
long scrambles; here goes the first part.
*/
scramble_data= end;
scramble_data_len= AUTH_PLUGIN_DATA_PART_1_LENGTH + ;
scramble_plugin= NULL;
end+= scramble_data_len; if (pkt_end >= end + )
mysql->server_capabilities=uint2korr((uchar*) end);
if (pkt_end >= end + )
{
/* New protocol with 16 bytes to describe server characteristics */
mysql->server_language=end[];
mysql->server_status=uint2korr((uchar*) end + );
mysql->server_capabilities|= uint2korr((uchar*) end + ) << ;
pkt_scramble_len= end[];
if (pkt_scramble_len < )
{
set_mysql_error(mysql, CR_MALFORMED_PACKET,
unknown_sqlstate); /* purecov: inspected */
goto error;
}
}
...
/*
Part 2: invoke the plugin to send the authentication data to the server
*/ if (run_plugin_auth(mysql, scramble_buffer, scramble_data_len,
scramble_plugin, db))
goto error;
(lldb) p net->read_pos
(unsigned char *) $0 = 0x0000000101009e00 "\n5.6.21"
'\n'=PROTOCOL_VERSION(10) mysql->protocol_version
4.
MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
unsigned int fields)
... while (*(cp=net->read_pos) == || is_data_packet)
{
result->rows++;
if (!(cur= (MYSQL_ROWS*) alloc_root(&result->alloc,
sizeof(MYSQL_ROWS))) ||
!(cur->data= ((MYSQL_ROW)
alloc_root(&result->alloc,
(fields+)*sizeof(char *)+pkt_len))))
{
free_rows(result);
set_mysql_error(mysql, CR_OUT_OF_MEMORY, unknown_sqlstate);
DBUG_RETURN();
}
*prev_ptr=cur;
prev_ptr= &cur->next;
to= (char*) (cur->data+fields+);
end_to=to+pkt_len-;
for (field= ; field < fields ; field++)
{
if ((len=(ulong) net_field_length(&cp)) == NULL_LENGTH)
{ /* null field */
cur->data[field] = ;
}
else
{
cur->data[field] = to;
if (len > (ulong) (end_to - to))
{
free_rows(result);
set_mysql_error(mysql, CR_MALFORMED_PACKET, unknown_sqlstate);
DBUG_RETURN();
}
memcpy(to,(char*) cp,len); to[len]=;
to+=len+;
cp+=len;
if (mysql_fields)
{
if (mysql_fields[field].max_length < len)
mysql_fields[field].max_length=len;
}
}
}
cur->data[field]=to; /* End of last field */
if ((pkt_len= cli_safe_read(mysql, &is_data_packet)) == packet_error)
{
free_rows(result);
DBUG_RETURN();
}
}
(uchar *) cp = 0x0000000101805800 "\x012\x06aaaaaa"
(char *) to = 0x0000000101802840 "2"
(lldb) p len
(ulong) $0 = 1
(char *) to = 0x0000000101802842 "aaaaaa"
(lldb) p len
(ulong) $1 = 6
(uchar *) cp = 0x000000010280b400 "\x0222\x06aaaaaa"
第11月第20天 sqlite3_open xcode mysql connector的更多相关文章
- 2016年11月30日 星期三 --出埃及记 Exodus 20:21
2016年11月30日 星期三 --出埃及记 Exodus 20:21 The people remained at a distance, while Moses approached the th ...
- 2016年11月29日 星期二 --出埃及记 Exodus 20:20
2016年11月29日 星期二 --出埃及记 Exodus 20:20 Moses said to the people, "Do not be afraid. God has come t ...
- 2016年11月28日 星期一 --出埃及记 Exodus 20:19
2016年11月28日 星期一 --出埃及记 Exodus 20:19 and said to Moses, "Speak to us yourself and we will listen ...
- 2016年11月27日 星期日 --出埃及记 Exodus 20:18
2016年11月27日 星期日 --出埃及记 Exodus 20:18 When the people saw the thunder and lightning and heard the trum ...
- 2016年11月26日 星期六 --出埃及记 Exodus 20:17
2016年11月26日 星期六 --出埃及记 Exodus 20:17 "You shall not covet your neighbor's house. You shall not c ...
- 2016年11月25日 星期五 --出埃及记 Exodus 20:16
2016年11月25日 星期五 --出埃及记 Exodus 20:16 "You shall not give false testimony against your neighbor.不 ...
- 2016年11月24日 星期四 --出埃及记 Exodus 20:15
2016年11月24日 星期四 --出埃及记 Exodus 20:15 "You shall not steal.不可偷盗.
- 2016年11月23日 星期三 --出埃及记 Exodus 20:14
2016年11月23日 星期三 --出埃及记 Exodus 20:14 "You shall not commit adultery.不可奸淫.
- 2016年11月22日 星期二 --出埃及记 Exodus 20:13
2016年11月22日 星期二 --出埃及记 Exodus 20:13 "You shall not murder.不可杀人.
随机推荐
- 深度学习目标检测综述推荐之 Xiaogang Wang ISBA 2015
一.INTRODUCTION部分 (1)先根据时间轴讲了历史 (2)常见的基础模型 (3)讲了深度学习的优势 那就是feature learning,而不用人工划分的feature engineeri ...
- MSSQL批量写入数据方案
近来有一个项目Feature需要有批量写入数据的场景,正巧整理资料发现自己以前也类似实现的项目,在重构的同时把相关资料做了一个简单的梳理,方便大家参考. 循环写入(简单粗暴,毕业设计就这样干的)(不推 ...
- (第十二周)Debug阶段成员贡献分
项目名:食物链教学工具 组名:奋斗吧兄弟 组长:黄兴 组员:李俞寰.杜桥.栾骄阳.王东涵 个人贡献分=基础分+表现分 基础分=5*5*0.5/5=2.5 成员得分如下: 成员 基础分 表现分 个人贡献 ...
- 2-Sixteenth Scrum Meeting-20151216
任务安排 成员 今日完成 明日任务 闫昊 写完学习进度记录的数据库操作 写完学习进度记录的数据库操作 唐彬 编写与服务器交互的代码 编写与服务器交互的代码 史烨轩 获取视频url 余帆 本地 ...
- Daily Scrumming* 2015.12.15(Day 7)
一.团队scrum meeting照片 二.成员工作总结 姓名 任务ID 迁入记录 江昊 任务1036 https://github.com/buaaclubs-team/temp-front/com ...
- 《Linux内核分析》第二周学习小结 操作系统是如何工作的?
郝智宇 无转载 <Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 一.函数调用堆栈: 1.计算机是 ...
- 第一次Sprint冲刺结果评价
组名 软件项目名称 评价 hzsy 图文转换 这款软件最初的目标是扫描书本上文字转换成电子版,而且也可以将语音转换成文字,但在展示时,没有实现完整的功能,只有简单的界面,看不到更深的实质 ...
- RabbitMQ-从基础到实战(3)— 消息的交换(上)
转载请注明出处 0.目录 RabbitMQ-从基础到实战(1)— Hello RabbitMQ RabbitMQ-从基础到实战(2)— 防止消息丢失 RabbitMQ-从基础到实战(4)— 消息的交换 ...
- 【转帖】 redis 命令 From https://www.cnblogs.com/zhouweidong/p/7550717.html
redis命令详解 redis中添加key value元素:set key value; 获取元素:get key ; redis中添加集合:lpush key value1 va ...
- Fantacy团队第一次站立会议
1.队名解释 首先队名Fantacy,并没有任何含义,想取幻想(Fantasy)之名,却并非幻想一词,因为我们组的基础并不好,幻想需要有了坚实的基础才能实现,没有基础等于空想.所以我们组的目的是,提升 ...