Précédent   Forum des professionnels en informatique > PHP > Bibliothèques et frameworks
Bibliothèques et frameworks Forum d'entraide sur les frameworks, templates, bibliothèques de code (PDFLib, eZPdf, JpGraph, Artichow, PEAR, etc). Avant de poster : FAQ bibliothèques, toutes les FAQ PHP et cours bibliothèques
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 13/10/2006, 10h24   #1
Membre habitué
 
Avatar de Tchinkatchuk
 
Homme Sylvain Gourvil
Freelance en développement Web
Inscription : mars 2005
Messages : 248
Détails du profil
Informations personnelles :
Nom : Homme Sylvain Gourvil
Localisation : France, Paris (Île de France)

Informations professionnelles :
Activité : Freelance en développement Web
Secteur : High Tech - Multimédia et Internet

Informations forums :
Inscription : mars 2005
Messages : 248
Points : 141
Points : 141
Par défaut SQL Relay : Procédures stockées avec curseur en return

Bonjour a tous !!

J'ai un problème avec sql Relay et je commence franchement a désespérer.
J'utilise une procédure stockée qui me retourne un curseur.

J'ai testé cette procédure avec oci et cela marche a merveille, je retourve mon resultat de requete et je peux le parcourir.

Mais avec sqlRelay, en utilisant l'exemple de la Doc Sourceforge, je récupère a priori un curseur mais je ne peux accéder à rien.

Code :
1
2
3
4
5
6
7
8
9
10
11
12
 
$con=sqlrcon_alloc("hosr,"","sqltest","relay",0,1);
$cur=sqlrcur_alloc($con);
sqlrcur_prepareQuery($cur,"begin PROCEDURES_PCK.P_GET_ARTICLELIBELLE_BY_REF(:refcentrale, :curseur); end;"); 
sqlrcur_inputBind($cur,"refcentrale","P8297734");
sqlrcur_defineOutputBindCursor($cur,"curseur");
sqlrcur_executeQuery($cur); $bindcur=sqlrcur_getOutputBindCursor($cur,"curseur");
sqlrcur_fetchFromBindCursor($bindcur);
var_dump($bindcur); // M'INDIQUE esource(25) of type (sqlrelay cursor) 
var_export(sqlrcur_rowCount($bindcur)); // => 0
var_export(sqlrcur_totalRows($bindcur)); // => 0
var_export(sqlrcur_colCount($bindcur)); //=> 0
PS : je précise que la procédure me retourne des résultats sous oci.

Merci d'avance si quelqu'un peut m'aider.

Bye
Tchinkatchuk est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 19/10/2006, 01h19   #2
Rédacteur
 
Avatar de Yogui
 
Homme Guillaume Rossolini
Directeur technique
Inscription : février 2004
Messages : 13 720
Détails du profil
Informations personnelles :
Nom : Homme Guillaume Rossolini
Localisation : France

Informations professionnelles :
Activité : Directeur technique

Informations forums :
Inscription : février 2004
Messages : 13 720
Points : 17 355
Points : 17 355
Salut

Utilise PDO ?

Sérieusement, je suis désolé de ne pouvoir t'être d'une grande aide. Jamais utilisé SQL Relay, jamais eu besoin.
__________________
Mes articles - Zend Certified Engineer (PHP + Zend Framework)
Ressources PHP - Ressources Zend Framework
Yogui est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 19/10/2006, 09h59   #3
Membre habitué
 
Avatar de Tchinkatchuk
 
Homme Sylvain Gourvil
Freelance en développement Web
Inscription : mars 2005
Messages : 248
Détails du profil
Informations personnelles :
Nom : Homme Sylvain Gourvil
Localisation : France, Paris (Île de France)

Informations professionnelles :
Activité : Freelance en développement Web
Secteur : High Tech - Multimédia et Internet

Informations forums :
Inscription : mars 2005
Messages : 248
Points : 141
Points : 141
Oh, mince, j'avais oublié de signaler que j'avais résolu le problème.

Je ne sais plus ce qu'il manquait mais ce qui suit fonctionne avec SQL Relay.
Ca permettra au prochain de ne pas trop galérer.



Creation de la procédure stockée avec package
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 
CREATE OR REPLACE package PROCEDURES_PCK as
type sample_record is RECORD (LIBELLE VARCHAR2(765), LANGUE CHAR(6));
type C_ARTICLE_LIBELLE_TYPE is ref cursor return sample_record;
procedure P_GET_ARTICLELIBELLE_BY_REF(C_REF in ARTICLELIBELLE.REFCENTRALE%type,
C_ARTICLE_LIBELLE out C_ARTICLE_LIBELLE_TYPE); 
end;
/ 
 
CREATE OR REPLACE package body PROCEDURES_PCK as
procedure P_GET_ARTICLELIBELLE_BY_REF(C_REF in ARTICLELIBELLE.REFCENTRALE%type,
C_ARTICLE_LIBELLE out C_ARTICLE_LIBELLE_TYPE)
is
begin
open C_ARTICLE_LIBELLE for select LIBELLE, LANGUE from ARTICLELIBELLE where refcentrale=C_REF order by LIBELLE,LANGUE ASC;
end P_GET_ARTICLELIBELLE_BY_REF;
end;
/
Et voici l'appel avec SQL Relay
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
 
          $con=sqlrcon_alloc("host",port,"","sqltest","relay",0,1);
          $cur=sqlrcur_alloc($con);
          $query = "begin PROCEDURES_PCK.P_GET_ARTICLELIBELLE_BY_REF(:refcentrale, :curseur); end;";
          sqlrcur_prepareQuery($cur,$query);
          sqlrcur_inputBind($cur,"refcentrale","P8297734");
          sqlrcur_defineOutputBindCursor($cur,"curseur");
 
          sqlrcur_executeQuery($cur);
 
          $bindcur = sqlrcur_getOutputBindCursor($cur,"curseur");
 
          sqlrcur_fetchFromBindCursor($bindcur);
Tchinkatchuk est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 19/10/2006, 17h21   #4
Rédacteur
 
Avatar de Yogui
 
Homme Guillaume Rossolini
Directeur technique
Inscription : février 2004
Messages : 13 720
Détails du profil
Informations personnelles :
Nom : Homme Guillaume Rossolini
Localisation : France

Informations professionnelles :
Activité : Directeur technique

Informations forums :
Inscription : février 2004
Messages : 13 720
Points : 17 355
Points : 17 355
__________________
Mes articles - Zend Certified Engineer (PHP + Zend Framework)
Ressources PHP - Ressources Zend Framework
Yogui est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 06h28.


 
 
 
 
Partenaires

Hébergement Web