node-mysqlã§TEXTå使ã£ã¦ããæååããã
node-mysqlã®0.9.6ã使ã£ã¦ããããTEXTåã®ã«ã©ã ã®ãã¼ã¿ãæã
æååãããç¾è±¡ã«åºããããã
node-mysqlã¯JavaScriptã ãã§å
¨é¨ã§ãã¦ãã®ã§ãã½ã¼ã¹ã追ã£ã¦èª¿ã¹ã¦ã¿ãã
調æ»
mysql/lib/query.jsã«
row[field.name] += buffer.toString('utf-8');
ã¨ãªã£ã¦ãã¦ãBufferãUTF-8ã®æååã«ãã¦ããé£çµãã¦ããé¨åãçºè¦ããããæªããã
対å¿
Bufferããã£ããä¿æãã¦ããã¦ãæçµçã«é£çµãã¦æåååããããã«å¤æ´ãã¦ã¿ãã
以ä¸ãå·®åã
5a6,19 > function joinBuffers(buffers) { > var i, len = buffers.length, size = 0; > for (i = 0; i < len; i++) { > size += buffers[i].length; > } > var result = new Buffer(size); > var buffer, from = 0; > while (buffer = buffers.shift()) { > buffer.copy(result, from, 0); > from += buffer.length; > } > return result; > } > 62c76 < row[field.name] = ''; --- > row[field.name] = []; 66,68c80 < row[field.name] += buffer.toString('utf-8'); < } else { < row[field.name] = null; --- > row[field.name].push(buffer); 72a85,90 > } > > if (row[field.name].length > 0) { > row[field.name] = joinBuffers(row[field.name]).toString('utf-8'); > } else { > row[field.name] = null;
çµæ
解決ããã£ã½ããæååãããªããªã£ãã
githubã§forkãã¦ä¿®æ£ãpull requestæãã¦ã¿ãããã¨æã£ããã©ã
ãªããéçºé²ãã§ã ãã¶æ§å¤ãããã¦ãã¿ãããªã®ã§ããã£ã¨ãã©ã¦ã¶ãéããã