IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Visual C++ Discussion :

Une requête qui ne donne pas le résultat attendu


Sujet :

Visual C++

  1. #1
    Débutant
    Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2008
    Messages
    1 022
    Détails du profil
    Informations personnelles :
    Localisation : France, Mayenne (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Décembre 2008
    Messages : 1 022
    Points : 332
    Points
    332
    Par défaut Une requête qui ne donne pas le résultat attendu
    Bonjour,
    Je porte du code qui marchait sous Java pour l'exécuter sous C++ VisualStudio.
    J'ai une requête qui marche sous interpréteur sql et qui renvoi des données incohérentes sous VisualStudio qui marche avec IBPP.
    Je vous donne d'abord la requête; puis le résultat de la requête sous l’interpréteur sql; puis le code qui s'exécute.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    SELECT ES.nuIdElemn, ES.nuIdTypeElement, ES.nuIdOccurence, ES.wsText, ES.vcName, ES.nuidpar, ES.siNbChunk, ES.siIdD, EC.nuIdChunk, C.nuIdChunkType, C.siNbWord, C.nuIdDrivingPos, W.nuIdWord, W.vcString, W.siIdPOS, L.cExcluded, L.siIdPOS FROM T_ELEMENT_SEMANTIQUE ES LEFT JOIN T_ELEMENT_CHK EC ON ES.nuIdElemn = EC.nuIdElemn LEFT JOIN T_CHUNK C ON EC.nuIdChunk = C.nuIdChunk LEFT JOIN T_CHUNK_WORD CW ON C.nuIdChunk = CW.nuIdChunk LEFT JOIN T_WORD W ON CW.nuIdWord = W.nuIdWord LEFT JOIN T_LEMMA L ON W.nuIdLemma = L.nuIdLemma AND W.siIdPOS = L.siIdPOS WHERE ES.siIdD = 1 ORDER BY ES.nuIdOccurence DESC, ES.vcName, ES.nuIdElemn, EC.siChkRank, CW.siWordRank
    le résultant de la requête par l'isql:
    Je ne sais pas insérer une image faite à partir d'une capture d'écran. pouvez vous me dire comment faire?
    le code qui est en cause
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
     
    try
          { // 1
    			ErrorCode = 0;
    			pListSemanticElement = new std::list<ElementSemantic*>();
    			wssRequest << "SELECT "
    			<< "ES.nuIdElemn, ES.nuIdTypeElement, ES.nuIdOccurence, ES.wsText, ES.vcName, ES.nuidpar, ES.siNbChunk, ES.siIdD, EC.nuIdChunk, C.nuIdChunkType, C.siNbWord, C.nuIdDrivingPos, W.nuIdWord, W.vcString, W.siIdPOS, L.cExcluded, L.siIdPOS"
    			<< " FROM"
    			<< " T_ELEMENT_SEMANTIQUE ES"
    			<< " LEFT JOIN T_ELEMENT_CHK EC ON ES.nuIdElemn = EC.nuIdElemn"
    			<< " LEFT JOIN T_CHUNK C ON EC.nuIdChunk = C.nuIdChunk"
    			<< " LEFT JOIN T_CHUNK_WORD CW ON C.nuIdChunk = CW.nuIdChunk"
    			<< " LEFT JOIN T_WORD W ON CW.nuIdWord = W.nuIdWord"
    			<< " LEFT JOIN T_LEMMA L ON W.nuIdLemma = L.nuIdLemma"
    			<< " AND W.siIdPOS = L.siIdPOS"
    			<< " WHERE ES.siIdD = " << iIdDoc
    			<< " ORDER BY ES.nuIdOccurence DESC, ES.vcName, ES.nuIdElemn, EC.siChkRank, CW.siWordRank";
    			dwNbResultFound = 0;
    			ErrorCode |= objInterbaseManager.ExecuteSelectRequest(wssRequest.str(), &dwNbResultFound);
    			if( dwNbResultFound == 0)
    			{ // 2
    			   return( pListSemanticElement);
    			} // 2
    			iSize = 0;
     		    ErrorCode |= objInterbaseManager.First();
    		    while( bEndReached != true && ErrorCode  == INIT_NO_ERROR && iSize < dwNbResultFound)
    		    { // 2
    			    pelementSemantic = new ElementSemantic();
    				elementSemantic = *pelementSemantic;
    				pUnivers = new stUnivers();
    				elementSemantic.Univers = *pUnivers;
    				ErrorCode |= objInterbaseManager.GetWideString(4, wsTemp);
    				elementSemantic.wsText = wsTemp;
    				ErrorCode |= objInterbaseManager.GetWideString(5, wsTemp);
                    std::wstring wsUnivers = wsTemp;
    				ErrorCode |= objInterbaseManager.GetWideString(13, wsTemp);
    				elementSemantic.wsWord = wsTemp;
    				ErrorCode |= objInterbaseManager.GetHidDB(0, (int64_t&)elementSemantic.nuIdElemn);
    				ErrorCode |= objInterbaseManager.GetHidDB(1, (int64_t&)elementSemantic.nuIdTypeElement);
    				ErrorCode |= objInterbaseManager.GetHidDB(2, (int64_t&)elementSemantic.siIdOccurence);
    				ErrorCode |= objInterbaseManager.GetHidDB(6, (int64_t&)idParagraph);
    				ErrorCode |= objInterbaseManager.GetHidDB(7, (int64_t&) elementSemantic.siNbChunk);
    				ErrorCode |= objInterbaseManager.GetHidDB(8, (int64_t&) elementSemantic.iIdDoc);
    				ErrorCode |= objInterbaseManager.GetHidDB(9, (int64_t&) elementSemantic.nuIdChunk);
    				ErrorCode |= objInterbaseManager.GetHidDB(10, (int64_t&) elementSemantic.nuIdChunkType);
    				ErrorCode |= objInterbaseManager.GetHidDB(11, (int64_t&) elementSemantic.siNbWord);
    				ErrorCode |= objInterbaseManager.GetHidDB(12, (int64_t&) elementSemantic.nuIdDrivingPos);
    				ErrorCode |= objInterbaseManager.GetHidDB(14, (int64_t&) elementSemantic.iValWord);
    				ErrorCode |= objInterbaseManager.GetHidDB(15, (int64_t&) elementSemantic.iPOS);
    				elementSemantic.Univers.wsName = wsUnivers;
    				elementSemantic.Univers.idParagraph = idParagraph;
    				pListSemanticElement->push_back( &elementSemantic);
    				if( elementSemantic.nuIdTypeElement == 5) // un titre
    				{ // 3
    					if( wsOldText != elementSemantic.wsText)
    					{ // 4
    							wsOldText = elementSemantic.wsText;
    					} // 4
    				} // 3
    				iSize++;
    				ErrorCode |= objInterbaseManager.Next(bEndReached);
    			} // 2
    		} // 1
    Je serai content de savoir pourquoi je ne récupère pas les données que j'ai sous isql avec mon code. Les élémentSemantics sont incohérents. Pourquoi?
    ce sera d'avoir une réponse.

  2. #2
    Expert éminent sénior
    Avatar de Médinoc
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2005
    Messages
    27 379
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Septembre 2005
    Messages : 27 379
    Points : 41 575
    Points
    41 575
    Par défaut
    Ça sent vraiment mauvais, ces casts en int64_t&.
    Ces lignes me paraissent suspectes aussi:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    			    pelementSemantic = new ElementSemantic();
    				elementSemantic = *pelementSemantic;
    Quelle est le type de classe de ElementSemantic? (classe normale? classe .Net? classe valeur .Net?)

  3. #3
    Débutant
    Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2008
    Messages
    1 022
    Détails du profil
    Informations personnelles :
    Localisation : France, Mayenne (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Décembre 2008
    Messages : 1 022
    Points : 332
    Points
    332
    Par défaut la classe ElementSemantic
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
     
    	class ElementSemantic
    	{
    		public:
                 stUnivers Univers;
                 std::wstring wsText;
                 std::wstring wsIdentifier;
                 int siIdOccurence;
                 int nuIdTypeElement;
                 int siNbChunk;
                 int nuIdParagraph;
                 int nuIdChunk;
                 int nuIdElemn;
                 int nuIdChunkType;
                 int siNbWord;
                 int nuIdDrivingPos;
                 std::wstring wsWord;
                 int iValWord;
                 int iIdDoc;
                 int iPOS;
    	     int indice;
    	     std::wstring Sujet;
    	     std::wstring ListParagraph;
                 std::list<ElementLinks*> Link;
    	};
    et je vous met la requète donné par l'isql

    et j'ai corrigé le code comme ci_dessous:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
     
                        while( bEndReached != true && ErrorCode  == INIT_NO_ERROR && iSize < dwNbResultFound)
    		    { // 2
    			    pelementSemantic = new ElementSemantic();
    				pUnivers = new stUnivers();
    				pelementSemantic->Univers = *pUnivers;
    				ErrorCode |= objInterbaseManager.GetWideString(4, wsTemp);
    				pelementSemantic->wsText = wsTemp;
    				ErrorCode |= objInterbaseManager.GetWideString(5, wsTemp);
                                    std::wstring wsUnivers = wsTemp;
    				ErrorCode |= objInterbaseManager.GetWideString(13, wsTemp);
    				pelementSemantic->wsWord = wsTemp;
    				ErrorCode |= objInterbaseManager.GetHidDB(0, hidTemp);
    				pelementSemantic->nuIdElemn = hidTemp;
    				ErrorCode |= objInterbaseManager.GetHidDB(1, hidTemp);
    				pelementSemantic->nuIdTypeElement = hidTemp;
    				ErrorCode |= objInterbaseManager.GetHidDB(2, hidTemp);
    				pelementSemantic->siIdOccurence = hidTemp;
    				ErrorCode |= objInterbaseManager.GetHidDB(6, hidTemp);
    				idParagraph = hidTemp;
    				ErrorCode |= objInterbaseManager.GetHidDB(7, hidTemp);
    				pelementSemantic->siNbChunk = hidTemp;
    				ErrorCode |= objInterbaseManager.GetHidDB(8, hidTemp);
    				pelementSemantic->iIdDoc = hidTemp;
    				ErrorCode |= objInterbaseManager.GetHidDB(9, hidTemp);
    				pelementSemantic->nuIdChunk = hidTemp;
    				ErrorCode |= objInterbaseManager.GetHidDB(10, hidTemp);
    				pelementSemantic->nuIdChunkType = hidTemp;
    				ErrorCode |= objInterbaseManager.GetHidDB(11, hidTemp);
    				pelementSemantic->siNbWord = hidTemp;
    				ErrorCode |= objInterbaseManager.GetHidDB(12, hidTemp);
    				pelementSemantic->nuIdDrivingPos = hidTemp;
    				ErrorCode |= objInterbaseManager.GetHidDB(14, hidTemp);
    				pelementSemantic->iValWord = hidTemp;
    				ErrorCode |= objInterbaseManager.GetHidDB(15, hidTemp);
    				pelementSemantic->iPOS = hidTemp;
    				pelementSemantic->Univers.wsName = wsUnivers;
    				pelementSemantic->Univers.idParagraph = idParagraph;
    				pListSemanticElement->push_back( pelementSemantic);
    				if( pelementSemantic->nuIdTypeElement == 5) // un titre
    				{ // 3
    					if( wsOldText != pelementSemantic->wsText)
    					{ // 4
    							wsOldText = pelementSemantic->wsText;
    					} // 4
    				} // 3
    				iSize++;
    				ErrorCode |= objInterbaseManager.Next(bEndReached);
    			} // 2
    avec la déclaration de:

  4. #4
    Expert éminent sénior
    Avatar de Médinoc
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2005
    Messages
    27 379
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Septembre 2005
    Messages : 27 379
    Points : 41 575
    Points
    41 575
    Par défaut
    J'ai l'impression qu'il y a certains trucs que tu alloues sur le tas inutilement, mais sans une vue d'ensemble, impossible d'être sûr.

    ...Donc, maintenant ça marche?

  5. #5
    Débutant
    Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2008
    Messages
    1 022
    Détails du profil
    Informations personnelles :
    Localisation : France, Mayenne (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Décembre 2008
    Messages : 1 022
    Points : 332
    Points
    332
    Par défaut les pb d'allocation
    sont peut être a ce niveau je cherche sur ce sujet.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Une requète qui ne donne pas le résultat attendu
    Par JeanNoel53 dans le forum Firebird
    Réponses: 1
    Dernier message: 17/12/2013, 10h23
  2. [AC-2007] Requête qui ne donne pas de résultats
    Par sami0701 dans le forum Requêtes et SQL.
    Réponses: 10
    Dernier message: 07/11/2013, 22h50
  3. [PDO] Une requête qui ne retourne pas de résultat
    Par beegees dans le forum PHP & Base de données
    Réponses: 0
    Dernier message: 25/11/2011, 18h18
  4. Réponses: 3
    Dernier message: 29/07/2011, 11h54
  5. Réponses: 3
    Dernier message: 09/02/2010, 20h15

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo