mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Fix problems with ODBC raised by Adding the type TYPE_BIGINT (longlong).
This commit is contained in:
@@ -162,8 +162,8 @@ PQRYRES MyODBCCols(PGLOBAL g, char *tab, char *dsn);
|
||||
#if defined(MYSQL_SUPPORT)
|
||||
PQRYRES MyColumns(PGLOBAL g, char *host, char *db, char *user, char *pwd,
|
||||
char *table, char *colpat, int port, bool key);
|
||||
enum enum_field_types PLGtoMYSQL(int type, bool gdf);
|
||||
#endif // MYSQL_SUPPORT
|
||||
enum enum_field_types PLGtoMYSQL(int type, bool gdf);
|
||||
#if defined(WIN32)
|
||||
PQRYRES WMIColumns(PGLOBAL g, char *nsp, char *classname, PWMIUT wp= NULL);
|
||||
#endif // WIN32
|
||||
|
@@ -48,6 +48,8 @@ int MYSQLtoPLG(char *typname)
|
||||
!stricmp(typname, "time") || !stricmp(typname, "timestamp") ||
|
||||
!stricmp(typname, "year"))
|
||||
type = TYPE_DATE;
|
||||
else if (!stricmp(typname, "bigint") || !stricmp(typname, "longlong"))
|
||||
type = TYPE_BIGINT;
|
||||
else
|
||||
type = TYPE_ERROR;
|
||||
|
||||
@@ -77,6 +79,9 @@ enum enum_field_types PLGtoMYSQL(int type, bool gdf)
|
||||
case TYPE_STRING:
|
||||
mytype = MYSQL_TYPE_VARCHAR;
|
||||
break;
|
||||
case TYPE_BIGINT:
|
||||
mytype = MYSQL_TYPE_LONGLONG;
|
||||
break;
|
||||
default:
|
||||
mytype = MYSQL_TYPE_NULL;
|
||||
} // endswitch mytype
|
||||
|
@@ -219,8 +219,8 @@ PQRYRES ODBCColumns(PGLOBAL g, ODBConn *op, char *dsn, char *table,
|
||||
/**************************************************************************/
|
||||
PQRYRES MyODBCCols(PGLOBAL g, char *tab, char *dsn)
|
||||
{
|
||||
int n;
|
||||
PCOLRES crp;
|
||||
int type, len, prec;
|
||||
PCOLRES crpt, crpl, crpp;
|
||||
PQRYRES qrp;
|
||||
ODBConn *ocp = new(g) ODBConn(g, NULL);
|
||||
|
||||
@@ -247,14 +247,28 @@ PQRYRES MyODBCCols(PGLOBAL g, char *tab, char *dsn)
|
||||
/* Keep only the info used by ha_connect::pre_create. */
|
||||
/************************************************************************/
|
||||
qrp->Colresp = qrp->Colresp->Next->Next; // Skip Owner and Table names
|
||||
crp = qrp->Colresp->Next; // DB type
|
||||
|
||||
// Types must be PLG types, not SQL types
|
||||
for (int i = 0; i < qrp->Nblin; i++)
|
||||
crp->Kdata->SetValue(TranslateSQLType(crp->Kdata->GetIntValue(i),0,n),i);
|
||||
crpt = qrp->Colresp->Next; // SQL type
|
||||
crpl = crpt->Next->Next; // Length
|
||||
crpp = crpl->Next->Next; // Decimals
|
||||
|
||||
crp = crp->Next->Next->Next->Next; // Should be Radix
|
||||
crp->Next = crp->Next->Next->Next; // Should be Remark
|
||||
for (int i = 0; i < qrp->Nblin; i++) {
|
||||
// Types must be PLG types, not SQL types
|
||||
type = crpt->Kdata->GetIntValue(i);
|
||||
len = crpl->Kdata->GetIntValue(i);
|
||||
prec = crpp->Kdata->GetIntValue(i);
|
||||
type = TranslateSQLType(type, prec, len);
|
||||
crpt->Kdata->SetValue(type, i);
|
||||
|
||||
// Some data sources do not count prec in length
|
||||
if (type == TYPE_FLOAT)
|
||||
len += (prec + 2); // To be safe
|
||||
|
||||
// Could have been changed for blobs or numeric
|
||||
crpl->Kdata->SetValue(len, i);
|
||||
} // endfor i
|
||||
|
||||
crpp->Next = crpp->Next->Next->Next; // Should be Remark
|
||||
qrp->Nbcol = 7; // Was 11, skipped 4
|
||||
return qrp;
|
||||
} // end of MyODBCCols
|
||||
|
@@ -210,7 +210,7 @@ short GetSQLType(int type)
|
||||
case TYPE_SHORT: tp = SQL_SMALLINT; break;
|
||||
case TYPE_INT: tp = SQL_INTEGER; break;
|
||||
case TYPE_DATE: tp = SQL_TIMESTAMP; break;
|
||||
case TYPE_BIGINT:
|
||||
case TYPE_BIGINT: tp = SQL_BIGINT; break; // (-5)
|
||||
case TYPE_FLOAT: tp = SQL_DOUBLE; break;
|
||||
} // endswitch type
|
||||
|
||||
@@ -229,7 +229,7 @@ int GetSQLCType(int type)
|
||||
case TYPE_SHORT: tp = SQL_C_SHORT; break;
|
||||
case TYPE_INT: tp = SQL_C_LONG; break;
|
||||
case TYPE_DATE: tp = SQL_C_TIMESTAMP; break;
|
||||
case TYPE_BIGINT:
|
||||
case TYPE_BIGINT: tp = SQL_C_SBIGINT; break;
|
||||
case TYPE_FLOAT: tp = SQL_C_DOUBLE; break;
|
||||
} // endswitch type
|
||||
|
||||
|
Reference in New Issue
Block a user