Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/273.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 将17000行.csv文件插入数据库并比较_Php_Sql_Firebird - Fatal编程技术网

Php 将17000行.csv文件插入数据库并比较

Php 将17000行.csv文件插入数据库并比较,php,sql,firebird,Php,Sql,Firebird,我有一个分号,以.csv分隔,有17000行,如下所示 SETCODE;NAME; T; F THS;Cutthroat Maneuver;50226;50227 THS;Dark Betrayal;50622;50623 THS;Disciple of Phenax;50466;50467 THS;Erebos, God of the Dead;50308;50309 THS;Erebos's Emissary;50474;50475 THS;Felhide

我有一个分号,以.csv分隔,有17000行,如下所示

SETCODE;NAME;          T;    F

THS;Cutthroat Maneuver;50226;50227

THS;Dark Betrayal;50622;50623

THS;Disciple of Phenax;50466;50467

THS;Erebos, God of the Dead;50308;50309

THS;Erebos's Emissary;50474;50475

THS;Felhide Minotaur;50332;50333

THS;Fleshmad Steed;50328;50329
在firebird数据库中,我需要根据行中的正确或错误语句插入50226或50227

我可以比较名字;设置码;列和名为premium的列,其中值为true或false

我没有php技能,我想知道什么是最佳实践

所以我需要一些自动化

update CARDS a

set a.CARDCATID='50226'

where a.name='Cutthroat Maneuver' and a.PREMIUM='F' and a.SETCODE='THS'

or when 

set a.CARDCATID='50227'

where a.name='Cutthroat Maneuver' and a.PREMIUM='T' and a.SETCODE='THS'
乘以17000

非常感谢您的帮助

对于我来说,在flamerobin中这样做的最佳实践是什么


哎呀,我忘记了一个代码标记,以后不会再发生了^ ^

如果您使用IBExpert而不是Flamerobin,您可以使用工具“导入数据”将csv数据导入到临时表中,然后使用for select循环编写一个简单的过程,并在这个临时表中的行上迭代。

您需要使用参数化查询(又称准备好的声明)。