utyDb Interface Reference
[Database common API]

Data Access interface. More...

Inheritance diagram for utyDb:
utyDbMySql utyDbSqlite

List of all members.

Public Member Functions

 open ($server, $dbname, $username, $password, $options=NULL)
 close ()
 escape ($text)
 query ($sql, &$result)
 exec ($sql)
 fetch ($result)
 insertID ()
 queryCount ($result)
 execCount ()

Detailed Description

Data Access interface.


Member Function Documentation

close (  ) 

Close the connection (if opened)

Implemented in utyDbMySql, and utyDbSqlite.

escape ( text  ) 
Returns:
db specific escaped sql value

Implemented in utyDbMySql, and utyDbSqlite.

exec ( sql  ) 

Exec the sql statement (INSERT,UPDATE,DELETE, etc) to the connected database.

Parameters:
sql (string) the sql statement
Returns:
NULL if OK, utyResult if ERROR

NOTABENE: use escape for data values

See also:
use execCount() to retrieve the number of rows affected

Implemented in utyDbMySql, and utyDbSqlite.

execCount (  ) 
Returns:
the number of rows affected by the last executed sql statement (INSERT,UPDATE,DELETE, etc)

Implemented in utyDbMySql, and utyDbSqlite.

fetch ( result  ) 

Fetches the result of a query.

Returns:
the next row in the result or FALSE if at the end.
See also:
use queryCount() to retrieve the number of rows selected

Implemented in utyDbMySql, and utyDbSqlite.

insertID (  ) 
Returns:
the ID of the last executed INSERT when the table has an autoincremented primary key field

Implemented in utyDbMySql, and utyDbSqlite.

open ( server,
dbname,
username,
password,
options = NULL 
)

Opens the connection to the database.

Parameters:
server (string) hostname_or_ip:port of the server
dbname (string) the database to select
username (string) username
password (string) password
[options] (array) database specific options
Returns:
NULL if OK, utyResult if ERROR

NOTABENE: implementors showuld use the @ silent operator to avoid unwanted sensitive data logging

Implemented in utyDbMySql, and utyDbSqlite.

query ( sql,
&$  result 
)

Query the sql SELECT statement to the connected database.

Parameters:
sql (string) the sql SELECT statement
$result (resource) pointer to an empty resource (any declared variable). Will be set to the query output.
Returns:
NULL if OK, utyResult if ERROR

NOTABENE: use escape for data values

See also:
use queryCount() to retrieve the number of rows selected

Implemented in utyDbMySql, and utyDbSqlite.

queryCount ( result  ) 
Returns:
the number of rows in result

Implemented in utyDbMySql, and utyDbSqlite.


The documentation for this interface was generated from the following file:
 All Classes Files Functions Variables Enumerations

Copyright © 2010 Attilio Pavone - www.utillyty.eu