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

« back to all changes in this revision

Viewing changes to DriverManager/SQLColAttributeW.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: SQLColAttributeW.c,v 1.2 2001/11/16 11:39:17 lurcher Exp $
 
30
 * $Id: SQLColAttributeW.c,v 1.7 2002/12/05 17:44:30 lurcher Exp $
31
31
 *
32
32
 * $Log: SQLColAttributeW.c,v $
 
33
 * Revision 1.7  2002/12/05 17:44:30  lurcher
 
34
 *
 
35
 * Display unknown return values in return logging
 
36
 *
 
37
 * Revision 1.6  2002/08/23 09:42:37  lurcher
 
38
 *
 
39
 * Fix some build warnings with casts, and a AIX linker mod, to include
 
40
 * deplib's on the link line, but not the libtool generated ones
 
41
 *
 
42
 * Revision 1.5  2002/08/19 09:11:49  lurcher
 
43
 *
 
44
 * Fix Maxor ineffiecny in Postgres Drivers, and fix a return state
 
45
 *
 
46
 * Revision 1.4  2002/07/24 08:49:51  lurcher
 
47
 *
 
48
 * Alter UNICODE support to use iconv for UNICODE-ANSI conversion
 
49
 *
 
50
 * Revision 1.3  2002/04/25 15:16:46  lurcher
 
51
 *
 
52
 * Fix bug with SQLCOlAttribute(s)(W) where a column of zero could not be
 
53
 * used to get the count value
 
54
 *
33
55
 * Revision 1.2  2001/11/16 11:39:17  lurcher
34
56
 *
35
57
 * Add mapping between ODBC 2 and ODBC 3 types for SQLColAttribute(s)(W)
111
133
    }
112
134
 
113
135
    if ( column_number == 0 &&
114
 
            statement -> bookmarks_on == SQL_UB_OFF && statement -> connection -> bookmarks_on == SQL_UB_OFF )
 
136
            statement -> bookmarks_on == SQL_UB_OFF && statement -> connection -> bookmarks_on == SQL_UB_OFF &&
 
137
            field_identifier != SQL_DESC_COUNT )
115
138
    {
116
139
        dm_log_write( __FILE__, 
117
140
                __LINE__, 
119
142
                LOG_INFO, 
120
143
                "Error: 07009" );
121
144
 
122
 
        __post_internal_error( &statement -> error,
 
145
        __post_internal_error_api( &statement -> error,
123
146
                ERROR_07009, NULL,
124
 
                statement -> connection -> environment -> requested_version );
 
147
                statement -> connection -> environment -> requested_version,
 
148
                SQL_API_SQLCOLATTRIBUTE );
125
149
        return function_return( statement, SQL_ERROR );
126
150
    }
127
151
 
271
295
        {
272
296
            if ( CHECK_SQLCOLATTRIBUTES( statement -> connection ))
273
297
            {
 
298
                SQLCHAR *as1 = NULL;
 
299
 
274
300
                /*
275
301
                 * map to the ODBC2 function
276
302
                 */
292
318
                  case SQL_DESC_LOCAL_TYPE_NAME:
293
319
                  case SQL_DESC_NAME:
294
320
                    buffer_length = buffer_length / 2;
 
321
                    if ( buffer_length > 0 )
 
322
                    {
 
323
                        as1 = malloc( buffer_length + 1 );
 
324
                    }
295
325
                    break;
296
326
                }
297
327
 
299
329
                    statement -> driver_stmt,
300
330
                    column_number,
301
331
                    field_identifier,
302
 
                    character_attribute,
 
332
                    as1 ? as1 : character_attribute,
303
333
                    buffer_length,
304
334
                    string_length,
305
335
                    numeric_attribute );
318
348
                  case SQL_DESC_LITERAL_SUFFIX:
319
349
                  case SQL_DESC_LOCAL_TYPE_NAME:
320
350
                  case SQL_DESC_NAME:
321
 
                    if ( SQL_SUCCEEDED( ret ) && character_attribute )
322
 
                    {
323
 
                        ansi_to_unicode_in_place( character_attribute, SQL_NTS );
324
 
                    }
 
351
                    if ( SQL_SUCCEEDED( ret ) && character_attribute && as1 )
 
352
                    {
 
353
                        ansi_to_unicode_copy( character_attribute, (char*) as1, SQL_NTS, statement -> connection );
 
354
                    }
 
355
 
 
356
                    if ( as1 ) 
 
357
                    {
 
358
                        free( as1 );
 
359
                    }
 
360
 
325
361
                    break;
326
362
                }
327
363
            }
341
377
        }
342
378
        else
343
379
        {
 
380
            SQLCHAR *as1 = NULL;
 
381
 
344
382
            switch( field_identifier )
345
383
            {
346
384
              case SQL_DESC_BASE_COLUMN_NAME:
356
394
              case SQL_DESC_TYPE_NAME:
357
395
              case SQL_COLUMN_NAME:
358
396
                buffer_length = buffer_length / 2;
 
397
                if ( buffer_length > 0 )
 
398
                {
 
399
                    as1 = malloc( buffer_length + 1 );
 
400
                }
359
401
                break;
360
402
            }
361
403
 
363
405
                    statement -> driver_stmt,
364
406
                    column_number,
365
407
                    field_identifier,
366
 
                    character_attribute,
 
408
                    as1 ? as1 : character_attribute,
367
409
                    buffer_length,
368
410
                    string_length,
369
411
                    numeric_attribute );
382
424
              case SQL_DESC_TABLE_NAME:
383
425
              case SQL_DESC_TYPE_NAME:
384
426
              case SQL_COLUMN_NAME:
385
 
                if ( SQL_SUCCEEDED( ret ) && character_attribute )
386
 
                {
387
 
                    ansi_to_unicode_in_place( character_attribute, SQL_NTS );
 
427
                if ( SQL_SUCCEEDED( ret ) && character_attribute && as1 )
 
428
                {
 
429
                    ansi_to_unicode_copy( character_attribute, (char*) as1, SQL_NTS, statement -> connection );
 
430
                }
 
431
 
 
432
                if ( as1 ) 
 
433
                {
 
434
                    free( as1 );
388
435
                }
389
436
                break;
390
437
 
420
467
    {
421
468
        sprintf( statement -> msg, 
422
469
                "\n\t\tExit:[%s]",
423
 
                    __get_return_status( ret ));
 
470
                    __get_return_status( ret, s1 ));
424
471
 
425
472
        dm_log_write( __FILE__, 
426
473
                __LINE__,