[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::c_plus_plus

Title:C++
Notice:Read 1.* and use keywords (e.g. SHOW KEY/FULL KIT_CXX_VAX_VMS)
Moderator:DECCXX::AMARTIN
Created:Fri Nov 06 1987
Last Modified:Thu Jun 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:3604
Total number of notes:18242

3471.0. "use of String as output arg in SQLMOD" by CIM2NI::THORPE () Fri Feb 28 1997 19:01

Is it possible to use SQL to read into an object of type String?  Or do
I have to declare an array of char of the proper length and then load
that into the String?  Using a String in place of char* is fine for an
input argument but I can't get it to work for an output argument.

Thanks,
Bill

for example:

//t.cxx
#include <iostream.hxx>
#include <String.hxx>

#ifdef __cplusplus
extern "C" {
#endif

extern void get_name(int *sqlcode ,char *name);

#ifdef __cplusplus
}
#endif

main()
{
  String name;   // it is nice not to have to worry about string length
  int sqlcode;
  get_name(&sqlcode, name);
  cout << "name read from database is " << name << endl;
}

--------------------------------
//t_mod.sqlmod (pseudo code)

PROCEDURE get_name
    SQLCODE
    :name       char(20)
    ;

    SELECT name INTO :name FROM blah_table
    LIMIT TO 1 ROW
    ;

T.RTitleUserPersonal
Name
DateLines