Commit 4a262f0d 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 35b72683
...@@ -1202,9 +1202,16 @@ PIXDEF ha_connect::GetIndexInfo(int n) ...@@ -1202,9 +1202,16 @@ PIXDEF ha_connect::GetIndexInfo(int n)
kpp= new(g) KPARTDEF(name, k + 1); kpp= new(g) KPARTDEF(name, k + 1);
kpp->SetKlen(kp.key_part[k].length); kpp->SetKlen(kp.key_part[k].length);
// Index on auto increment column is an XXROW index #if 0 // NIY
if (kp.key_part[k].field->flags & AUTO_INCREMENT_FLAG && kp.key_parts == 1) // Index on auto increment column can be an XXROW index
xdp->SetAuto(true); 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) if (pkp)
pkp->SetNext(kpp); pkp->SetNext(kpp);
...@@ -2197,6 +2204,16 @@ int ha_connect::write_row(uchar *buf) ...@@ -2197,6 +2204,16 @@ int ha_connect::write_row(uchar *buf)
if (tdbp->GetMode() == MODE_ANY) if (tdbp->GetMode() == MODE_ANY)
DBUG_RETURN(0); 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 // Set column values from the passed pseudo record
if ((rc= ScanRecord(g, buf))) if ((rc= ScanRecord(g, buf)))
DBUG_RETURN(rc); DBUG_RETURN(rc);
...@@ -4030,6 +4047,13 @@ int ha_connect::create(const char *name, TABLE *table_arg, ...@@ -4030,6 +4047,13 @@ int ha_connect::create(const char *name, TABLE *table_arg,
continue; // This is a virtual column continue; // This is a virtual column
#endif // MARIADB #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()) { switch (fp->type()) {
case MYSQL_TYPE_SHORT: case MYSQL_TYPE_SHORT:
case MYSQL_TYPE_LONG: case MYSQL_TYPE_LONG:
......
...@@ -134,7 +134,8 @@ class ha_connect: public handler ...@@ -134,7 +134,8 @@ class ha_connect: public handler
ulonglong table_flags() const ulonglong table_flags() const
{ {
return (HA_NO_TRANSACTIONS | HA_REC_NOT_IN_SEQ | HA_HAS_RECORDS | 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) #if defined(MARIADB)
HA_CAN_VIRTUAL_COLUMNS | HA_CAN_VIRTUAL_COLUMNS |
#endif // MARIADB #endif // MARIADB
......
...@@ -164,6 +164,7 @@ bool IsTypeNullable(TABTYPE type) ...@@ -164,6 +164,7 @@ bool IsTypeNullable(TABTYPE type)
switch (type) { switch (type) {
case TAB_ODBC: case TAB_ODBC:
case TAB_MYSQL: case TAB_MYSQL:
case TAB_TBL:
case TAB_INI: case TAB_INI:
case TAB_XML: case TAB_XML:
nullable= true; nullable= true;
...@@ -176,6 +177,28 @@ bool IsTypeNullable(TABTYPE type) ...@@ -176,6 +177,28 @@ bool IsTypeNullable(TABTYPE type)
return nullable; return nullable;
} // end of IsTypeNullable } // 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. */ /* Get a unique enum catalog function ID. */
/***********************************************************************/ /***********************************************************************/
......
...@@ -37,6 +37,7 @@ typedef class ha_connect *PHC; ...@@ -37,6 +37,7 @@ typedef class ha_connect *PHC;
TABTYPE GetTypeID(const char *type); TABTYPE GetTypeID(const char *type);
bool IsFileType(TABTYPE type); bool IsFileType(TABTYPE type);
bool IsTypeNullable(TABTYPE type); bool IsTypeNullable(TABTYPE type);
bool IsTypeFixed(TABTYPE type);
uint GetFuncID(const char *func); 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