Azure ML支持告诉我,分隔符必须是逗号,这会导致数据以分号作为分隔符并且单元格值中包含大量逗号的数据会造成太多麻烦.
那么如何在Azure ML中处理以分号分隔的CSV文件?
csv escaping azure escapestring azure-machine-learning-studio
我正在尝试如何最好地在PHP中准备我的SQLite SQL字符串.SQLite3类附带了一个escapeString()函数,但这是我的问题:
尝试1)
$sql = "INSERT INTO items ('id','content','title','created') VALUES ('4e7ce7c18aac8', 'Does this work', NULL, '2011-09-23T16:10:41-04:00');";
$sql = SQLite3::escapeString( $sql );
echo ($sql);
Run Code Online (Sandbox Code Playgroud)
这导致一个字符串全部被抬起:
INSERT INTO项目(''id'',''content'',''title'',''created'')VALUES('''4e7ce7c18aac8'',''这是否有效'',NULL,''2011- 09-23T16:10:41-04:00 '');
这些不是双引号,而是双引号单引号.显然不行.
尝试2)
$sql = 'INSERT INTO items ("id","content","title","created") VALUES ("4e7ce7c18aac8", "Does this work", NULL, "2011-09-23T16:10:41-04:00");';
$sql = SQLite3::escapeString( $sql );
echo ($sql);
Run Code Online (Sandbox Code Playgroud)
这导致:
INSERT INTO项目("id","content","title","created")VALUES("4e7ce7c18aac8","这是否有效",NULL,"2011-09-23T16:10:41-04:00") ;
这个查询工作正常,但是escapeString函数没有修改任何东西,因为没有什么可以逃脱的......
尝试3)
$sql = 'INSERT INTO items ("id","content","title","created") VALUES ("4e7ce7c18aac8", "Doesn't this work", NULL, "2011-09-23T16:10:41-04:00");'; $sql = SQLite3::escapeString( $sql ); echo ($sql);
Run Code Online (Sandbox Code Playgroud)
这是一个大问题 - …
我刚刚开始使用活动记录(之前我只是编写手动查询,因为我已经习惯了它们).
我正在查看ion_auth的代码,我发现即使使用了活动记录,在某些地方字符串也已被转义,
即
->where($this->identity_column, $this->db->escape_str($identity))
->where($this->tables['groups'].'.name', $this->db->escape_str($group))
Run Code Online (Sandbox Code Playgroud)
事实是,我没有逃过任何我使用过活动记录的地方,因为在文档上它表示活动记录会自动转义字符串.
我的问题,当使用活动记录时,是否存在一些应该转义字符串的情况?
index.php文件:
<? session_start(); ini_set( "display_errors", 0); ?>
.. rest of the page ...
Run Code Online (Sandbox Code Playgroud)
错误:
Fatal error: Call to undefined function: escapestring() in ... ReviewOrder.php on line 54
Run Code Online (Sandbox Code Playgroud)
ReviewOrder.php上的第54行是:
foreach ($_REQUEST as $key => $value)
{
if ($value!="") $_SESSION[$key]=escapestring(trim($value)); // line 54
}
Run Code Online (Sandbox Code Playgroud) escapestring ×4
escaping ×2
php ×2
activerecord ×1
azure ×1
azure-machine-learning-studio ×1
codeigniter ×1
csv ×1
sql ×1
sqlite ×1