Commit 8b8f17dd authored by marty@linux.site's avatar marty@linux.site

Hide internal unique index naming

parent 2e714857
...@@ -143,7 +143,7 @@ int main() ...@@ -143,7 +143,7 @@ int main()
if (myTransaction == NULL) APIERROR(myNdb->getNdbError()); if (myTransaction == NULL) APIERROR(myNdb->getNdbError());
NdbIndexOperation *myIndexOperation= NdbIndexOperation *myIndexOperation=
myTransaction->getNdbIndexOperation("MYINDEXNAME$unique","MYTABLENAME"); myTransaction->getNdbIndexOperation("MYINDEXNAME","MYTABLENAME");
if (myIndexOperation == NULL) APIERROR(myTransaction->getNdbError()); if (myIndexOperation == NULL) APIERROR(myTransaction->getNdbError());
myIndexOperation->readTuple(NdbOperation::LM_Read); myIndexOperation->readTuple(NdbOperation::LM_Read);
...@@ -166,7 +166,7 @@ int main() ...@@ -166,7 +166,7 @@ int main()
if (myTransaction == NULL) APIERROR(myNdb->getNdbError()); if (myTransaction == NULL) APIERROR(myNdb->getNdbError());
NdbIndexOperation *myIndexOperation= NdbIndexOperation *myIndexOperation=
myTransaction->getNdbIndexOperation("MYINDEXNAME$unique", "MYTABLENAME"); myTransaction->getNdbIndexOperation("MYINDEXNAME", "MYTABLENAME");
if (myIndexOperation == NULL) APIERROR(myTransaction->getNdbError()); if (myIndexOperation == NULL) APIERROR(myTransaction->getNdbError());
myIndexOperation->updateTuple(); myIndexOperation->updateTuple();
...@@ -187,7 +187,7 @@ int main() ...@@ -187,7 +187,7 @@ int main()
if (myTransaction == NULL) APIERROR(myNdb->getNdbError()); if (myTransaction == NULL) APIERROR(myNdb->getNdbError());
NdbIndexOperation *myIndexOperation= NdbIndexOperation *myIndexOperation=
myTransaction->getNdbIndexOperation("MYINDEXNAME$unique", "MYTABLENAME"); myTransaction->getNdbIndexOperation("MYINDEXNAME", "MYTABLENAME");
if (myIndexOperation == NULL) APIERROR(myTransaction->getNdbError()); if (myIndexOperation == NULL) APIERROR(myTransaction->getNdbError());
myIndexOperation->deleteTuple(); myIndexOperation->deleteTuple();
......
...@@ -1076,15 +1076,15 @@ NdbTransaction::getNdbScanOperation(const char* aTableName) ...@@ -1076,15 +1076,15 @@ NdbTransaction::getNdbScanOperation(const char* aTableName)
}//NdbTransaction::getNdbScanOperation() }//NdbTransaction::getNdbScanOperation()
/***************************************************************************** /*****************************************************************************
NdbScanOperation* getNdbScanOperation(const char* anIndexName, const char* aTableName); NdbScanOperation* getNdbIndexScanOperation(const char* anIndexName, const char* aTableName);
Return Value Return a pointer to a NdbScanOperation object if getNdbScanOperation was succesful. Return Value Return a pointer to a NdbIndexScanOperation object if getNdbIndexScanOperation was succesful.
Return NULL : In all other case. Return NULL : In all other case.
Parameters: anIndexName : Name of the index to use. Parameters: anIndexName : Name of the index to use.
aTableName : Name of the database table. aTableName : Name of the database table.
Remark: Get an operation from NdbScanOperation idlelist and get the NdbTransaction object Remark: Get an operation from NdbIndexScanOperation idlelist and get the NdbTransaction object
who was fetch by startTransaction pointing to this operation who was fetch by startTransaction pointing to this operation
getOperation will set the theTableId in the NdbOperation object.synchronous getOperation will set the theTableId in the NdbIndexScanOperation object.synchronous
******************************************************************************/ ******************************************************************************/
NdbIndexScanOperation* NdbIndexScanOperation*
NdbTransaction::getNdbIndexScanOperation(const char* anIndexName, NdbTransaction::getNdbIndexScanOperation(const char* anIndexName,
...@@ -1134,12 +1134,12 @@ NdbTransaction::getNdbIndexScanOperation(const NdbDictionary::Index * index, ...@@ -1134,12 +1134,12 @@ NdbTransaction::getNdbIndexScanOperation(const NdbDictionary::Index * index,
/***************************************************************************** /*****************************************************************************
NdbScanOperation* getNdbScanOperation(int aTableId); NdbScanOperation* getNdbScanOperation(int aTableId);
Return Value Return a pointer to a NdbOperation object if getNdbOperation was succesful. Return Value Return a pointer to a NdbScanOperation object if getNdbScanOperation was succesful.
Return NULL: In all other case. Return NULL: In all other case.
Parameters: tableId : Id of the database table beeing deleted. Parameters: tableId : Id of the database table beeing deleted.
Remark: Get an operation from NdbScanOperation object idlelist and get the NdbTransaction Remark: Get an operation from NdbScanOperation object idlelist and get the NdbTransaction
object who was fetch by startTransaction pointing to this operation object who was fetch by startTransaction pointing to this operation
getOperation will set the theTableId in the NdbOperation object, synchronous. getOperation will set the theTableId in the NdbScanOperation object, synchronous.
*****************************************************************************/ *****************************************************************************/
NdbIndexScanOperation* NdbIndexScanOperation*
NdbTransaction::getNdbScanOperation(const NdbTableImpl * tab) NdbTransaction::getNdbScanOperation(const NdbTableImpl * tab)
...@@ -1203,12 +1203,12 @@ NdbTransaction::getNdbScanOperation(const NdbDictionary::Table * table) ...@@ -1203,12 +1203,12 @@ NdbTransaction::getNdbScanOperation(const NdbDictionary::Table * table)
NdbIndexOperation* getNdbIndexOperation(const char* anIndexName, NdbIndexOperation* getNdbIndexOperation(const char* anIndexName,
const char* aTableName); const char* aTableName);
Return Value Return a pointer to a NdbOperation object if getNdbScanOperation was succesful. Return Value Return a pointer to a NdbOperation object if getNdbIndexOperation was succesful.
Return NULL : In all other case. Return NULL : In all other case.
Parameters: aTableName : Name of the database table. Parameters: aTableName : Name of the database table.
Remark: Get an operation from NdbScanOperation idlelist and get the NdbTransaction object Remark: Get an operation from NdbIndexOperation idlelist and get the NdbTransaction object
who was fetch by startTransaction pointing to this operation who was fetch by startTransaction pointing to this operation
getOperation will set the theTableId in the NdbScanOperation object.synchronous getOperation will set the theTableId in the NdbIndexOperation object.synchronous
******************************************************************************/ ******************************************************************************/
NdbIndexOperation* NdbIndexOperation*
NdbTransaction::getNdbIndexOperation(const char* anIndexName, NdbTransaction::getNdbIndexOperation(const char* anIndexName,
...@@ -1216,8 +1216,21 @@ NdbTransaction::getNdbIndexOperation(const char* anIndexName, ...@@ -1216,8 +1216,21 @@ NdbTransaction::getNdbIndexOperation(const char* anIndexName,
{ {
if (theCommitStatus == Started) { if (theCommitStatus == Started) {
NdbTableImpl * table = theNdb->theDictionary->getTable(aTableName); NdbTableImpl * table = theNdb->theDictionary->getTable(aTableName);
NdbIndexImpl * index = theNdb->theDictionary->getIndex(anIndexName, NdbIndexImpl * index;
aTableName);
if (table->m_frm.get_data())
{
// This unique index is defined from SQL level
static const char* uniqueSuffix= "$unique";
char uniqueIndexName[MAX_TAB_NAME_SIZE];
strxnmov(uniqueIndexName, MAX_TAB_NAME_SIZE, anIndexName, uniqueSuffix, NullS);
index = theNdb->theDictionary->getIndex(uniqueIndexName,
aTableName);
}
else
index = theNdb->theDictionary->getIndex(anIndexName,
aTableName);
if(table != 0 && index != 0){ if(table != 0 && index != 0){
return getNdbIndexOperation(index, table); return getNdbIndexOperation(index, table);
} }
......
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