28
28
**********************************************************************
30
* $Id: SQLGetConnectAttrW.c,v 1.3 2001/12/13 13:00:32 lurcher Exp $
30
* $Id: SQLGetConnectAttrW.c,v 1.9 2002/12/05 17:44:30 lurcher Exp $
32
32
* $Log: SQLGetConnectAttrW.c,v $
33
* Revision 1.9 2002/12/05 17:44:30 lurcher
35
* Display unknown return values in return logging
37
* Revision 1.8 2002/11/11 17:10:10 lurcher
41
* Revision 1.7 2002/08/23 09:42:37 lurcher
43
* Fix some build warnings with casts, and a AIX linker mod, to include
44
* deplib's on the link line, but not the libtool generated ones
46
* Revision 1.6 2002/08/12 13:17:52 lurcher
48
* Replicate the way the MS DM handles loading of driver libs, and allocating
49
* handles in the driver. usage counting in the driver means that dlopen is
50
* only called for the first use, and dlclose for the last. AllocHandle for
51
* the driver environment is only called for the first time per driver
52
* per application environment.
54
* Revision 1.5 2002/07/24 08:49:52 lurcher
56
* Alter UNICODE support to use iconv for UNICODE-ANSI conversion
58
* Revision 1.4 2002/07/16 13:08:18 lurcher
60
* Filter attribute values from SQLSetStmtAttr to SQLSetStmtOption to fit
62
* Make DSN's double clickable in ODBCConfig
33
64
* Revision 1.3 2001/12/13 13:00:32 lurcher
35
66
* Remove most if not all warnings on 64 bit platforms
109
140
ptr = log_info.log_file_name;
111
if ( log_info.log_file_name )
144
int len = strlen( ptr ) * sizeof( SQLWCHAR );
113
145
if ( string_length )
115
*string_length = strlen( ptr );
147
*string_length = len;
119
if ( buffer_length > strlen((char*) ptr ) + 1 )
151
if ( buffer_length > len + sizeof( SQLWCHAR ))
121
strcpy( value, ptr );
153
ansi_to_unicode_copy( value, ptr, SQL_NTS, connection );
125
memcpy( value, ptr, buffer_length - 1 );
126
((char*)value)[ buffer_length - 1 ] = '\0';
157
ansi_to_unicode_copy( value, ptr, buffer_length - 1, connection );
158
((SQLWCHAR*)value)[( buffer_length - 1 ) / sizeof( SQLWCHAR )] = 0;
127
159
ret = SQL_SUCCESS_WITH_INFO;
477
508
if ( CHECK_SQLGETCONNECTOPTIONW( connection ))
511
* Is it in the legal range of values
514
if ( attribute < SQL_CONN_DRIVER_MIN &&
515
( attribute > SQL_PACKET_SIZE || attribute < SQL_ACCESS_MODE ))
517
dm_log_write( __FILE__,
523
__post_internal_error( &connection -> error,
525
connection -> environment -> requested_version );
527
thread_release( SQL_HANDLE_STMT, connection );
529
return function_return( connection, SQL_ERROR );
479
532
ret = SQLGETCONNECTOPTIONW( connection,
480
533
connection -> driver_dbc,
513
566
if ( !CHECK_SQLGETCONNECTATTR( connection ))
515
if ( CHECK_SQLGETCONNECTOPTION( connection ))
568
if ( ret = CHECK_SQLGETCONNECTOPTION( connection ))
573
* Is it in the legal range of values
576
if ( attribute < SQL_CONN_DRIVER_MIN &&
577
( attribute > SQL_PACKET_SIZE || attribute < SQL_ACCESS_MODE ))
579
dm_log_write( __FILE__,
585
__post_internal_error( &connection -> error,
587
connection -> environment -> requested_version );
589
thread_release( SQL_HANDLE_STMT, connection );
591
return function_return( connection, SQL_ERROR );
596
case SQL_ATTR_CURRENT_CATALOG:
597
case SQL_ATTR_TRACEFILE:
598
case SQL_ATTR_TRANSLATE_LIB:
599
if ( SQL_SUCCEEDED( ret ) && value && buffer_length > 0 )
601
as1 = malloc( buffer_length + 1 );
517
606
ret = SQLGETCONNECTOPTION( connection,
518
607
connection -> driver_dbc,
522
611
switch( attribute )
524
613
case SQL_ATTR_CURRENT_CATALOG:
525
614
case SQL_ATTR_TRACEFILE:
526
615
case SQL_ATTR_TRANSLATE_LIB:
527
if ( SQL_SUCCEEDED( ret ) && value )
529
ansi_to_unicode_in_place( value, SQL_NTS );
616
if ( SQL_SUCCEEDED( ret ) && value && buffer_length > 0 && as1 )
618
ansi_to_unicode_copy( value, (char*) as1, SQL_NTS, connection );
553
649
switch( attribute )
555
651
case SQL_ATTR_CURRENT_CATALOG:
556
652
case SQL_ATTR_TRACEFILE:
557
653
case SQL_ATTR_TRANSLATE_LIB:
558
654
buffer_length = buffer_length / 2;
655
if ( buffer_length > 0 )
657
as1 = malloc( buffer_length + 1 );
562
662
ret = SQLGETCONNECTATTR( connection,
563
663
connection -> driver_dbc,
571
671
case SQL_ATTR_CURRENT_CATALOG:
572
672
case SQL_ATTR_TRACEFILE:
573
673
case SQL_ATTR_TRANSLATE_LIB:
574
if ( SQL_SUCCEEDED( ret ) && value )
576
ansi_to_unicode_in_place( value, SQL_NTS );
674
if ( SQL_SUCCEEDED( ret ) && value && buffer_length > 0 && as1 )
676
ansi_to_unicode_copy( value, (char*)as1, SQL_NTS, connection );