Mailing List Archive



Back to the month index Back to the list index

administrator@internet-mail.it.qms.com
Sat, 12 Apr 97 00:21:50 CST


From: administrator@internet-mail.it.qms.com
Date: Sat, 12 Apr 97 00:21:50 CST
Message-Id: <9703128608.AA860829710@iscclink.is.qms.com>
Subject: [mSQL] Message not deliverable

Received: by ccmail from rd.qms.com
>From owner-msql-list@Bunyip.Com
X-Envelope-From: owner-msql-list@Bunyip.Com
Received: from gatekeeper.qms.com by rd.qms.com (4.1/SMI-4.1)
    id AA08888; Sat, 12 Apr 97 00:17:59 CDT
Errors-To: owner-msql-list@Bunyip.Com
Received: from services.bunyip.com by gatekeeper.qms.com (4.1/SMI-4.1)
    id AA06389; Sat, 12 Apr 97 00:17:55 CDT
Errors-To: owner-msql-list@Bunyip.Com
Received: (from Received: (from daemon@localhost)
    by services.bunyip.com (8.8.5/8.8.5) id XAA29764
    for msql-list-out; Fri, 11 Apr 1997 23:58:12 -0400 (EDT)
Received: from mocha.bunyip.com (mocha.Bunyip.Com [192.197.208.1])
    by services.bunyip.com (8.8.5/8.8.5) with SMTP id XAA29759
    for <msql-list@services.bunyip.com>; Fri, 11 Apr 1997 23:58:09 -0400 (EDT)
Received: from rig1.rigroup.com by mocha.bunyip.com with SMTP (5.65a/IDA-1.4.2b/C
C-Guru-2b)
        id AA21082 (mail destined for msql-list@services.bunyip.com); Fri, 11 Ap
r 97 23:56:33 -0400
Received: from markc2 (pri-05.rigroup.com [206.52.141.225])
          by rig1.rigroup.com (Netscape Mail Server v2.01) with SMTP
          id AAA4518 for <msql-list@Bunyip.Com>;
          Fri, 11 Apr 1997 22:59:53 -0500
Received: by markc2 with Microsoft Mail
    id <id <01BC46CB.79F165A0@markc2>; Fri, 11 Apr 1997 22:55:39 -0500
Message-Id: <01BC46CB.79F165A0@markc2>
From: Mark Castillo <markc@rigroup.com>
To: "'msql-list@Bunyip.Com'" <msql-list@bunyip.com>
Subject: RE: [mSQL] Problem on Mini-SQL API !!
Date: Fri, 11 Apr 1997 22:55:38 -0500
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 8bit
X-Mime-Autoconverted: from quoted-printable to 8bit by services.bunyip.com id XAA
29760
Sender: owner-msql-list@Bunyip.Com
Precedence: bulk
Reply-To: msql-list@Bunyip.Com
Errors-To: owner-msql-list@Bunyip.Com

I think you are missing msqlFieldSeek (?) somwhere at the end of you for loop, bu
t I'm not sure. When the DB returns more than one row, you need to call this fun
ction (I think)

----------
From: sbleung3@se.cuhk.edu.hk[SMTP:sbleung3@se.cuhk.edu.hk]
Sent: Friday, April 11, 1997 7:25 PM
To: msql-list@Bond.edu.au
Cc: bambi@Hughes.com.au
Subject: [mSQL] Problem on Mini-SQL API !!

Hello !! Everybody !

    I am new to MiniSQL ! I am working on Solaris !
    I have a problem on running the following program, hope you may spent a littl
e
time to examine my small program :
    When I put one record, namely, ('joey','joey4088') in a table called user_pas
s(
contains 'username' and 'password' fields ), it runs okay with the correct output
 !
    However, when I add one more record to the table, namely, ('maggie', 'mag4088
'),
the program then run into segmentation fault :

cuse51:/uac/std/y93/sbleung3/ns-home/cgi-bin[75] > a.out

       username:joey
       password:joey4088
 
Segmentation fault

    I don't know why. Hope you may help me !
    Since I have not subscribe into the mailing list currently,
    please reply me at the following e-mail address :

    sbleung3@se.cuhk.edu.hk

    Thank you to your kindly attention !
  
---------------------------------------------------------------------------------
 
#include <stdio.h>
#include <stdlib.h>
#include "msql.h"

void main(void){

 m_result *msql_data;
 m_row msql_row;
 m_field *msql_field;
 int result;
 int socket;
 int numrows;
 int numfields;
 int i,j;
 char querystring[50];

 result=msqlConnect("cuse51.se.cuhk.edu.hk");
 
 if(result==-1){
    fprintf(stderr,"Unable to connect to database.\n");
    fprintf(stderr," %s\n",msqlErrMsg);
    exit;
 }
 socket=result;
 
 result=msqlSelectDB(socket,"customer");
 
 if(result==-1) {
    fprintf(stderr,"Unable to find database customer.\n");
    fprintf(stderr," %s\n",msqlErrMsg);
    exit;
 }
 

 result=msqlQuery(socket,"select * from user_pass ");

 if(result==-1){
     fprintf(stderr,"Error querying database. \n");
     fprintf(stderr," %s\n",msqlErrMsg);
     exit;
 }

 msql_data=msqlStoreResult();
 
 numrows=msqlNumRows(msql_data);
 numfields=msqlNumFields(msql_data);
 
 for(i=0; i<numrows; i++){
    fprintf(stdout,"\n");
    msql_row=msqlFetchRow(msql_data);
    
    for(j=0;j<numfields;j++){
       msql_field=msqlFetchField(msql_data);

       fprintf(stdout,"%15.15s:",msql_field->name);
        switch(msql_field->type){
          case CHAR_TYPE:
               fprintf(stdout,"%s\n",msql_row[j]);
               break;
          case INT_TYPE:
               fprintf(stdout,"%d\n",atoi(msql_row[j]));
               break;
          case REAL_TYPE:
               fprintf(stdout,"%f\n",atof(msql_row[j]));
               break;
       }
    }
  }
   
  fprintf(stdout,"\n");
  
  msqlFreeResult(msql_data);
  
  msqlClose(socket);

}
  
-------------------------------END--------------------------------

          

    

   
--------------------------------------------------------------------------
To remove yourself from the Mini SQL mailing list send a message containing
"unsubscribe" to "unsubscribe" to msql-list-request@bunyip.com. Send a message containing
"info msql-list" to majordomo@bunyip.com for info on monthly archives of
the list. For more help, mail owner-msql-list@bunyip.com NOT the msql-list!

--------------------------------------------------------------------------
To remove yourself from the Mini SQL mailing list send a message containing
"unsubscribe" to "unsubscribe" to msql-list-request@bunyip.com. Send a message containing
"info msql-list" to majordomo@bunyip.com for info on monthly archives of
the list. For more help, mail owner-msql-list@bunyip.com NOT the msql-list!

--------------------------------------------------------------------------
To remove yourself from the Mini SQL mailing list send a message containing
"unsubscribe" to "unsubscribe" to msql-list-request@bunyip.com. Send a message containing
"info msql-list" to majordomo@bunyip.com for info on monthly archives of
the list. For more help, mail owner-msql-list@bunyip.com NOT the msql-list!