prepareFunction

Convenience function to create a prepared statement which calls a stored function.

Be careful that your numArgs is correct. If it isn't, you may get a mysql.exceptions.MYX with a very unclear error message.

prepareFunction

Parameters

name string

The name of the stored function.

numArgs int

The number of arguments the stored procedure takes.

Throws

mysql.exceptions.MYX if the server has a problem.

Examples

t
{
	debug(MYSQLN_TESTS)
	{
		import mysql.test.common;
		mixin(scopedCn);

		exec(cn, `DROP FUNCTION IF EXISTS hello`);
		exec(cn, `
			CREATE FUNCTION hello (s CHAR(20))
			RETURNS CHAR(50) DETERMINISTIC
			RETURN CONCAT('Hello ',s,'!')
		`);

		auto preparedHello = prepareFunction(cn, "hello", 1);
		preparedHello.setArgs("World");
		auto rs = cn.query(preparedHello).array;
		assert(rs.length == 1);
		assert(rs[0][0] == "Hello World!");

Meta