Back to the month index |
Back to the list index
|
Thomas de Vries (thomas@htsa.hva.nl)
Tue, 01 Apr 1997 12:57:48 CET
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
- Next message: J.J. Merelo Guervos: "[mSQL] Problems in Solaris 2.5"
- Previous message: Florin Radulescu: "[mSQL] Bug (?) in common/portability.h: rand/srand"
From: Thomas de Vries <thomas@htsa.hva.nl> Message-Id: <199704011157.AA005195869@htsa.htsa.hva.nl> Subject: [mSQL] Problem regarding API (C++) Date: Tue, 01 Apr 1997 12:57:48 CETHi there,
I'm curently working on a C++ program with the API myself.
I do not have much programming experinence, so maybe
someone can give me some tips.
In the object PersonRecord a string is dynamicly stored (with strlen)
I want to store the field values in a temporary buffer-object PersonRecord.
(so I can manipulate the output)
So I'm looking for a array with strings, wich are dynamicly allocated.
I realise this may be more of a programming question but I think people
who read this mailing list will see the problem.
Thanks
Thomas de Vries
student - thomas@htsa.hva.nl
I'm working with a g++ compiler under:
mSQL server version 2.0 Beta 4
mSQL protocol version 22
mSQL connection Localhost via UNIX socket
Target platform Linux-2.0.18-i586
//How can I store the string values in a Record-kind-off structure?
PersonRecord::Store(char *fieldString){
string = new char[strlen(fieldString)+1];
strcpy(string,fieldString);
string = fieldString;
//cout << string; This works
};
class PersonDbase{
public:
PersonDbase();
int DisplayData(char field[255],char table[255]);
private:
PersonRecord *personRecord;
};
PersonDbase::PersonDbase(){
};
int PersonDbase::DisplayData(char field[255],char table[255]){
char query[1000] = "SELECT ";
strcat(query,field);
strcat(query," FROM ");
strcat(query,table);
if ( msqlQuery(sock,query) < 0 ){ cout << msqlErrMsg;}
m_result *resultQuery;
char **swap;
resultQuery = msqlStoreResult();
swap = msqlFetchRow(resultQuery);
while(swap!=0){
personRecord->Store(*swap);
swap = msqlFetchRow(resultQuery);
}
//Here I can access the PersonRecord and manipulate the output
return 1;
}
--------------------------------------------------------------------------
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!
- Next message: J.J. Merelo Guervos: "[mSQL] Problems in Solaris 2.5"
- Previous message: Florin Radulescu: "[mSQL] Bug (?) in common/portability.h: rand/srand"