<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.pgsql.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'function.pg-put-line.php',
    1 => 'pg_put_line',
    2 => 'Invia una stringa terminata da NULL al backend PostgreSQL',
  ),
  'up' => 
  array (
    0 => 'ref.pgsql.php',
    1 => 'PostgreSQL Funzioni',
  ),
  'prev' => 
  array (
    0 => 'function.pg-prepare.php',
    1 => 'pg_prepare',
  ),
  'next' => 
  array (
    0 => 'function.pg-query.php',
    1 => 'pg_query',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'it',
    'path' => 'reference/pgsql/functions/pg-put-line.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.pg-put-line" class="refentry">
   <div class="refnamediv">
    <h1 class="refname">pg_put_line</h1>
    <p class="verinfo">(PHP 4 &gt;= 4.0.3, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">pg_put_line</span> &mdash; <span class="dc-title">Invia una stringa terminata da NULL al backend PostgreSQL</span></p>

   </div>
   <div class="refsect1 unknown-415" id="refsect1-function.pg-put-line-unknown-415">
    <h3 class="title">Descrizione</h3>
     <div class="methodsynopsis dc-description">
      <span class="methodname"><strong>pg_put_line</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> <code class="parameter">$connessione</code><span class="initializer"> = ?</span></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$dati</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

    <p class="para rdfs-comment">
     <span class="function"><strong>pg_put_line()</strong></span> invia una stringa terminata da NULL
     al backend PostgreSQL. Ciò è utile, per esempio, per 
     l&#039;inserimento ad alta velocità di dati in una tabella, iniziato mediante
     l&#039;invocazione di una operazione di copia. Il carattere NULL finale
     è aggiunto automaticamente. Restituisce <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> in caso di successo, <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> in caso di fallimento.
    </p>
    <blockquote class="note"><p><strong class="note">Nota</strong>: 
     <p class="para"> 
      L&#039;applicazione deve explicitamente inviare i due caratteri &quot;\.&quot;
      sull&#039;ultima riga, ad indicare al backend il termine dell&#039;invio dei
      dati.
     </p>
    </p></blockquote>
    <p class="para">
     Vedere anche <span class="function"><a href="function.pg-end-copy.php" class="function">pg_end_copy()</a></span>.
     <div class="example" id="example-1">
      <p><strong>Example #1 Inserimento ad alta velocità dai dati in una tabella</strong></p>
      <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php <br />    $conn </span><span style="color: #007700">= </span><span style="color: #0000BB">pg_pconnect </span><span style="color: #007700">(</span><span style="color: #DD0000">"dbname=foo"</span><span style="color: #007700">);<br />    </span><span style="color: #0000BB">pg_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">, </span><span style="color: #DD0000">"create table bar (a int4, b char(16), d float8)"</span><span style="color: #007700">);<br />    </span><span style="color: #0000BB">pg_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">, </span><span style="color: #DD0000">"copy bar from stdin"</span><span style="color: #007700">);<br />    </span><span style="color: #0000BB">pg_put_line</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">, </span><span style="color: #DD0000">"3\thello world\t4.5\n"</span><span style="color: #007700">);<br />    </span><span style="color: #0000BB">pg_put_line</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">, </span><span style="color: #DD0000">"4\tgoodbye world\t7.11\n"</span><span style="color: #007700">);<br />    </span><span style="color: #0000BB">pg_put_line</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">, </span><span style="color: #DD0000">"\\.\n"</span><span style="color: #007700">);<br />    </span><span style="color: #0000BB">pg_end_copy</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
      </div>

     </div>
    </p>
   </div>

  </div><?php manual_footer($setup); ?>