yaccとは何か

"Yet Another Compiler Compiler". 

http://www.tokumaru.org/yacc/index.htm

どこかで似たようなフレーズを聞いたことがある(mecab)とおもったらこちらが元祖なのね。"Yet Another"って響きがカコイイ。

MySQLではyacc互換ソフトのひとつ、GNU Bisonを使用しているっぽい。

http://www.tokumaru.org/yacc/bison.htm

で、Windowsソース配布版には、sql_yacc.yyが無く、sql_yacc.cppしかない。Linuxソース配布版にはsql_yacc.yyが入っている。

起動シーケンスからCOM_QUERYパケットの処理を追いかけていくと、mysql_parseとかmysql_execute_commandらへんに到達した頃にこいつに寸断される。くそ〜。むずいw

なんでmysql_selectの中でJOINオブジェクトかならず使うのー?

メモ〜

これもメモって置こう。

typedef	struct dulint_struct	dulint;
struct dulint_struct{
	ulint	high;	/* most significant 32 bits */
	ulint	low;	/* least significant 32 bits */
};

こんな感じのユーティリティ関数があったり。

ulint
ut_dulint_get_high(
/*===============*/
			/* out: 32 bits in ulint */
	dulint	d)	/* in: dulint */
{
	return(d.high);
}

でもって、こういうのとか

void 
mach_write_to_8(
/*============*/
	byte*   b,      /* in: pointer to 8 bytes where to store */
	dulint	n)      /* in: dulint integer to be stored */ 
{
	ut_ad(b);

	mach_write_to_4(b, ut_dulint_get_high(n));
	mach_write_to_4(b + 4, ut_dulint_get_low(n));
}

こういうのを使って書き込み。

void 
mach_write_to_2(
/*============*/
	byte*   b,      /* in: pointer to two bytes where to store */
	ulint	n)      /* in: ulint integer to be stored */ 
{
	b[0] = (byte)(n >> 8);
	b[1] = (byte)(n);
}

mach_write_to_1〜8まで。これと対になるmach_read_from_1〜8もあり。

おまけ。

#define byte			unsigned char
typedef unsigned long int	ulint;