Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite171647

Browse files
author
Hiroshi Inoue
committed
Add files for Unicode support.
1 parent8f0a9e8 commite171647

File tree

6 files changed

+1392
-0
lines changed

6 files changed

+1392
-0
lines changed

‎src/interfaces/odbc/connection.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ struct ConnectionClass_
266266
Int2pg_version_major;
267267
Int2pg_version_minor;
268268
charms_jet;
269+
charunicode;
269270
#ifdefMULTIBYTE
270271
char*client_encoding;
271272
char*server_encoding;

‎src/interfaces/odbc/odbcapi25w.c

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*-------
2+
* Module:odbcapi25w.c
3+
*
4+
* Description:This module contains UNICODE routines
5+
*
6+
* Classes:n/a
7+
*
8+
* API functions:SQLColAttributesW, SQLErrorW, SQLGetConnectOptionW,
9+
SQLSetConnectOptionW
10+
*-------
11+
*/
12+
13+
#include"psqlodbc.h"
14+
#include<stdio.h>
15+
#include<string.h>
16+
17+
#include"pgapifunc.h"
18+
#include"connection.h"
19+
#include"statement.h"
20+
21+
RETCODESQL_APISQLErrorW(HENVEnvironmentHandle,
22+
HDBCConnectionHandle,HSTMTStatementHandle,
23+
SQLWCHAR*Sqlstate,SQLINTEGER*NativeError,
24+
SQLWCHAR*MessageText,SQLSMALLINTBufferLength,
25+
SQLSMALLINT*TextLength)
26+
{
27+
RETCODEret;
28+
SWORDtlen;
29+
char*qst=NULL,*mtxt=NULL;
30+
31+
mylog("[SQLErrorW]");
32+
if (Sqlstate)
33+
qst=malloc(8);
34+
if (MessageText)
35+
mtxt=malloc(BufferLength);
36+
ret=PGAPI_Error(EnvironmentHandle,ConnectionHandle,StatementHandle,
37+
qst,NativeError,mtxt,BufferLength,&tlen);
38+
if (qst)
39+
utf8_to_ucs2(qst,strlen(qst),Sqlstate,5);
40+
if (TextLength)
41+
*TextLength=utf8_to_ucs2(mtxt,tlen,MessageText,BufferLength);
42+
free(qst);
43+
free(mtxt);
44+
returnret;
45+
}
46+
47+
RETCODESQL_APISQLGetConnectOptionW(HDBCConnectionHandle,
48+
SQLUSMALLINTOption,PTRValue)
49+
{
50+
mylog("[SQLGetConnectOptionW]");
51+
((ConnectionClass*)ConnectionHandle)->unicode=1;
52+
returnPGAPI_GetConnectOption(ConnectionHandle,Option,Value);
53+
}
54+
55+
RETCODESQL_APISQLSetConnectOptionW(HDBCConnectionHandle,
56+
SQLUSMALLINTOption,SQLUINTEGERValue)
57+
{
58+
mylog("[SQLSetConnectionOptionW]");
59+
((ConnectionClass*)ConnectionHandle)->unicode=1;
60+
returnPGAPI_SetConnectOption(ConnectionHandle,Option,Value);
61+
}
62+
63+
RETCODESQL_APISQLColAttributesW(
64+
HSTMThstmt,
65+
SQLUSMALLINTicol,
66+
SQLUSMALLINTfDescType,
67+
PTRrgbDesc,
68+
SQLSMALLINTcbDescMax,
69+
SQLSMALLINT*pcbDesc,
70+
SQLINTEGER*pfDesc)
71+
{
72+
mylog("[SQLColAttributesW]");
73+
returnPGAPI_ColAttributes(hstmt,icol,fDescType,rgbDesc,
74+
cbDescMax,pcbDesc,pfDesc);
75+
}

‎src/interfaces/odbc/odbcapi30w.c

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
/*-------
2+
* Module:odbcapi30w.c
3+
*
4+
* Description:This module contains UNICODE routines
5+
*
6+
* Classes:n/a
7+
*
8+
* API functions:SQLColAttributeW, SQLGetStmtW, SQLSetStmtW,
9+
SQLSetConnectAttrW, SQLGetConnectAttrW,
10+
SQLGetDescFieldW, SQLGetDescRecW, SQLGetDiagFieldW,
11+
SQLGetDiagRecW,
12+
*-------
13+
*/
14+
15+
#include"psqlodbc.h"
16+
#include<stdio.h>
17+
#include<string.h>
18+
19+
#include"pgapifunc.h"
20+
#include"connection.h"
21+
#include"statement.h"
22+
23+
24+
RETCODESQL_APISQLGetStmtAttrW(SQLHSTMThstmt,
25+
SQLINTEGERfAttribute,
26+
PTRrgbValue,
27+
SQLINTEGERcbValueMax,
28+
SQLINTEGER*pcbValue)
29+
{
30+
RETCODEret;
31+
32+
mylog("[SQLGetStmtAttrW]");
33+
ret=PGAPI_GetStmtAttr(hstmt,fAttribute,rgbValue,
34+
cbValueMax,pcbValue);
35+
returnret;
36+
}
37+
38+
RETCODESQL_APISQLSetStmtAttrW(SQLHSTMThstmt,
39+
SQLINTEGERfAttribute,
40+
PTRrgbValue,
41+
SQLINTEGERcbValueMax)
42+
{
43+
RETCODEret;
44+
45+
mylog("[SQLSetStmtAttrW]");
46+
ret=PGAPI_SetStmtAttr(hstmt,fAttribute,rgbValue,
47+
cbValueMax);
48+
returnret;
49+
}
50+
51+
RETCODESQL_APISQLGetConnectAttrW(HDBChdbc,
52+
SQLINTEGERfAttribute,
53+
PTRrgbValue,
54+
SQLINTEGERcbValueMax,
55+
SQLINTEGER*pcbValue)
56+
{
57+
RETCODEret;
58+
59+
mylog("[SQLGetConnectAttrW]");
60+
ret=PGAPI_GetConnectAttr(hdbc,fAttribute,rgbValue,
61+
cbValueMax,pcbValue);
62+
returnret;
63+
}
64+
65+
RETCODESQL_APISQLSetConnectAttrW(HDBChdbc,
66+
SQLINTEGERfAttribute,
67+
PTRrgbValue,
68+
SQLINTEGERcbValue)
69+
{
70+
RETCODEret;
71+
72+
mylog("[SQLSetConnectAttrW]");
73+
ret=PGAPI_SetConnectAttr(hdbc,fAttribute,rgbValue,
74+
cbValue);
75+
returnret;
76+
}
77+
78+
RETCODESQL_APISQLGetDiagRecW(SWORDfHandleType,
79+
SQLHANDLEhandle,
80+
SQLSMALLINTiRecord,
81+
SQLWCHAR*szSqlState,
82+
SQLINTEGER*pfNativeError,
83+
SQLWCHAR*szErrorMsg,
84+
SQLSMALLINTcbErrorMsgMax,
85+
SQLSMALLINT*pcbErrorMsg)
86+
{
87+
RETCODEret;
88+
SWORDtlen;
89+
char*qst=NULL,*mtxt=NULL;
90+
91+
mylog("[SQLGetDiagRecW]");
92+
if (szSqlState)
93+
qst=malloc(8);
94+
if (szErrorMsg)
95+
mtxt=malloc(cbErrorMsgMax);
96+
ret=PGAPI_GetDiagRec(fHandleType,handle,iRecord,qst,
97+
pfNativeError,mtxt,cbErrorMsgMax,&tlen);
98+
if (qst)
99+
utf8_to_ucs2(qst,strlen(qst),szSqlState,5);
100+
if (pcbErrorMsg)
101+
*pcbErrorMsg=utf8_to_ucs2(mtxt,tlen,szErrorMsg,cbErrorMsgMax);
102+
free(qst);
103+
free(mtxt);
104+
returnret;
105+
}
106+
107+
RETCODESQL_APISQLColAttributeW(
108+
HSTMThstmt,
109+
SQLUSMALLINTicol,
110+
SQLUSMALLINTfDescType,
111+
PTRrgbDesc,
112+
SQLSMALLINTcbDescMax,
113+
SQLSMALLINT*pcbDesc,
114+
SQLINTEGER*pfDesc)
115+
{
116+
RETCODEret;
117+
118+
mylog("[SQLColAttributeW]");
119+
ret=PGAPI_ColAttributes(hstmt,icol,fDescType,rgbDesc,
120+
cbDescMax,pcbDesc,pfDesc);
121+
returnret;
122+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp