I'm using this query in a query in php:
我在php查询中使用这个查询:
$query = "UPDATE viajens SET tipo_operacao = $tipo_operacao,
percurso = $percurso,
tipo_cliente = $tipo_cliente,
previsao_inicio = '$previsao_inicio',
previsao_fim = '$previsao_fim',
quilometragem_estimada = '$km_estimada',
origem_empresa_id = $origem,
transportador_empresa_id = $transportador,
motorista_id = $motorista,
veiculo_id = $veiculo1,
reboque1_veiculo_id = $veiculo2,
reboque2_veiculo_id = $veiculo3,
reboque3_veiculo_id = $veiculo4
WHERE id_viajem = $id_viajem;";
Parsed view:
解析视图:
$query = "UPDATE viajens SET tipo_operacao = $tipo_operacao, percurso = $percurso, tipo_cliente = $tipo_cliente, previsao_inicio = '$previsao_inicio', previsao_fim = '$previsao_fim', quilometragem_estimada = '$km_estimada', origem_empresa_id = $origem, transportador_empresa_id = $transportador, motorista_id = $motorista, veiculo_id = $veiculo1, reboque1_veiculo_id = $veiculo2, reboque2_veiculo_id = $veiculo3, reboque3_veiculo_id = $veiculo4 WHERE id_viajem = $id_viajem;";
Doing this, MySQL will be process this query more slower than without use this spaces?
这么做,MySQL处理这个查询的速度会比不使用这个空格慢吗?
Thanks!
谢谢!
2 个解决方案
#1
3
Yes, spaces are fine, so stick with what you have if you find it more readable. Stripping out spaces is not something computers have any trouble doing.
是的,空格是可以的,所以如果你觉得它更容易读,那就坚持使用你的空格。剥离空间并不是计算机所做的任何困难。
#2
0
There isn't problem with spaces, remember, SQL like others languages, before executing the code, it's parsed to construct AST(abstract syntax tree derived from your code) ignoring comments and spaces.
在执行代码之前,不需要使用空格、记住、SQL和其他语言一样,它将解析为构建AST(从代码中派生出来的抽象语法树),忽略注释和空格。
btw, AST contains only necesary information to execute code.
顺便说一句,AST只包含执行代码所需的信息。
#1
3
Yes, spaces are fine, so stick with what you have if you find it more readable. Stripping out spaces is not something computers have any trouble doing.
是的,空格是可以的,所以如果你觉得它更容易读,那就坚持使用你的空格。剥离空间并不是计算机所做的任何困难。
#2
0
There isn't problem with spaces, remember, SQL like others languages, before executing the code, it's parsed to construct AST(abstract syntax tree derived from your code) ignoring comments and spaces.
在执行代码之前,不需要使用空格、记住、SQL和其他语言一样,它将解析为构建AST(从代码中派生出来的抽象语法树),忽略注释和空格。
btw, AST contains only necesary information to execute code.
顺便说一句,AST只包含执行代码所需的信息。