Atualizacoes e melhorias na documentacao.
This commit is contained in:
parent
06528494bb
commit
e074166070
23
index.html
23
index.html
@ -71,7 +71,7 @@ programming language
|
||||
LuaSQL is a simple interface from Lua to a DBMS.
|
||||
It enables a Lua program to:
|
||||
<ul>
|
||||
<li> Connect to ODBC, Oracle, MySQL and PostgreSQL databases;
|
||||
<li> Connect to ODBC, Oracle, MySQL, SQLite and PostgreSQL databases;
|
||||
<li> Execute arbitrary SQL statements;
|
||||
<li> Retrieve results in a row-by-row cursor fashion.
|
||||
</ul>
|
||||
@ -92,9 +92,11 @@ and is compatible with PostgreSQL 7.x.
|
||||
The ODBC driver has been tested on Windows
|
||||
(SQLServer and Microsoft Access drivers).
|
||||
The MySQL driver has been tested on Linux
|
||||
and is compatible with version 4.1.
|
||||
and is compatible with versions 4.0 and 4.1.
|
||||
The Oracle driver has been tested on Windows
|
||||
and is compatible with OCI 8 API.
|
||||
The SQLite drivers had been tested on Linux
|
||||
and are compatible with versions 2. and 3 beta.
|
||||
</p>
|
||||
|
||||
|
||||
@ -113,9 +115,13 @@ LuaSQL can be downloaded in source code from the following links: <p>
|
||||
<h2>What's new</h2>
|
||||
<p>
|
||||
<ul>
|
||||
<li>[??/sep/2004] Version 2.0 beta 2 released
|
||||
<li>[10/dec/2003] Version 2.0 beta released
|
||||
</ul>
|
||||
<p>
|
||||
Version 2.0 beta 2 has some bug fixes and the new SQLite drivers.
|
||||
Also, it follows the new 5.1 model for dynamic library loading.
|
||||
<p>
|
||||
Version 2.0 has some design modifications and implementation improvements
|
||||
<ul>
|
||||
<li>New <tt>fetch</tt> method: more eficient and more flexible
|
||||
@ -140,12 +146,14 @@ This library should be linked to the application (the initialization
|
||||
function is <tt>luaopen_luasql_<i>drivername</i></tt> and it is a Lua
|
||||
open-library compatible function)
|
||||
or dynamically loaded.
|
||||
<!--
|
||||
In this case, LuaSQL provide a Lua script template that must be
|
||||
edited to suit the installation: the text <tt>LIB_NAME</tt> (in the line
|
||||
<tt>local libname = "LIB_NAME"</tt>) should be substituted by the
|
||||
complete path of the dynamic library.
|
||||
The distribution contains a Makefile that has lines to do this job,
|
||||
using <tt>sed</tt>, according to each driver and platform.
|
||||
-->
|
||||
|
||||
|
||||
<a name="credits">
|
||||
@ -154,15 +162,18 @@ using <tt>sed</tt>, according to each driver and platform.
|
||||
<h4>LuaSQL 2.0</h4>
|
||||
<p>
|
||||
Version 2.0 was redesigned by Roberto Ierusalimschy, André Carregal
|
||||
and Tomás Guisasola as part of the Kepler Project.
|
||||
and Tomás Guisasola as part of the
|
||||
<a href="http://www.keplerproject.org">Kepler Project</a>.
|
||||
The implementation is compatible with Lua 5.0 and was coded by
|
||||
Tomás Guisasola, Eduardo Quintão and Leonardo Godinho.
|
||||
Tomás Guisasola and Eduardo Quintão,
|
||||
with many invaluable contributions by Michael Roth, Tiago Dionisio,
|
||||
and Leonardo Godinho.
|
||||
|
||||
<h4>LuaSQL 1.0</h4>
|
||||
<p>
|
||||
LuaSQL was designed by Pedro Miller Rabinovitch and Roberto
|
||||
Ierusalimschy.
|
||||
The first implementation was compatible with Lua 4.0a.
|
||||
The first implementation was compatible with Lua 4.0a.
|
||||
Many modifications were made but not distributed by Diego Nehab (ODBC),
|
||||
Carlos Cassino, Tomás Guisasola and Eduardo Quintão (PostgreSQL).
|
||||
<p>
|
||||
@ -196,7 +207,7 @@ Comments are welcome!
|
||||
|
||||
<hr>
|
||||
<small>
|
||||
$Id: index.html,v 1.21 2004/06/08 13:02:12 tomas Exp $
|
||||
$Id: index.html,v 1.22 2004/08/30 15:28:51 tomas Exp $
|
||||
</small>
|
||||
|
||||
</body>
|
||||
|
100
manual.html
100
manual.html
@ -41,8 +41,8 @@ programming language
|
||||
<p>
|
||||
LuaSQL is a simple interface from Lua to a DBMS.
|
||||
It has a collection of drivers to some popular databases
|
||||
(actually PostgreSQL, ODBC, MySQL and Oracle; ADO will be
|
||||
ready soon).
|
||||
(actually PostgreSQL, ODBC, MySQL, SQLite and Oracle;
|
||||
ADO, Interbase and Sybase are on our plans).
|
||||
LuaSQL defines a simple object-oriented API.
|
||||
All drivers should implement this common API,
|
||||
but each one is free to offer extensions.
|
||||
@ -61,6 +61,7 @@ create a
|
||||
<a href="#cursor_object">cursor object</a>
|
||||
which is used to retrieve data.
|
||||
</p>
|
||||
<!--
|
||||
<p>
|
||||
Each LuaSQL driver is composed by two files:
|
||||
a C source file that implements the driver functions;
|
||||
@ -69,6 +70,7 @@ The host application can be statically linked with one or more drivers
|
||||
or they can be loaded dynamically by the corresponding Lua script (this
|
||||
requires the built-in <tt>loadlib</tt> function Lua 5 offers).
|
||||
</p>
|
||||
-->
|
||||
<p>
|
||||
LuaSQL is free software and uses the same
|
||||
<a href="license.html">license</a>
|
||||
@ -76,6 +78,28 @@ as Lua 5.0.
|
||||
</p>
|
||||
|
||||
|
||||
<a name="errors">
|
||||
<h2>Errors</h2>
|
||||
<p>
|
||||
LuaSQL is just an abstraction layer that communicates between Lua
|
||||
and a database system.
|
||||
Therefore errors can occur on both levels, that is,
|
||||
inside the database client or inside LuaSQL driver.
|
||||
<p>
|
||||
Errors like mal-formed SQL statement, unknown table name etc.
|
||||
are called <em>database errors</em> and
|
||||
will be reported by the function/method returning <tt>nil</tt> followed
|
||||
by the error message provided by the database system.
|
||||
Errors like wrong parameters, absent connection, invalid objects etc.,
|
||||
called <em>API errors</em>,
|
||||
are usually program errors hence will raise a Lua error.
|
||||
</p>
|
||||
<p>
|
||||
This behavior will be followed by all functions/methods
|
||||
described in this document unless otherwise stated.
|
||||
</p>
|
||||
|
||||
|
||||
<a name="environment_object">
|
||||
<h2>Environment objects</h2>
|
||||
<p>
|
||||
@ -92,8 +116,8 @@ object using the ODBC driver.
|
||||
<a name="env_close"></a>
|
||||
<li> <b><tt>env:close()</tt></b> <br>
|
||||
Closes the environment <tt>env</tt>.
|
||||
Only successful if all connections pertaining to it were closed first.
|
||||
Returns <code>true</code> in case of success and <code>nil</code> when
|
||||
Only successful if all connections pertaining to it were closed first.<br>
|
||||
Returns: <code>true</code> in case of success; <code>false</code> when
|
||||
the object is already closed.
|
||||
|
||||
<a name="env_connect"></a>
|
||||
@ -121,13 +145,17 @@ method.
|
||||
<a name="conn_close"></a>
|
||||
<li> <b><tt>conn:close()</tt></b> <br>
|
||||
Closes the connection <tt>conn</tt>.
|
||||
Only successful if all cursors pertaining to it were closed first.
|
||||
Returns <code>true</code> in case of success and <code>nil</code> when
|
||||
Only successful if all cursors pertaining to it were closed first.<br>
|
||||
Returns: <code>true</code> in case of success and <code>false</code> when
|
||||
the object is already closed.
|
||||
|
||||
<a name="conn_commit"></a>
|
||||
<li> <b><tt>conn:commit()</tt></b> <br>
|
||||
Commits the current transaction.
|
||||
This feature might not work on database systems that do not implement
|
||||
transactions.<br>
|
||||
Returns: <code>true</code> in case of success and <code>false</code> when
|
||||
the operation could not be performed or when it is not implemented.
|
||||
|
||||
<a name="conn_execute"></a>
|
||||
<li> <b><tt>conn:execute(statement)</tt></b> <br>
|
||||
@ -138,23 +166,21 @@ if there are results, or the number of rows affected by the command otherwise.
|
||||
<a name="conn_rollback"></a>
|
||||
<li> <b><tt>conn:rollback()</tt></b> <br>
|
||||
Rolls back the current transaction.
|
||||
This feature might not work on database systems that do not implement
|
||||
transactions.<br>
|
||||
Returns: <code>true</code> in case of success and <code>false</code> when
|
||||
the operation could not be performed or when it is not implemented.
|
||||
|
||||
<a name="conn_setautocommit"></a>
|
||||
<li> <b><tt>conn:setautocommit(boolean)</tt></b> <br>
|
||||
Turns on or off the "auto commit" mode.
|
||||
This feature might not work on database systems that don't implement
|
||||
This feature might not work on database systems that do not implement
|
||||
transactions.
|
||||
<!--
|
||||
Turning off the "auto commit" mode should begin a new transaction;
|
||||
turning the mode on will roll back the current transaction.
|
||||
-->
|
||||
|
||||
<!--
|
||||
<li> <tt>TableList()</tt> <br>==> So' no ODBC <==
|
||||
Retrieves a list of all the tables in the data source. <br>
|
||||
Returns: a list of the table names.
|
||||
</p>
|
||||
-->
|
||||
On database systems that do not have the concept of "auto commit mode",
|
||||
but do implement transactions, this mechanism is implemented by the driver.
|
||||
<br>
|
||||
Returns: <code>true</code> in case of success and <code>false</code> when
|
||||
the operation could not be performed or when it is not implemented.
|
||||
|
||||
</ul>
|
||||
|
||||
@ -175,8 +201,8 @@ and <a href="#oracle_extensions">Oracle</a> extensions.
|
||||
<ul>
|
||||
<a name="cur_close"></a>
|
||||
<li> <b><tt>cur:close()</tt></b> <br>
|
||||
Closes this cursor.
|
||||
Returns <code>true</code> in case of success and <code>nil</code> when
|
||||
Closes this cursor.<br>
|
||||
Returns: <code>true</code> in case of success and <code>false</code> when
|
||||
the object is already closed.
|
||||
|
||||
<a name="cur_fetch"></a>
|
||||
@ -206,14 +232,15 @@ There is no guarantee about the types of the results
|
||||
the PostgreSQL and MySQL drivers returns all values as strings
|
||||
while the ODBC and Oracle drivers converts them to Lua types</i>.<br>
|
||||
Returns: data, as above, or <tt>nil</tt> if there are no more rows.
|
||||
<em>Note that this method could return <code>nil</code> as a valid result.</em>
|
||||
|
||||
<a name="cur_colnames"></a>
|
||||
<li> <b><tt>cur:getcolnames()</tt></b> <br>
|
||||
Returns: a list of column names.
|
||||
Returns: a list (table) of column names.
|
||||
|
||||
<a name="cur_coltypes"></a>
|
||||
<li> <b><tt>cur:getcoltypes()</tt></b> <br>
|
||||
Returns: a list of column types.
|
||||
Returns: a list (table) of column types.
|
||||
|
||||
</ul>
|
||||
|
||||
@ -235,10 +262,12 @@ these extra features:
|
||||
as stated in the documentation for <tt>PQconnectdb</tt> function
|
||||
in the PostgreSQL manual
|
||||
(e.g. <small><tt>environment:connect("dbname=<<i>name</i>> user=<<i>username</i>>")</tt></small>) <br>
|
||||
See also: <a href="#environment_object">environment objects</a>
|
||||
See also: <a href="#environment_object">environment objects</a><br>
|
||||
Returns: a <a href="#connection_object">connection object</a>
|
||||
|
||||
<li> <b><tt>cur:numrows()</tt></b> <br>
|
||||
This additional method returns the number of rows in the query result.<br>
|
||||
See also: <a href="#cursor_object">cursor objects</a>
|
||||
See also: <a href="#cursor_object">cursor objects</a><br>
|
||||
Returns: the number of rows in the query result.
|
||||
</ul>
|
||||
|
||||
|
||||
@ -253,7 +282,9 @@ the MySQL driver also offers these extra features:
|
||||
<li> <b><tt>env:connect(sourcename[,username[,password[,hostname[,port]]]])</tt></b> <br>
|
||||
In the MySQL driver, this method has two other optional parameters
|
||||
that indicate the hostname and port to connect.
|
||||
See also: <a href="#environment_object">environment objects</a>
|
||||
See also: <a href="#environment_object">environment objects</a><br>
|
||||
Returns: a <a href="#connection_object">connection object</a>
|
||||
|
||||
<!--
|
||||
<li> <b><tt>cur:numrows()</tt></b> <br>
|
||||
This additional method returns the number of rows in the query result.<br>
|
||||
@ -261,11 +292,12 @@ the MySQL driver also offers these extra features:
|
||||
-->
|
||||
</ul>
|
||||
|
||||
Note: This driver is compatible to version 4.1 of MySQL API,
|
||||
with support to BDB and INNODB tables.
|
||||
MySQL has types of tables that don't support transactions,
|
||||
so with these types, the methods <tt>setautocommit</tt>, <tt>commit</tt>
|
||||
and <tt>rollback</tt> don't work.
|
||||
Note: This driver is compatible to version 4.0 and 4.1 (alpha) of MySQL API.
|
||||
Only version 4.1 provides support for transactions by using BDB or INNODB
|
||||
tables.
|
||||
Therefore, with version 4.0 or without one of these types of tables the
|
||||
methods <code>commit</code>, <code>rollback</code> and
|
||||
<code>setautocommit</code> would not work.
|
||||
|
||||
|
||||
<a name="oracle_extensions"></a>
|
||||
@ -277,8 +309,8 @@ this extra feature:
|
||||
|
||||
<ul>
|
||||
<li> <b><tt>cur:numrows()</tt></b> <br>
|
||||
This additional method returns the number of rows in the query result.<br>
|
||||
See also: <a href="#cursor_object">cursor objects</a>
|
||||
See also: <a href="#cursor_object">cursor objects</a><br>
|
||||
Returns: the number of rows in the query result.
|
||||
</ul>
|
||||
|
||||
|
||||
@ -387,7 +419,7 @@ Name: Maria das Dores, E-mail: maria@dores.com
|
||||
|
||||
<hr>
|
||||
<small>
|
||||
$Id: manual.html,v 1.18 2004/01/12 10:43:26 tomas Exp $
|
||||
$Id: manual.html,v 1.19 2004/08/30 15:28:51 tomas Exp $
|
||||
</small>
|
||||
|
||||
</body>
|
||||
|
Loading…
x
Reference in New Issue
Block a user