Пример #1
0
 public static function getAllByTipoYIDCategoria($tipoContenido, $id_categoria)
 {
     /* Collection<Contenido> */
     $contenidos = new ArrayCollection();
     //<Contenido>();
     /* MySQLAccess */
     $mysql = new MySQLAccess();
     try {
         /* java.sql.CallableStatement */
         $cstm = mysql . IniciarStoredProc("{CALL listarcontenidostipocat(?, ?)}");
         $cstm . setString(1, tipoContenido . name());
         $cstm . setInt(2, id_categoria);
         /* ResultSet */
         $rs = $cstm->execute();
         wrapEntidad($rs, $contenidos, $mysql);
         //  			$rs->close();
         $cstm->closeCursor();
         $cstm = null;
     } catch (\PDOException $ex) {
         /*do nothing*/
         print_r($ex->getMessage());
     } finally {
         $mysql->close();
     }
     return $contenidos;
 }
Пример #2
0
function setSql($_str)
{
    if (is_array($_str)) {
        //数组
        foreach ($_str as $_key => $_value) {
            $_string[$_key] = setSql($_value);
        }
    } else {
        if (is_object($_str)) {
            //对象
            foreach ($_str as $_key => $_value) {
                $_string->{$_key} = setSql($_value);
            }
        } else {
            //字符串
            $_string = setString($_str);
        }
    }
    return $_string;
}