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

« back to all changes in this revision

Viewing changes to DriverManager/SQLGetDescRec.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: SQLGetDescRec.c,v 1.2 2001/12/13 13:00:32 lurcher Exp $
 
30
 * $Id: SQLGetDescRec.c,v 1.5 2002/12/05 17:44:30 lurcher Exp $
31
31
 *
32
32
 * $Log: SQLGetDescRec.c,v $
 
33
 * Revision 1.5  2002/12/05 17:44:30  lurcher
 
34
 *
 
35
 * Display unknown return values in return logging
 
36
 *
 
37
 * Revision 1.4  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.3  2002/07/24 08:49:52  lurcher
 
43
 *
 
44
 * Alter UNICODE support to use iconv for UNICODE-ANSI conversion
 
45
 *
33
46
 * Revision 1.2  2001/12/13 13:00:32  lurcher
34
47
 *
35
48
 * Remove most if not all warnings on 64 bit platforms
111
124
 
112
125
#include "drivermanager.h"
113
126
 
114
 
static char const rcsid[]= "$RCSfile: SQLGetDescRec.c,v $ $Revision: 1.2 $";
 
127
static char const rcsid[]= "$RCSfile: SQLGetDescRec.c,v $ $Revision: 1.5 $";
115
128
 
116
129
SQLRETURN SQLGetDescRec( SQLHDESC descriptor_handle,
117
130
           SQLSMALLINT rec_number, 
136
149
    SQLRETURN ret;
137
150
    SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ], s2[ 100 + LOG_MESSAGE_LEN ], s3[ 100 + LOG_MESSAGE_LEN ], s4[ 100 + LOG_MESSAGE_LEN ];
138
151
    SQLCHAR s5[ 100 + LOG_MESSAGE_LEN ], s6[ 100 + LOG_MESSAGE_LEN ], s7[ 100 + LOG_MESSAGE_LEN ];
 
152
    SQLCHAR s8[ 100 + LOG_MESSAGE_LEN ];
139
153
 
140
154
    /*
141
155
     * check descriptor
208
222
 
209
223
    if ( descriptor -> connection -> unicode_driver )
210
224
    {
 
225
        SQLWCHAR *s1 = NULL;
 
226
 
211
227
        if ( !CHECK_SQLGETDESCRECW( descriptor -> connection ))
212
228
        {
213
229
            dm_log_write( __FILE__, 
225
241
            return function_return( descriptor, SQL_ERROR );
226
242
        }
227
243
 
 
244
        if ( name && buffer_length > 0 )
 
245
        {
 
246
            s1 = malloc( sizeof( SQLWCHAR ) * ( buffer_length + 1 ));
 
247
        }
 
248
 
228
249
        ret = SQLGETDESCRECW( descriptor -> connection,
229
250
                descriptor -> driver_desc,
230
251
                rec_number, 
231
 
                name,
 
252
                s1 ? s1 : (SQLWCHAR*) name,
232
253
                buffer_length, 
233
254
                string_length,
234
255
                type, 
238
259
                scale, 
239
260
                nullable );
240
261
 
241
 
        if ( SQL_SUCCEEDED( ret ) && name )
242
 
        {
243
 
            unicode_to_ansi((SQLWCHAR*) name, SQL_NTS );
 
262
        if ( SQL_SUCCEEDED( ret ) && name && s1 )
 
263
        {
 
264
            unicode_to_ansi_copy((char*) name, s1, SQL_NTS, descriptor -> connection );
 
265
        }
 
266
 
 
267
        if ( s1 )
 
268
        {
 
269
            free( s1 );
244
270
        }
245
271
    }
246
272
    else
287
313
                \n\t\t\tPrecision = %s\
288
314
                \n\t\t\tScale = %s\
289
315
                \n\t\t\tNullable = %s",
290
 
                    __get_return_status( ret ),
 
316
                    __get_return_status( ret, s8 ),
291
317
                    __sdata_as_string( s1, SQL_CHAR, 
292
318
                        string_length, name ),
293
319
                    __sptr_as_string( s2, type ),