Commit 7e7d3ce5 authored by Olivier Bertrand's avatar Olivier Bertrand

- Block creating tables with auto_incremented colummns (not supported)

  + allow nullable columns for TBL tables

modified:
  storage/connect/ha_connect.cc
  storage/connect/ha_connect.h
  storage/connect/mycat.cc
  storage/connect/mycat.h
parent 115a373b
......@@ -1202,9 +1202,16 @@ PIXDEF ha_connect::GetIndexInfo(int n)
kpp= new(g) KPARTDEF(name, k + 1);
kpp->SetKlen(kp.key_part[k].length);
// Index on auto increment column is an XXROW index
if (kp.key_part[k].field->flags & AUTO_INCREMENT_FLAG && kp.key_parts == 1)
xdp->SetAuto(true);
#if 0 // NIY
// Index on auto increment column can be an XXROW index
if (kp.key_part[k].field->flags & AUTO_INCREMENT_FLAG &&
kp.key_parts == 1) {
char *type= GetStringOption("Type", "DOS");
TABTYPE typ= GetTypeID(type);
xdp->SetAuto(IsTypeFixed(typ));
} // endif AUTO_INCREMENT
#endif // 0
if (pkp)
pkp->SetNext(kpp);
......@@ -2197,6 +2204,16 @@ int ha_connect::write_row(uchar *buf)
if (tdbp->GetMode() == MODE_ANY)
DBUG_RETURN(0);
#if 0 // AUTO_INCREMENT NIY
if (table->next_number_field && buf == table->record[0]) {
int error;
if ((error= update_auto_increment()))
return error;
} // endif nex_number_field
#endif // 0
// Set column values from the passed pseudo record
if ((rc= ScanRecord(g, buf)))
DBUG_RETURN(rc);
......@@ -4030,6 +4047,13 @@ int ha_connect::create(const char *name, TABLE *table_arg,
continue; // This is a virtual column
#endif // MARIADB
if (fp->flags & AUTO_INCREMENT_FLAG) {
strcpy(g->Message, "Auto_increment is not supported yet");
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
rc= HA_ERR_INTERNAL_ERROR;
DBUG_RETURN(rc);
} // endif flags
switch (fp->type()) {
case MYSQL_TYPE_SHORT:
case MYSQL_TYPE_LONG:
......
......@@ -134,7 +134,8 @@ class ha_connect: public handler
ulonglong table_flags() const
{
return (HA_NO_TRANSACTIONS | HA_REC_NOT_IN_SEQ | HA_HAS_RECORDS |
/*HA_NO_AUTO_INCREMENT |*/ HA_NO_PREFIX_CHAR_KEYS |
HA_NO_AUTO_INCREMENT | HA_NO_PREFIX_CHAR_KEYS |
HA_NO_COPY_ON_ALTER |
#if defined(MARIADB)
HA_CAN_VIRTUAL_COLUMNS |
#endif // MARIADB
......
......@@ -164,6 +164,7 @@ bool IsTypeNullable(TABTYPE type)
switch (type) {
case TAB_ODBC:
case TAB_MYSQL:
case TAB_TBL:
case TAB_INI:
case TAB_XML:
nullable= true;
......@@ -176,6 +177,28 @@ bool IsTypeNullable(TABTYPE type)
return nullable;
} // end of IsTypeNullable
/***********************************************************************/
/* Return true for table types with fix length records. */
/***********************************************************************/
bool IsTypeFixed(TABTYPE type)
{
bool fix;
switch (type) {
case TAB_FIX:
case TAB_BIN:
case TAB_VEC:
// case TAB_DBF: ???
fix= true;
break;
default:
fix= false;
break;
} // endswitch type
return fix;
} // end of IsTypeFixed
/***********************************************************************/
/* Get a unique enum catalog function ID. */
/***********************************************************************/
......
......@@ -37,6 +37,7 @@ typedef class ha_connect *PHC;
TABTYPE GetTypeID(const char *type);
bool IsFileType(TABTYPE type);
bool IsTypeNullable(TABTYPE type);
bool IsTypeFixed(TABTYPE type);
uint GetFuncID(const char *func);
/***********************************************************************/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment