Psqlodbc and Centura: here it is a patch

Поиск
Список
Период
Сортировка
От Matteo Cavalleri
Тема Psqlodbc and Centura: here it is a patch
Дата
Msg-id 3A92AA7B.26052.1D931CD@localhost
обсуждение исходный текст
Список pgsql-odbc
First of all I have to thank Byron for the very well written source
code ,
clearness and elegance. Looking that sources has been a pleasure!

[Small note for Centura users:  In order to use PostgreSQL and
Centura
TEAM developer you need to set up the configuration file DCC.INI
matching
each data type provided by the ODBC driver with each data type
available
in the Centura environment.] After configuring DCC.INI a simple
select
works well. But if you use a function in the select clause and you
put a
parameter into the where clause you will get the error:

PostgreSQL:3No query has been assigned to this statement.;

Tracking mylog file, I saw that centura calls SQLDescribeCols
before
SQLBindParameter.  I am not an ODBC wizard (and I don’t know a
bit of
Centura but I need to convince a friend to use PostgreSQL:-)! and
this
seems to cause some troubles.

If SQLDescribeCol has to work on simple fields of the working table
the
work can be done and there are no errors. If  SQLDescribe has to
work on
some computations (eg. a to_char() conversion or a + operator) ,
the
select must be evaluated. In this case, if is there a parameter in the
where clause (still unBinded) , the error comes up.

So here it is a patch for this. The unBinded parameters are
temporary set
to NULL, permitting SQLDescribeCol to run. This behavior can be
enabled/disabled clicking in the new check box named "Set
unBinded Params
to NULLs". The default is false.

I don't know if the problem will come with other app builders.
(I hope the patch could be applyed before any other modifications
on the
source code. For any problem you can contact me to { HYPERLINK
mailto:theos@bp.lnf.it }theos@bp.lnf.it )

Best Regards



Matteo Cavalleri
IRCCS E.Medea
Bioengineering Lab.
Via D.L.Monza 20
23842 Bosisio Parini (LC) - ITALY
Tel. +39-031-877274 / 111
Fax +39-031-877499

diff --ignore-space-change orig/convert.c newvs6/convert.c
690c690,696
<             break;
---
>                 if (globals.use_nulloutvalues)
>                         {
>                         mylog ("Putting NULL in the %d parameter for a little time...\n", param_number);
>                         strcpy(&new_statement[npos],"NULL");
>                         npos+=4;
>                         continue;
>                         } else break;
diff --ignore-space-change orig/dlg_specific.c newvs6/dlg_specific.c
93a94,95
>         CheckDlgButton(hdlg, DRV_NULLOUTVALUES, globals.use_nulloutvalues);
>
137a140
>                     globals.use_nulloutvalues = IsDlgButtonChecked(hdlg, DRV_NULLOUTVALUES);
180a184
>                         CheckDlgButton(hdlg, DRV_NULLOUTVALUES, DEFAULT_NULLOUTVALUES);
421a426
>
710a716,723
>     //    NullOutValues is stored in the driver section only
>     SQLGetPrivateProfileString(section, INI_NULLOUTVALUES, "",
>                 temp, sizeof(temp), filename);
>     if ( temp[0] )
>         globals.use_nulloutvalues = atoi(temp);
>     else if ( ! override)
>         globals.use_nulloutvalues = DEFAULT_NULLOUTVALUES;
>
827a841,844
>
>     sprintf(tmp, "%d", globals.use_nulloutvalues);
>     SQLWritePrivateProfileString(DBMS_NAME,
>         INI_NULLOUTVALUES, tmp, ODBCINST_INI);
diff --ignore-space-change orig/dlg_specific.h newvs6/dlg_specific.h
80a81
> #define INI_NULLOUTVALUES            "Out-of-range parameters as NULLs (Centura)"
95a97
> #define DEFAULT_NULLOUTVALUES            0
diff --ignore-space-change orig/psqlodbc.h newvs6/psqlodbc.h
131a132
>     char                use_nulloutvalues;
diff --ignore-space-change orig/psqlodbc.rc newvs6/psqlodbc.rc
85c85
< DLG_OPTIONS_DRV DIALOG DISCARDABLE  0, 0, 287, 226
---
> DLG_OPTIONS_DRV DIALOG DISCARDABLE  0, 0, 288, 246
106c106
<     GROUPBOX        "Unknown Sizes",IDC_STATIC,10,65,175,25
---
>     GROUPBOX        "Unknown Sizes",IDC_STATIC,10,86,175,25
108c108
<                     WS_GROUP | WS_TABSTOP,15,76,45,10
---
>                     WS_GROUP | WS_TABSTOP,15,96,45,10
110c110
<                     BS_AUTORADIOBUTTON | WS_TABSTOP,70,76,53,10
---
>                     BS_AUTORADIOBUTTON | WS_TABSTOP,70,96,53,10
112,113c112,113
<                     BS_AUTORADIOBUTTON | WS_TABSTOP,130,76,50,10
<     GROUPBOX        "Data Type Options",IDC_STATIC,10,95,270,25
---
>                     BS_AUTORADIOBUTTON | WS_TABSTOP,130,96,50,10
>     GROUPBOX        "Data Type Options",IDC_STATIC,11,116,270,25
115c115
<                     BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,15,105,80,10
---
>                     BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,15,126,80,10
117c117
<                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,105,105,100,10
---
>                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,105,126,100,10
119,129c119,129
<                     WS_TABSTOP,215,105,60,10
<     LTEXT           "&Cache Size:",IDC_STATIC,10,130,40,10
<     EDITTEXT        DRV_CACHE_SIZE,50,130,35,12,ES_AUTOHSCROLL
<     LTEXT           "Max &Varchar:",IDC_STATIC,90,130,45,10
<     EDITTEXT        DRV_VARCHAR_SIZE,135,130,35,12,ES_AUTOHSCROLL
<     LTEXT           "Max Lon&gVarChar:",IDC_STATIC,180,130,60,10
<     EDITTEXT        DRV_LONGVARCHAR_SIZE,240,130,35,12,ES_AUTOHSCROLL
<     LTEXT           "SysTable &Prefixes:",IDC_STATIC,15,145,35,20
<     EDITTEXT        DRV_EXTRASYSTABLEPREFIXES,50,151,75,12,ES_AUTOHSCROLL
<     RTEXT           "Connect &Settings:",IDC_STATIC,10,170,35,20
<     EDITTEXT        DRV_CONNSETTINGS,50,170,225,25,ES_MULTILINE |
---
>                     WS_TABSTOP,215,126,60,10
>     LTEXT           "&Cache Size:",IDC_STATIC,10,151,40,10
>     EDITTEXT        DRV_CACHE_SIZE,50,151,35,12,ES_AUTOHSCROLL
>     LTEXT           "Max &Varchar:",IDC_STATIC,90,151,45,10
>     EDITTEXT        DRV_VARCHAR_SIZE,135,151,35,12,ES_AUTOHSCROLL
>     LTEXT           "Max Lon&gVarChar:",IDC_STATIC,180,151,60,10
>     EDITTEXT        DRV_LONGVARCHAR_SIZE,240,151,35,12,ES_AUTOHSCROLL
>     LTEXT           "SysTable &Prefixes:",IDC_STATIC,15,166,35,20
>     EDITTEXT        DRV_EXTRASYSTABLEPREFIXES,50,172,75,12,ES_AUTOHSCROLL
>     RTEXT           "Connect &Settings:",IDC_STATIC,10,191,35,20
>     EDITTEXT        DRV_CONNSETTINGS,50,191,225,25,ES_MULTILINE |
131,133c131,135
<     DEFPUSHBUTTON   "OK",IDOK,45,205,50,14,WS_GROUP
<     PUSHBUTTON      "Cancel",IDCANCEL,115,205,50,14
<     PUSHBUTTON      "Defaults",IDDEFAULTS,185,205,50,15
---
>     DEFPUSHBUTTON   "OK",IDOK,45,225,50,14,WS_GROUP
>     PUSHBUTTON      "Cancel",IDCANCEL,115,225,50,14
>     PUSHBUTTON      "Defaults",IDDEFAULTS,183,224,50,15
>     CONTROL         "Set UnBinded Params to NULLs",DRV_NULLOUTVALUES,"Button",
>                     BS_AUTOCHECKBOX | WS_TABSTOP,15,66,116,12
183c185
<         RIGHTMARGIN, 280
---
>         RIGHTMARGIN, 281
185c187
<         BOTTOMMARGIN, 219
---
>         BOTTOMMARGIN, 239
diff --ignore-space-change orig/resource.h newvs6/resource.h
51a52
> #define DRV_NULLOUTVALUES               1059
59c60
< #define _APS_NEXT_CONTROL_VALUE         1060
---
> #define _APS_NEXT_CONTROL_VALUE         1061
Binary files orig/psqlodbc.aps and newvs6/psqlodbc.aps differ
Binary files orig/psqlodbc.ncb and newvs6/psqlodbc.ncb differ

В списке pgsql-odbc по дате отправления:

Предыдущее
От: "Ross J. Reedstrom"
Дата:
Сообщение: Re: Strange behaviour with Autocad/ODBC
Следующее
От: "Andrea Aime"
Дата:
Сообщение: Re: Strange behaviour with Autocad/ODBC