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

« back to all changes in this revision

Viewing changes to DriverManager/SQLGetDescField.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: SQLGetDescField.c,v 1.1.1.1 2001/10/17 16:40:05 lurcher Exp $
 
30
 * $Id: SQLGetDescField.c,v 1.4 2002/12/05 17:44:30 lurcher Exp $
31
31
 *
32
32
 * $Log: SQLGetDescField.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/07/24 08:49:52  lurcher
 
38
 *
 
39
 * Alter UNICODE support to use iconv for UNICODE-ANSI conversion
 
40
 *
 
41
 * Revision 1.2  2002/01/21 18:00:51  lurcher
 
42
 *
 
43
 * Assorted fixed and changes, mainly UNICODE/bug fixes
 
44
 *
33
45
 * Revision 1.1.1.1  2001/10/17 16:40:05  lurcher
34
46
 *
35
47
 * First upload to SourceForge
100
112
 
101
113
#include "drivermanager.h"
102
114
 
103
 
static char const rcsid[]= "$RCSfile: SQLGetDescField.c,v $ $Revision: 1.1.1.1 $";
 
115
static char const rcsid[]= "$RCSfile: SQLGetDescField.c,v $ $Revision: 1.4 $";
104
116
 
105
117
SQLRETURN SQLGetDescField( SQLHDESC descriptor_handle,
106
118
           SQLSMALLINT rec_number, 
181
193
 
182
194
    if ( descriptor -> connection -> unicode_driver )
183
195
    {
 
196
        SQLWCHAR *s1 = NULL;
 
197
 
184
198
        if ( !CHECK_SQLGETDESCFIELDW( descriptor -> connection ))
185
199
        {
186
200
            dm_log_write( __FILE__, 
211
225
          case SQL_DESC_SCHEMA_NAME:
212
226
          case SQL_DESC_TABLE_NAME:
213
227
          case SQL_DESC_TYPE_NAME:
214
 
            buffer_length = buffer_length / 2;
 
228
            if ( buffer_length > 0 && value )
 
229
            {
 
230
                s1 = malloc( sizeof( SQLWCHAR ) * ( buffer_length + 1 ));
 
231
            }
215
232
            break;
216
233
        }
217
234
 
219
236
                descriptor -> driver_desc,
220
237
                rec_number, 
221
238
                field_identifier,
222
 
                value, 
 
239
                s1 ? s1 : value, 
223
240
                buffer_length,
224
241
                string_length );
225
242
 
236
253
          case SQL_DESC_SCHEMA_NAME:
237
254
          case SQL_DESC_TABLE_NAME:
238
255
          case SQL_DESC_TYPE_NAME:
239
 
            if ( SQL_SUCCEEDED( ret ) && value )
 
256
            if ( SQL_SUCCEEDED( ret ) && value && s1 )
240
257
            {
241
 
                unicode_to_ansi( value, SQL_NTS );
 
258
                unicode_to_ansi_copy( value, s1, SQL_NTS, descriptor -> connection );
242
259
            }
243
260
            break;
244
261
        }
245
262
 
 
263
        if ( s1 )
 
264
        {
 
265
            free( s1 );
 
266
        }
246
267
    }
247
268
    else
248
269
    {
276
297
    {
277
298
        sprintf( descriptor -> msg, 
278
299
                "\n\t\tExit:[%s]",
279
 
                    __get_return_status( ret ));
 
300
                    __get_return_status( ret, s1 ));
280
301
 
281
302
        dm_log_write( __FILE__, 
282
303
                __LINE__,