NAME

SQL.pm - essential DBI wrapper for Zanas. All subs use a unique global database connection.

sql_do

Executes a given SQL (DML) statement with supplied parameters. Returns nothing.

Synopsis

sql_do ('INSERT INTO my_table (id, name) VALUES (?, ?)', $id, $name);

sql_select_all_cnt

Executes a given SQL (SELECT) statement with supplied parameters and returns the resultset (listref of hashrefs) and the number of rows in the corresponding selection without the LIMIT clause.

Synopsis

my ($rows, $cnt)= sql_select_all_cnt (<<EOS, ...);
	SELECT 
		...
	FROM 
		...
	WHERE 
		...
	ORDER BY 
		...
	LIMIT
		$start, 15
EOS

sql_select_all

Executes a given SQL (SELECT) statement with supplied parameters and returns the resultset (listref of hashrefs).

Synopsis

my $rows = sql_select_all_cnt ('SELECT id, name FROM my_table WHERE name LIKE ?', '%');

sql_select_col

Executes a given SQL (one column SELECT) statement with supplied parameters and returns the resultset (listref of hashrefs).

Synopsis

my $rows = sql_select_col ('SELECT name FROM my_table WHERE name LIKE ?', '%');