Blog d'un développeur multi-support

[DIM] pour les intimes :)

Utiliser une procédure stocké mysql avec Zend !

Dans un article précédent, je créais la « import », voilà comment je l’utilise dans Zend.

Je n’invente rien, j’ai trouvé la manip sur http://www.ericmery.fr/blog/zend_db-sql-server-procedure-stockee.

1
2
3
4
5
6
7
8
9
10
$registry = Zend_Registry::getInstance();
$config = $registry->get("config");
 
$db = Zend_Db::factory($config->db);
 
$stmt = $db->prepare("call import(?,?,?);");
$stmt->bindParam(1, $param1, PDO::PARAM_STR,1000);
$stmt->;bindParam(2, $param2, PDO::PARAM_STR, 255);
$stmt->bindParam(3, $param3, PDO::PARAM_STR, 255);
$res = $stmt->execute();

Magie, c’est la même chose. On remercie PDO et son abstracteur de base de donnée utilisé !

Tags : , , , ,