svnno****@sourc*****
svnno****@sourc*****
2008年 6月 18日 (水) 17:49:59 JST
Revision: 153 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=tritonn&view=rev&rev=153 Author: mir Date: 2008-06-18 17:49:59 +0900 (Wed, 18 Jun 2008) Log Message: ----------- call_senna_ql appeared Modified Paths: -------------- trunk/src/ha_tritonn.cc -------------- next part -------------- Modified: trunk/src/ha_tritonn.cc =================================================================== --- trunk/src/ha_tritonn.cc 2008-06-18 08:31:23 UTC (rev 152) +++ trunk/src/ha_tritonn.cc 2008-06-18 08:49:59 UTC (rev 153) @@ -37,6 +37,8 @@ static void dump_create(const char *name, TABLE *table_arg, HA_CREATE_INFO *create_info); +static void call_senna_ql(sen_ctx *ctx, const char *str); + /* handlerton capability flags. see handler.h for more information */ static int tritonn_hton_flags = HTON_ALTER_NOT_SUPPORTED | HTON_CAN_RECREATE | HTON_TEMPORARY_NOT_SUPPORTED | HTON_NO_PARTITION; @@ -341,6 +343,9 @@ } ctx = sen_ctx_open(db,SEN_CTX_USEQL); + my_snprintf(buf,200,"(ptable '<%s>)",table_arg->s->table_name); + call_senna_ql(ctx,buf); + sen_ctx_close(ctx); DBUG_RETURN(0); } @@ -502,3 +507,23 @@ } } } + +void call_senna_ql(sen_ctx *ctx, const char *str) +{ + char *ql; + char *res; + unsigned int res_len; + int res_flags; + char *buf; + unsigned int ql_len = strlen(str); + ql = (char*) malloc(ql_len); + strncpy(ql,str,ql_len); + sen_ctx_send(ctx,ql,ql_len,0); + do { + sen_ctx_recv(ctx,&res,&res_len,&res_flags); + buf = (char*) calloc(1,1024); + printf("[SennaQL] %s => %s\n",str,strncat(buf,res,res_len)); + free(buf); + } while (res_flags & SEN_CTX_MORE); + free(ql); +}