~ubuntu-branches/debian/sid/unixodbc/sid

« back to all changes in this revision

Viewing changes to DriverManager/SQLGetConnectOption.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2004-10-15 03:07:52 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20041015030752-dzw4vhxlgycz3woj
Tags: 2.2.4-11
Brown paper bag me: conflicts do not write themselves just because
you add a line to the changelog.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 *
28
28
 **********************************************************************
29
29
 *
30
 
 * $Id: SQLGetConnectOption.c,v 1.1.1.1 2001/10/17 16:40:05 lurcher Exp $
 
30
 * $Id: SQLGetConnectOption.c,v 1.4 2002/12/05 17:44:30 lurcher Exp $
31
31
 *
32
32
 * $Log: SQLGetConnectOption.c,v $
 
33
 * Revision 1.4  2002/12/05 17:44:30  lurcher
 
34
 *
 
35
 * Display unknown return values in return logging
 
36
 *
 
37
 * Revision 1.3  2002/11/11 17:10:10  lurcher
 
38
 *
 
39
 * VMS changes
 
40
 *
 
41
 * Revision 1.2  2002/07/24 08:49:52  lurcher
 
42
 *
 
43
 * Alter UNICODE support to use iconv for UNICODE-ANSI conversion
 
44
 *
33
45
 * Revision 1.1.1.1  2001/10/17 16:40:05  lurcher
34
46
 *
35
47
 * First upload to SourceForge
111
123
 
112
124
#include "drivermanager.h"
113
125
 
114
 
static char const rcsid[]= "$RCSfile: SQLGetConnectOption.c,v $ $Revision: 1.1.1.1 $";
 
126
static char const rcsid[]= "$RCSfile: SQLGetConnectOption.c,v $ $Revision: 1.4 $";
115
127
 
116
128
SQLRETURN SQLGetConnectOption( SQLHDBC connection_handle,
117
129
           SQLUSMALLINT option,
283
295
    {
284
296
        sprintf( connection -> msg, 
285
297
                "\n\t\tExit:[%s]",
286
 
                    __get_return_status( SQL_SUCCESS ));
 
298
                    __get_return_status( SQL_SUCCESS, s1 ));
287
299
 
288
300
        dm_log_write( __FILE__, 
289
301
                __LINE__, 
297
309
    }
298
310
    else
299
311
    {
300
 
        SQLRETURN ret;
 
312
        SQLRETURN ret = 0;
301
313
 
302
314
        /*
303
315
         * call the driver
305
317
 
306
318
        if ( connection -> unicode_driver )
307
319
        {
308
 
            if ( CHECK_SQLGETCONNECTOPTIONW( connection ))
 
320
            SQLWCHAR *s1 = NULL;
 
321
 
 
322
            if ( ret = CHECK_SQLGETCONNECTOPTIONW( connection ))
309
323
            {
 
324
                switch( option )
 
325
                {
 
326
                  case SQL_ATTR_CURRENT_CATALOG:
 
327
                  case SQL_ATTR_TRACEFILE:
 
328
                  case SQL_ATTR_TRANSLATE_LIB:
 
329
                    if ( SQL_SUCCEEDED( ret ) && value )
 
330
                    {
 
331
                        /*
 
332
                         * guess a length
 
333
                         */
 
334
                        if ( value )
 
335
                        {
 
336
                            s1 = malloc( sizeof( SQLWCHAR ) * 1024 );
 
337
                        }
 
338
                    }
 
339
                    break;
 
340
                }
 
341
 
310
342
                ret = SQLGETCONNECTOPTIONW( connection,
311
343
                        connection -> driver_dbc,
312
344
                        option,
313
 
                        value );
 
345
                        s1 ? s1 : value );
314
346
 
315
347
                switch( option )
316
348
                {
317
349
                  case SQL_ATTR_CURRENT_CATALOG:
318
350
                  case SQL_ATTR_TRACEFILE:
319
351
                  case SQL_ATTR_TRANSLATE_LIB:
320
 
                    if ( SQL_SUCCEEDED( ret ) && value )
 
352
                    if ( SQL_SUCCEEDED( ret ) && value && s1 )
321
353
                    {
322
 
                        unicode_to_ansi( value, SQL_NTS );
 
354
                        unicode_to_ansi_copy( value, s1, SQL_NTS, connection );
323
355
                    }
324
356
                    break;
325
357
                }
 
358
 
 
359
                if ( s1 )
 
360
                {
 
361
                    free( s1 );
 
362
                }
326
363
            }
327
364
            else if ( CHECK_SQLGETCONNECTATTRW( connection ))
328
365
            {
360
397
 
361
398
                if ( ptr != value && SQL_SUCCEEDED( ret ))
362
399
                {
363
 
                    strcpy( value, unicode_to_ansi( ptr, SQL_NTS ));
 
400
                    unicode_to_ansi_copy( value, ptr, SQL_NTS, connection );
364
401
 
365
402
                    /*
366
403
                     * are we still here ? good
446
483
        {
447
484
            sprintf( connection -> msg, 
448
485
                    "\n\t\tExit:[%s]",
449
 
                        __get_return_status( ret ));
 
486
                        __get_return_status( ret, s1 ));
450
487
 
451
488
            dm_log_write( __FILE__, 
452
489
                    __LINE__,