Précédent   Forum des professionnels en informatique > Bases de données > Autres SGBD > SQLite
SQLite Forum d'entraide SQLite
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 02/07/2008, 16h53   #1
Nouveau Membre du Club
 
Inscription : janvier 2008
Messages : 74
Détails du profil
Informations forums :
Inscription : janvier 2008
Messages : 74
Points : 26
Points : 26
Par défaut Libérer l'espace memoire des messages d'erreurs?

Bonjour tout le monde,

Après avoir executer la fonction
Code :
sqlite3_exec( sqlite3* db ,const char *sql,  int (*callback)(void*,int,char**,char**), void *,  char **errmsg);
, ou toutes autre fonction qui utilise le char ** errmsg ,doit-on libéré le errmsg ?

MERCI.
sofiane80 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 05/07/2008, 12h13   #2
Membre actif
 
Inscription : décembre 2004
Messages : 169
Détails du profil
Informations forums :
Inscription : décembre 2004
Messages : 169
Points : 175
Points : 175
Salut Sofiane80,

Voici un post sur la liste de diffusion SQLite (05/07/2006) qui répond à ta question :

Citation:
xxxxxxxrger@faa.gov wrote:
> > A few quick questions...
> >
> > If an error is returned by sqlite3_exec( ) , I believe the error message is
> > written in the (char **errmsg) provided in the 5 parameter of the function
> > call.
> >
> > 1. Is this the same error text that can be obtained by
> > sqlite3_errmsg( ) ?

Maybe or maybe not. The error message returned by sqlite3_exec()
might be more detailed. Depends on the error.

> > 2. If this is the same error text that can be obtained by
> > sqlite3_errmsg( ), what happens if I call sqlite3_free( ) before
> > sqlite3_errmsg( )?
> >

By "the same" I mean the same sequence of bytes. The error message
from sqlite3_exec() is always obtained from a malloc-like memory
allocator and must be freed using sqlite3_free(). The error message
returned by sqlite3_errmsg() is always a constant, static string.
The error messages might say the same thing, but they are distinct
strings.
--
D. Richard Hipp

La réponse de D. Richard Hipp est : oui, il faut libérer la mémoire :
" must be freed using sqlite3_free()"

a+
bigane 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 03h51.


 
 
 
 
Partenaires

Hébergement Web