Click here to Skip to main content
15,887,485 members
Home / Discussions / Database
   

Database

 
GeneralRe: how to get select parameter too in input parameter in stored procedure Pin
jschell29-Jun-12 8:56
jschell29-Jun-12 8:56 
GeneralRegarding mdf file Pin
lalitN26-Jun-12 22:48
lalitN26-Jun-12 22:48 
QuestionRe: Regarding mdf file Pin
Eddy Vluggen27-Jun-12 0:22
professionalEddy Vluggen27-Jun-12 0:22 
AnswerRe: Regarding mdf file Pin
lalitN27-Jun-12 0:24
lalitN27-Jun-12 0:24 
AnswerRe: Regarding mdf file Pin
Eddy Vluggen27-Jun-12 0:37
professionalEddy Vluggen27-Jun-12 0:37 
GeneralRe: Regarding mdf file Pin
lalitN27-Jun-12 1:41
lalitN27-Jun-12 1:41 
AnswerRe: Regarding mdf file Pin
Eddy Vluggen27-Jun-12 1:46
professionalEddy Vluggen27-Jun-12 1:46 
Questionplease help me with sqlite3 problem. Pin
mimi052526-Jun-12 20:04
mimi052526-Jun-12 20:04 
Hi, everyone, I'm using sqlite 3.6.22 in an ARM-linux based application, and I was annoyed a lot by a memory-leak problem.
this is the problem:
sqlite3_free_table(char **result) doesn't exactly release the memory allocated by sqlite3_get_table function.
To verify it I made it called dirrectly after sqlite3_get_table() function, but I can still access the azResult parameter.
bellow is part of my code:

sqlite3 *db;
char *sqlcmd;
int nrow ;
int ncolumn ;
char **azResult;
char *zErr;
int rc;
rc = sqlite3_open("/usr/YY_AEACard.db", &db);
if (rc) {
fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
sqlite3_close(db);
return -1 ;
}

sqlcmd = sqlite3_mprintf("select CardID,CardType,BgnDate,EndDate,ValidTimes,CardRight,CardFlag, EnabledPorts,LastAccessPort,CardPsw from tb_CardInfo where CardID=%d and EnabledPorts = %d\n",card->CardID, nPort );
sqlite3_get_table( db, sqlcmd, &azResult, &nrow, &ncolumn, &zErr );
sqlite3_free( sqlcmd );

///////////////////////////////////////////////////////////
sqlite3_free_table(azResult);
///////////////////////////////////////////////////////////
// it still works when i do this here.

if (rc != SQLITE_OK) {
if (zErr != NULL) {
fprintf(stderr, "SQL error: %s\n", zErr);
sqlite3_free(zErr);
}
}

if(nrow <= 0)
{
printf("No data from db!\n");
return -1;
}
if(ncolumn < 9)
{
printf("Columns are not enough for card table!\n");
return -1;
}
bzero(card, sizeof(card));
card->CardID = atoi(azResult[ncolumn+0]);
card->CardType = atoi(azResult[ncolumn+1]);
strcpy(card->BgnDate, azResult[ncolumn+2]);
strcpy(card->EndDate, azResult[ncolumn+3]);
card->ValidTimes = atoi(azResult[ncolumn+4]);
card->CardRight = atoi(azResult[ncolumn+5]);
card->CardFlag = atoi(azResult[ncolumn+6]);
card->EnabledPorts = atoi(azResult[ncolumn+7]);
card->LastAccessPort = atoi(azResult[ncolumn+8]);
strcpy(card->CardPsw, azResult[ncolumn+9]);
sqlite3_free_table(azResult);
//this is a test for the memory leak
printf("%s\n", azResult[4]);
//funny enough, it still works here.
sqlite3_close(db);
return 0;

please help me, thank you.
AnswerRe: please help me with sqlite3 problem. Pin
Peter_in_278026-Jun-12 21:02
professionalPeter_in_278026-Jun-12 21:02 
GeneralRe: please help me with sqlite3 problem. Pin
mimi052526-Jun-12 21:17
mimi052526-Jun-12 21:17 
AnswerRe: please help me with sqlite3 problem. Pin
Peter_in_278026-Jun-12 21:35
professionalPeter_in_278026-Jun-12 21:35 
GeneralRe: please help me with sqlite3 problem. Pin
mimi052526-Jun-12 22:03
mimi052526-Jun-12 22:03 
GeneralRe: please help me with sqlite3 problem. Pin
mimi052526-Jun-12 22:13
mimi052526-Jun-12 22:13 
QuestionComparing Performance monitor counters for SQL.UserConnections Vs. SSRS.ActiveConnections Pin
Jon_Boy26-Jun-12 6:47
Jon_Boy26-Jun-12 6:47 
Questionworkflow foundation in visual studio 2008 Pin
Member 904774326-Jun-12 1:18
Member 904774326-Jun-12 1:18 
QuestionRe: workflow foundation in visual studio 2008 Pin
Richard MacCutchan26-Jun-12 2:14
mveRichard MacCutchan26-Jun-12 2:14 
QuestionReg SSRS 2008 Pin
Member 904774326-Jun-12 1:16
Member 904774326-Jun-12 1:16 
QuestionRe: Reg SSRS 2008 Pin
Richard MacCutchan26-Jun-12 2:14
mveRichard MacCutchan26-Jun-12 2:14 
QuestionEDm->LINQ->WCF data services? Pin
vkap25-Jun-12 9:13
vkap25-Jun-12 9:13 
AnswerRe: EDm->LINQ->WCF data services? Pin
Mycroft Holmes25-Jun-12 13:10
professionalMycroft Holmes25-Jun-12 13:10 
Questionget list of connected users Pin
Danzy8325-Jun-12 3:31
Danzy8325-Jun-12 3:31 
AnswerRe: get list of connected users Pin
Eddy Vluggen25-Jun-12 4:44
professionalEddy Vluggen25-Jun-12 4:44 
Answersp_who or sp_who2 Pin
David Mujica25-Jun-12 5:45
David Mujica25-Jun-12 5:45 
GeneralRe: sp_who or sp_who2 Pin
Danzy8325-Jun-12 11:29
Danzy8325-Jun-12 11:29 
QuestionHow to secure a database? Pin
Kujtim Hyseni24-Jun-12 23:47
Kujtim Hyseni24-Jun-12 23:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.