pg_put_line如何知道应该将数据插入哪个表?

时间:2014-12-06 22:04:02

标签: php

来自the API

<?php 
  $conn = pg_pconnect("dbname=foo");
  pg_query($conn, "create table bar (a int4, b char(16), d float8)");
  pg_query($conn, "copy bar from stdin");
  pg_put_line($conn, "3\thello world\t4.5\n");
  pg_put_line($conn, "4\tgoodbye world\t7.11\n");
  pg_put_line($conn, "\\.\n");
  pg_end_copy($conn);
?>

如果我有一个关于我想要使用的托马斯架构的表,该怎么办?

1 个答案:

答案 0 :(得分:1)

你告诉它在前一行写的是什么表:

pg_query($conn, "copy bar from stdin");