<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >SQLite</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="Manual do PHP" HREF="index.html"><LINK REL="UP" TITLE="Referência das Funções" HREF="funcref.html"><LINK REL="PREVIOUS" TITLE="spl_object_hash" HREF="function.spl-object-hash.html"><LINK REL="NEXT" TITLE="sqlite_array_query" HREF="function.sqlite-array-query.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="reference" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Manual do PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.spl-object-hash.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.sqlite-array-query.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="reference" ><A NAME="ref.sqlite" ></A ><DIV CLASS="TITLEPAGE" ><H1 CLASS="title" >CLVI. SQLite</H1 ><DIV CLASS="PARTINTRO" ><A NAME="AEN210555" ></A ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="sqlite.intro" >Introdução</A ></H1 ><P > Esta é uma extensão para SQLite Embeddable SQL Database Engine. SQLite é uma biblioteca C que implementa um banco de dados SQL embutido. Programas que usam a biblioteca SQLite podem ter acesso a banco de dados SQL sem executar um processo RDBMS separado. </P ><P > SQLite não é uma biblioteca de cliente usada para conectar com um grande servidor de banco de dados. SQLite é o servidor. A biblioteca SQLite lê e escreve diretamente para e do arquivo do banco de dados no disco. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Nota: </B > Para maiores informações veja o Website do SQLite. (<A HREF="http://sqlite.org/" TARGET="_top" >http://sqlite.org/</A >). </P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="sqlite.install" >Instalação</A ></H1 ><P > Leia o arquivo INSTALL, o qual vem com o pacote. Ou use o instalador PEAR com "pear install sqlite". O SQLite em si esta incluído, você não precisa instalar nenhum programa adicional. </P ><P > Usuários do Windows devem baixar a versão DLL da extensão SQLite aqui: (<A HREF="http://snaps.php.net/win32/PECL_STABLE/php_sqlite.dll" TARGET="_top" >php_sqlite.dll</A >). </P ><P > No PHP 5, a extensão SQLite e a engine são distribuidas juntos e é compilado por padrão. </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="sqlite.requirements" >Dependências</A ></H1 ><P > Para ter estas funções disponíveis, você deve compilar o PHP com suporte ao SQLite, ou carregar a extenção SQLite dinamicamente do seu <TT CLASS="filename" >php.ini</TT >. </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="sqlite.resources" >Tipos Resource</A ></H1 ><P > Exitem dois recursos usados no SQLite. O primeiro é a conexão com o banco de dados e o segundo é o conjunto de resultados. </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="sqlite.constants" >Constantes Pré-definidas</A ></H1 ><P > As funções <A HREF="function.sqlite-fetch-array.html" ><B CLASS="function" >sqlite_fetch_array()</B ></A > e <A HREF="function.sqlite-current.html" ><B CLASS="function" >sqlite_current()</B ></A > usam uma constante para os diferentes tipos de matrizes de resultado: </P ><P > <DIV CLASS="table" ><A NAME="AEN210582" ></A ><P ><B >Tabela 1. Constantes de busca do SQLite</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >constante</TH ><TH >o que faz</TH ></TR ></THEAD ><TBODY ><TR ><TD >SQLITE_ASSOC</TD ><TD > As colunas são retornadas na matriz tendo o nome do campo como índice. </TD ></TR ><TR ><TD >SQLITE_BOTH</TD ><TD > As colunas são retornadas na matriz tendo ambos índices, numérico e o nome do campo. </TD ></TR ><TR ><TD >SQLITE_NUM</TD ><TD > As colunas são retornadas na matriz tendo um índice numérico para os campos. Este índice começa no 0, o primeiro campo no resultado. </TD ></TR ></TBODY ></TABLE ></DIV > </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="sqlite.configuration" >Configurações em execução</A ></H1 ><P > O comportamento dessas funções podem ser modificado pelas configurações do <TT CLASS="filename" >php.ini</TT >. </P ><P > <DIV CLASS="table" ><A NAME="AEN210604" ></A ><P ><B >Tabela 2. Opções de configuração do SQLite</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><COL><THEAD ><TR ><TH >Nome</TH ><TH >Padrão</TH ><TH >Modificavel</TH ></TR ></THEAD ><TBODY ><TR ><TD >sqlite.assoc_case</TD ><TD >0</TD ><TD >PHP_INI_ALL</TD ></TR ></TBODY ></TABLE ></DIV > Para maiores detalhes e definição das constantes PHP_INI_* veja <A HREF="function.ini-set.html" ><B CLASS="function" >ini_set()</B ></A >. </P ><P >Breve descrição das diretivas de configuração.</P ><P > <P ></P ><DIV CLASS="variablelist" ><DL ><DT ><A NAME="ini.sqlite.assoc-case" ></A ><CODE CLASS="parameter" >sqlite.assoc_case</CODE > <A HREF="language.types.integer.html" ><B CLASS="type" >int</B ></A ></DT ><DD ><P > Aonde usar maiúsculas/minúsculas juntas (<TT CLASS="literal" >0</TT >), maiúsculas (<TT CLASS="literal" >1</TT >) ou minúsculas (<TT CLASS="literal" >2</TT >) nos índices. </P ><P > Esta opção é útil principalmente quando você necessita compatibilidade com outros sistemas de banco de dados, aonde os nomes das colunas são sempre retornados como maiúsculas ou minúsculas, sem importar como estão os nomes atualmente no banco de dados. </P ><P > A biblioteca SQLite retorna os nomes das colunas na sua letra atual ( que é o usado ao criar a tabela ). Quando <CODE CLASS="parameter" >sqlite.assoc_case</CODE > for <TT CLASS="literal" >0</TT > a letra atual vai ser preservada. Quando for <TT CLASS="literal" >1</TT > ou <TT CLASS="literal" >2</TT >, o PHP irá converter para maiúsculas ou minúsculas, respectivamente. </P ><P > O uso desta opção incorre em uma pequena penalidade de performance, mas é MUITO mais rápido do que você faze-lo no script PHP. </P ></DD ></DL ></DIV > </P ></DIV ></DIV ><DIV CLASS="TOC" ><DL ><DT ><B >Índice</B ></DT ><DT ><A HREF="function.sqlite-array-query.html" >sqlite_array_query</A > -- Executa uma query ao banco de dados e retorna uma matriz</DT ><DT ><A HREF="function.sqlite-busy-timeout.html" >sqlite_busy_timeout</A > -- Define o tempo de espera quando o banco de dados estiver ocupado</DT ><DT ><A HREF="function.sqlite-changes.html" >sqlite_changes</A > -- Retorna o número de linhas que foram alteradas pela SQL mais recente. </DT ><DT ><A HREF="function.sqlite-close.html" >sqlite_close</A > -- Fecha um banco de dados SQLite que esteja aberto.</DT ><DT ><A HREF="function.sqlite-column.html" >sqlite_column</A > -- Retorna uma coluna da linha atual do conjunto de resultados.</DT ><DT ><A HREF="function.sqlite-create-aggregate.html" >sqlite_create_aggregate</A > -- Registra uma função agregada UDF para usar em SQLs</DT ><DT ><A HREF="function.sqlite-create-function.html" >sqlite_create_function</A > -- Registra uma Função Definida pelo Usuário (UDF) para usar em SQL. </DT ><DT ><A HREF="function.sqlite-current.html" >sqlite_current</A > -- Retorna a linha atual do resultado como uma matriz.</DT ><DT ><A HREF="function.sqlite-error-string.html" >sqlite_error_string</A > -- Retorna a descrição textual de um código de erro</DT ><DT ><A HREF="function.sqlite-escape-string.html" >sqlite_escape_string</A > -- Escapa uma string para ser usada como um parâmetro em uma query</DT ><DT ><A HREF="function.sqlite-exec.html" >sqlite_exec</A > -- Executes a result-less query against a given database</DT ><DT ><A HREF="function.sqlite-factory.html" >sqlite_factory</A > -- Opens a SQLite database and returns a SQLiteDatabase object</DT ><DT ><A HREF="function.sqlite-fetch-all.html" >sqlite_fetch_all</A > -- Fetches all rows from a result set as an array of arrays</DT ><DT ><A HREF="function.sqlite-fetch-array.html" >sqlite_fetch_array</A > -- Obtém a próxima linha de um resultado como uma matriz.</DT ><DT ><A HREF="function.sqlite-fetch-column-types.html" >sqlite_fetch_column_types</A > -- Return an array of column types from a particular table </DT ><DT ><A HREF="function.sqlite-fetch-object.html" >sqlite_fetch_object</A > -- Fetches the next row from a result set as an object</DT ><DT ><A HREF="function.sqlite-fetch-single.html" >sqlite_fetch_single</A > -- Retorna o resultado da primeira coluna como string.</DT ><DT ><A HREF="function.sqlite-fetch-string.html" >sqlite_fetch_string</A > -- Apelido para <A HREF="function.sqlite-fetch-single.html" ><B CLASS="function" >sqlite_fetch_single()</B ></A ></DT ><DT ><A HREF="function.sqlite-field-name.html" >sqlite_field_name</A > -- Retorna o nome de um campo em particular.</DT ><DT ><A HREF="function.sqlite-has-more.html" >sqlite_has_more</A > -- Retorna quando existem ou não mais linhas disponíveis</DT ><DT ><A HREF="function.sqlite-has-prev.html" >sqlite_has_prev</A > -- Returns whether or not a previous row is available</DT ><DT ><A HREF="function.sqlite-key.html" >sqlite_key</A > -- Returns the current row index</DT ><DT ><A HREF="function.sqlite-last-error.html" >sqlite_last_error</A > -- Retorna o código de erro para o último erro em um banco de dados</DT ><DT ><A HREF="function.sqlite-last-insert-rowid.html" >sqlite_last_insert_rowid</A > -- Retorna o rowid da ultima linha inserida.</DT ><DT ><A HREF="function.sqlite-libencoding.html" >sqlite_libencoding</A > -- Retorna a codificação da biblioteca SQLite.</DT ><DT ><A HREF="function.sqlite-libversion.html" >sqlite_libversion</A > -- Retorna a versão da biblioteca SQLite.</DT ><DT ><A HREF="function.sqlite-next.html" >sqlite_next</A > -- Move para a próxima linha.</DT ><DT ><A HREF="function.sqlite-num-fields.html" >sqlite_num_fields</A > -- Retorna o número de campos no conjunto de resultados.</DT ><DT ><A HREF="function.sqlite-num-rows.html" >sqlite_num_rows</A > -- Retorna o número de linhas em um conjunto de resultados.</DT ><DT ><A HREF="function.sqlite-open.html" >sqlite_open</A > -- Abre um banco de dados SQLite. Irá criar o banco de dados se ele não existir</DT ><DT ><A HREF="function.sqlite-popen.html" >sqlite_popen</A > -- Abre uma conexão persistente com um banco de dados SQLite. Irá criar um se ele não existir. </DT ><DT ><A HREF="function.sqlite-prev.html" >sqlite_prev</A > -- Seek to the previous row number of a result set</DT ><DT ><A HREF="function.sqlite-query.html" >sqlite_query</A > -- Executa uma query em um banco de dados e retorna um conjunto de resultados. </DT ><DT ><A HREF="function.sqlite-rewind.html" >sqlite_rewind</A > -- Vai para a primeira linha.</DT ><DT ><A HREF="function.sqlite-seek.html" >sqlite_seek</A > -- Move o ponteiro interno para uma linha em um conjunto de resultados</DT ><DT ><A HREF="function.sqlite-single-query.html" >sqlite_single_query</A > -- Executes a query and returns either an array for one single column or the value of the first row </DT ><DT ><A HREF="function.sqlite-udf-decode-binary.html" >sqlite_udf_decode_binary</A > -- Decodifica dados binários passados como parâmetros para uma UDF.</DT ><DT ><A HREF="function.sqlite-udf-encode-binary.html" >sqlite_udf_encode_binary</A > -- Codifica dados binários para utilizar com uma UDF.</DT ><DT ><A HREF="function.sqlite-unbuffered-query.html" >sqlite_unbuffered_query</A > -- Executa uma query que não guarda em buffer os resultados</DT ><DT ><A HREF="function.sqlite-valid.html" >sqlite_valid</A > -- Returns whether more rows are available</DT ></DL ></DIV ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.spl-object-hash.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Principal</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.sqlite-array-query.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >spl_object_hash</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="funcref.html" ACCESSKEY="U" >Acima</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >sqlite_array_query</TD ></TR ></TABLE ></DIV ></BODY ></HTML >