MCPcopy Create free account
hub / github.com/MariaDB/server / Open

Method Open

storage/connect/odbconn.cpp:1138–1200  ·  view source on GitHub ↗

/ Open: connect to a data source. */ /

Source from the content-addressed store, hash-verified

1136/* Open: connect to a data source. */
1137/***********************************************************************/
1138int ODBConn::Open(PCSZ ConnectString, POPARM sop, DWORD options)
1139 {
1140 PGLOBAL& g = m_G;
1141//ASSERT_VALID(this);
1142//ASSERT(ConnectString == NULL || AfxIsValidString(ConnectString));
1143 ASSERT(!(options & noOdbcDialog && options & forceOdbcDialog));
1144
1145 m_Updatable = !(options & openReadOnly);
1146 m_Connect = ConnectString;
1147 m_User = sop->User;
1148 m_Pwd = sop->Pwd;
1149 m_LoginTimeout = sop->Cto;
1150 m_QueryTimeout = sop->Qto;
1151 m_UseCnc = sop->UseCnc;
1152
1153 // Allocate the HDBC and make connection
1154 try {
1155 /*PSZ ver;*/
1156
1157 AllocConnect(options);
1158 /*ver = GetStringInfo(SQL_ODBC_VER);*/
1159
1160 if (!m_UseCnc) {
1161 if (DriverConnect(options)) {
1162 snprintf(g->Message, sizeof(g->Message), MSG(CONNECT_CANCEL));
1163 return 0;
1164 } // endif
1165
1166 } else // Connect using SQLConnect
1167 Connect();
1168
1169 /*********************************************************************/
1170 /* Link a Fblock. This make possible to automatically close it */
1171 /* in case of error (throw). */
1172 /*********************************************************************/
1173 PDBUSER dbuserp = (PDBUSER)g->Activityp->Aptr;
1174
1175 m_Fp = (PFBLOCK)PlugSubAlloc(g, NULL, sizeof(FBLOCK));
1176 m_Fp->Type = TYPE_FB_ODBC;
1177 m_Fp->Fname = NULL;
1178 m_Fp->Next = dbuserp->Openlist;
1179 dbuserp->Openlist = m_Fp;
1180 m_Fp->Count = 1;
1181 m_Fp->Length = 0;
1182 m_Fp->Memory = NULL;
1183 m_Fp->Mode = MODE_ANY;
1184 m_Fp->File = this;
1185 m_Fp->Handle = 0;
1186
1187 /*ver = GetStringInfo(SQL_DRIVER_ODBC_VER);*/
1188 // Verify support for required functionality and cache info
1189// VerifyConnect(); Deprecated
1190 GetConnectInfo();
1191 // Still we want to use the set QChar
1192 } catch(DBX *xp) {
1193 snprintf(g->Message, sizeof(g->Message), "%s: %s", xp->m_Msg, xp->GetErrorMessage(0));
1194 Close();
1195// Free();

Callers 7

ODBCCheckConnectionFunction · 0.45
ODBCColumnsFunction · 0.45
ODBCSrcColsFunction · 0.45
MyODBCColsFunction · 0.45
ODBCTablesFunction · 0.45
ODBCPrimaryKeysFunction · 0.45
ODBCStatisticsFunction · 0.45

Calls 3

PlugSubAllocFunction · 0.85
CloseFunction · 0.85
GetErrorMessageMethod · 0.80

Tested by

no test coverage detected