Commit ae621421 authored by Philippe Pebay's avatar Philippe Pebay
Browse files

PERF: no need to use the index name for PRIMARY KEYs (MySQL ignores it).

parent dbfde864
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#define VTK_MYSQL_DEFAULT_PORT 3306 #define VTK_MYSQL_DEFAULT_PORT 3306
vtkCxxRevisionMacro(vtkMySQLDatabase, "1.22"); vtkCxxRevisionMacro(vtkMySQLDatabase, "1.23");
vtkStandardNewMacro(vtkMySQLDatabase); vtkStandardNewMacro(vtkMySQLDatabase);
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
...@@ -461,12 +461,14 @@ vtkStdString vtkMySQLDatabase::GetIndexSpecification( vtkSQLDatabaseSchema* sche ...@@ -461,12 +461,14 @@ vtkStdString vtkMySQLDatabase::GetIndexSpecification( vtkSQLDatabaseSchema* sche
{ {
skipped = false; skipped = false;
vtkStdString queryStr = ", "; vtkStdString queryStr = ", ";
bool mustUseName = true;
int idxType = schema->GetIndexTypeFromHandle( tblHandle, idxHandle ); int idxType = schema->GetIndexTypeFromHandle( tblHandle, idxHandle );
switch ( idxType ) switch ( idxType )
{ {
case vtkSQLDatabaseSchema::PRIMARY_KEY: case vtkSQLDatabaseSchema::PRIMARY_KEY:
queryStr += "PRIMARY KEY "; queryStr += "PRIMARY KEY ";
mustUseName = false;
break; break;
case vtkSQLDatabaseSchema::UNIQUE: case vtkSQLDatabaseSchema::UNIQUE:
queryStr += "UNIQUE "; queryStr += "UNIQUE ";
...@@ -478,7 +480,11 @@ vtkStdString vtkMySQLDatabase::GetIndexSpecification( vtkSQLDatabaseSchema* sche ...@@ -478,7 +480,11 @@ vtkStdString vtkMySQLDatabase::GetIndexSpecification( vtkSQLDatabaseSchema* sche
return vtkStdString(); return vtkStdString();
} }
// No index_name for PRIMARY KEYs
if ( mustUseName )
{
queryStr += schema->GetIndexNameFromHandle( tblHandle, idxHandle ); queryStr += schema->GetIndexNameFromHandle( tblHandle, idxHandle );
}
queryStr += " ("; queryStr += " (";
// Loop over all column names of the index // Loop over all column names of the index
......
Supports Markdown
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