svnno****@sourc*****
svnno****@sourc*****
2008年 6月 27日 (金) 14:08:16 JST
Revision: 162 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=tritonn&view=rev&rev=162 Author: mir Date: 2008-06-27 14:08:16 +0900 (Fri, 27 Jun 2008) Log Message: ----------- ha_tritonn::rnd_next returns table scan Modified Paths: -------------- trunk/src/ha_tritonn.cc -------------- next part -------------- Modified: trunk/src/ha_tritonn.cc =================================================================== --- trunk/src/ha_tritonn.cc 2008-06-27 03:32:53 UTC (rev 161) +++ trunk/src/ha_tritonn.cc 2008-06-27 05:08:16 UTC (rev 162) @@ -40,7 +40,7 @@ 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, bool disp=true); +static void call_senna_ql(sen_ctx *ctx, const char *str, bool disp=false); static char *mysqltype2sennatype_string(enum_field_types types); @@ -318,17 +318,37 @@ unsigned int res_len; int res_flags; char *row; - *(buf) &= ~0x1; - *(buf) &= ~0x2; sen_ctx_recv(ctx,&res,&res_len,&res_flags); if (res_flags & SEN_CTX_MORE) { - row = (char*) calloc(1,1024); - printf("[SennaQL] returned row => %s\n",strncat(row,res,res_len)); - free(row); + char token[1024]; + int offset=0; + int i; for (Field **field=table->field; *field ; field++) { - (*field)->store("dummy",5,system_charset_info); - printf("hoge\n"); + for (i=0; offset < res_len && *(res+offset) != '\t'; offset++,i++) { + token[i] = *(res+offset); + } + offset++; + switch((*field)->result_type()) { + case STRING_RESULT: + (*field)->store(token,i,system_charset_info); + break; + case REAL_RESULT: + token[i] = '\0'; + (*field)->store(atof(token)); + break; + case INT_RESULT: + token[i] = '\0'; + (*field)->store(atoi(token),false); + break; + case ROW_RESULT: + (*field)->store("row_result",10,system_charset_info); + break; + case DECIMAL_RESULT: + (*field)->store("decimal",7,system_charset_info); + break; + } } + memset(buf, 0, table->s->null_bytes); DBUG_RETURN(0); } else { DBUG_RETURN(HA_ERR_END_OF_FILE); @@ -367,7 +387,7 @@ } *(res2+res_len) = '\0'; stats.records=atoi(res2); - printf("[SennaQL] returned nrecords = %d\n",stats.records); + // printf("[SennaQL] returned nrecords = %d\n",stats.records); DBUG_RETURN(0); }