~ubuntu-branches/ubuntu/oneiric/psqlodbc/oneiric

« back to all changes in this revision

Viewing changes to options.c

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Berg
  • Date: 2011-04-05 14:48:23 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20110405144823-n77supsa1hjj0ik6
Tags: 1:09.00.0200-1
* New upstream release.
* Fix installing {A,W}/usr/lib/odbc.  Closes: #618210.
* Convert to 3.0 (quilt).
* Remove psqlodbc-580878.diff: implemented upstream.
* Remove psqlodbc-585476.diff: was caused by #519006 which is now closed.
* Update description, suggested by Martin Eberhard Schauer.
  Closes: #565611.
* New maintainer.  Closes: #472818.

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
                         * positioned update isn't supported so cursor concurrency is
59
59
                         * read-only
60
60
                         */
61
 
                        mylog("SetStmtOption(): SQL_CONCURRENCY = %d ", vParam);
 
61
                        mylog("SetStmtOption(): SQL_CONCURRENCY = " FORMAT_LEN " ", vParam);
62
62
                        setval = SQL_CONCUR_READ_ONLY;
63
63
                        if (SQL_CONCUR_READ_ONLY == vParam)
64
64
                                ;
80
80
                        }
81
81
                        if (setval != vParam)
82
82
                                changed = TRUE;
83
 
                        mylog("-> %d\n", setval);
 
83
                        mylog("-> " FORMAT_LEN "\n", setval);
84
84
                        break;
85
85
 
86
86
                case SQL_CURSOR_TYPE:
89
89
                         * if declare/fetch, then type can only be forward. otherwise,
90
90
                         * it can only be forward or static.
91
91
                         */
92
 
                        mylog("SetStmtOption(): SQL_CURSOR_TYPE = %d ", vParam);
 
92
                        mylog("SetStmtOption(): SQL_CURSOR_TYPE = " FORMAT_LEN " ", vParam);
93
93
                        setval = SQL_CURSOR_FORWARD_ONLY;
94
94
                        if (ci->drivers.lie)
95
95
                                setval = vParam;
96
96
                        else if (SQL_CURSOR_STATIC == vParam)
97
97
                                setval = vParam;
98
 
                        else if (SQL_CURSOR_KEYSET_DRIVEN == vParam ||
99
 
                                 SQL_CURSOR_DYNAMIC == vParam)
 
98
                        else if (SQL_CURSOR_KEYSET_DRIVEN == vParam)
100
99
                        {
101
100
                                if (0 != (ci->updatable_cursors & ALLOW_KEYSET_DRIVEN_CURSORS)) 
102
101
                                        setval = vParam;
103
102
                                else
104
103
                                        setval = SQL_CURSOR_STATIC; /* at least scrollable */
105
104
                        }
 
105
                        else if (SQL_CURSOR_DYNAMIC == vParam)
 
106
                        {
 
107
                                if (0 != (ci->updatable_cursors & ALLOW_DYNAMIC_CURSORS)) 
 
108
                                        setval = vParam;
 
109
                                else if (0 != (ci->updatable_cursors & ALLOW_KEYSET_DRIVEN_CURSORS)) 
 
110
                                        setval = SQL_CURSOR_KEYSET_DRIVEN;
 
111
                                else
 
112
                                        setval = SQL_CURSOR_STATIC; /* at least scrollable */
 
113
                        }
106
114
                        if (conn)
107
115
                                conn->stmtOptions.cursor_type = (SQLUINTEGER) setval;
108
116
                        else if (stmt)
117
125
                        }
118
126
                        if (setval != vParam)
119
127
                                changed = TRUE;
120
 
                        mylog("-> %d\n", setval);
 
128
                        mylog("-> " FORMAT_LEN "\n", setval);
121
129
                        break;
122
130
 
123
131
                case SQL_KEYSET_SIZE:   /* ignored, but saved and returned      */
124
 
                        mylog("SetStmtOption(): SQL_KEYSET_SIZE, vParam = %d\n", vParam);
 
132
                        mylog("SetStmtOption(): SQL_KEYSET_SIZE, vParam = " FORMAT_LEN "\n", vParam);
125
133
 
126
134
                        if (conn)
127
135
                                conn->stmtOptions.keyset_size = vParam;
137
145
                        break;
138
146
 
139
147
                case SQL_MAX_LENGTH:    /* ignored, but saved */
140
 
                        mylog("SetStmtOption(): SQL_MAX_LENGTH, vParam = %d\n", vParam);
 
148
                        mylog("SetStmtOption(): SQL_MAX_LENGTH, vParam = " FORMAT_LEN "\n", vParam);
141
149
                        if (conn)
142
150
                                conn->stmtOptions.maxLength = vParam;
143
151
                        if (stmt)
151
159
                        break;
152
160
 
153
161
                case SQL_MAX_ROWS:              /* ignored, but saved */
154
 
                        mylog("SetStmtOption(): SQL_MAX_ROWS, vParam = %d\n", vParam);
 
162
                        mylog("SetStmtOption(): SQL_MAX_ROWS, vParam = " FORMAT_LEN "\n", vParam);
155
163
                        if (conn)
156
164
                                conn->stmtOptions.maxRows = vParam;
157
165
                        if (stmt)
165
173
                        break;
166
174
 
167
175
                case SQL_NOSCAN:                /* ignored */
168
 
                        mylog("SetStmtOption: SQL_NOSCAN, vParam = %d\n", vParam);
 
176
                        mylog("SetStmtOption: SQL_NOSCAN, vParam = " FORMAT_LEN "\n", vParam);
169
177
                        break;
170
178
 
171
179
                case SQL_QUERY_TIMEOUT: /* ignored */
172
 
                        mylog("SetStmtOption: SQL_QUERY_TIMEOUT, vParam = %d\n", vParam);
 
180
                        mylog("SetStmtOption: SQL_QUERY_TIMEOUT, vParam = " FORMAT_LEN "\n", vParam);
173
181
                        /* "0" returned in SQLGetStmtOption */
174
182
                        break;
175
183
 
176
184
                case SQL_RETRIEVE_DATA:
177
 
                        mylog("SetStmtOption(): SQL_RETRIEVE_DATA, vParam = %d\n", vParam);
 
185
                        mylog("SetStmtOption(): SQL_RETRIEVE_DATA, vParam = " FORMAT_LEN "\n", vParam);
178
186
                        if (conn)
179
187
                                conn->stmtOptions.retrieve_data = (SQLUINTEGER) vParam;
180
188
                        if (stmt)
182
190
                        break;
183
191
 
184
192
                case SQL_ROWSET_SIZE:
185
 
                        mylog("SetStmtOption(): SQL_ROWSET_SIZE, vParam = %d\n", vParam);
186
 
 
187
 
                        /*
188
 
                         * Save old rowset size for SQLExtendedFetch purposes If the
189
 
                         * rowset_size is being changed since the last call to fetch
190
 
                         * rows.
191
 
                         */
192
 
 
193
 
                        if (stmt && stmt->save_rowset_size <= 0 && stmt->last_fetch_count > 0)
194
 
                                stmt->save_rowset_size = SC_get_ARDF(stmt)->size_of_rowset_odbc2;
 
193
                        mylog("SetStmtOption(): SQL_ROWSET_SIZE, vParam = " FORMAT_LEN "\n", vParam);
195
194
 
196
195
                        if (vParam < 1)
197
196
                        {
307
306
        RETCODE         retval;
308
307
        BOOL            autocomm_on;
309
308
 
310
 
        mylog("%s: entering fOption = %d vParam = %d\n", func, fOption, vParam);
 
309
        mylog("%s: entering fOption = %d vParam = " FORMAT_LEN "\n", func, fOption, vParam);
311
310
        if (!conn)
312
311
        {
313
312
                CC_log_error(func, "", NULL);
384
383
                        else if (!autocomm_on && SQL_AUTOCOMMIT_OFF == ci->autocommit_public)
385
384
                                break;
386
385
                        ci->autocommit_public = (autocomm_on ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF);
387
 
                        mylog("%s: AUTOCOMMIT: transact_status=%d, vparam=%d\n", func, conn->transact_status, vParam);
 
386
                        mylog("%s: AUTOCOMMIT: transact_status=%d, vparam=" FORMAT_LEN "\n", func, conn->transact_status, vParam);
388
387
 
389
388
#ifdef  _HANDLE_ENLIST_IN_DTC_
390
389
                        if (NULL != conn->asdum)
409
408
                case SQL_QUIET_MODE:    /* ignored */
410
409
                        break;
411
410
 
412
 
                case SQL_TXN_ISOLATION: /* ignored */
 
411
                case SQL_TXN_ISOLATION:
413
412
                        retval = SQL_SUCCESS;
414
 
                        if (CC_is_in_trans(conn))
415
 
                        {
416
 
                                CC_set_error(conn, CONN_TRANSACT_IN_PROGRES, "Cannot switch isolation level while a transaction is in progress", func);
417
 
                                return SQL_ERROR;
418
 
                        }
419
413
                        if (conn->isolation == vParam)
420
414
                                break; 
421
415
                        switch (vParam)
450
444
                                char *query;
451
445
                                QResultClass *res;
452
446
 
 
447
                                if (CC_is_in_trans(conn))
 
448
                                {
 
449
                                        if (CC_does_autocommit(conn) && !CC_is_in_error_trans(conn))
 
450
                                                CC_commit(conn);
 
451
                                        else
 
452
                                        {
 
453
                                                CC_set_error(conn, CONN_TRANSACT_IN_PROGRES, "Cannot switch isolation level while a transaction is in progress", func);
 
454
                                                return SQL_ERROR;
 
455
                                        }
 
456
                                }
453
457
                                switch (vParam)
454
458
                                {
455
459
                                        case SQL_TXN_SERIALIZABLE:
494
498
 
495
499
                                CC_set_error(conn, CONN_UNSUPPORTED_OPTION, "Unknown connect option (Set)", func);
496
500
                                sprintf(option, "fOption=%d, vParam=" FORMAT_LEN, fOption, vParam);
 
501
#ifdef  WIN32
497
502
                                if (fOption == 30002 && vParam)
498
503
                                {
499
504
                                        int     cmp;
515
520
                                                return SQL_SUCCESS;
516
521
                                        }
517
522
                                }
 
523
#endif /* WIN32 */
518
524
                                CC_log_error(func, option, conn);
519
525
                                return SQL_ERROR;
520
526
                        }
578
584
                        break;
579
585
 
580
586
                case SQL_QUIET_MODE:    /* NOT SUPPORTED */
581
 
                        *((SQLULEN *) pvParam) = (SQLULEN) NULL;
 
587
                        *((SQLULEN *) pvParam) = 0;
582
588
                        break;
583
589
 
584
590
                case SQL_TXN_ISOLATION: