Below is the list of changes that have just been committed into a local
6.0-falcon repository of . When does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-05-14 14:05:06-04:00, jas@rowvwade. +4 -0
Clear Statement transaction pointer on transaction
commit or rollback.
storage/falcon/Connection.cpp@stripped, 2007-05-14 14:04:58-04:00, jas@rowvwade. +6 -0
Stylistic edits for consistency.
storage/falcon/PreparedStatement.cpp@stripped, 2007-05-14 14:04:58-04:00, jas@rowvwade. +8 -0
Stylistic edits for consistency.
storage/falcon/Statement.cpp@stripped, 2007-05-14 14:04:59-04:00, jas@rowvwade. +74 -8
Clear Statement transaction pointer on transaction
commit or rollback.
storage/falcon/Statement.h@stripped, 2007-05-14 14:04:59-04:00, jas@rowvwade. +2 -0
Clear Statement transaction pointer on transaction
commit or rollback.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: jas
# Host: rowvwade.
# Root: D:/MySQL/mysql-5.1-falcon
--- 1.12/storage/falcon/Connection.cpp 2007-05-14 14:05:25 -04:00
+++ 1.13/storage/falcon/Connection.cpp 2007-05-14 14:05:25 -04:00
@@ -263,6 +263,7 @@
{
if (n > 5)
throw SQLEXCEPTION (RUNTIME_ERROR, "non-converging transaction");
+
transaction = NULL;
ASSERT (trans->database == database);
trans->commit();
@@ -289,6 +290,9 @@
for (ResultSet *resultSet = resultSets; resultSet; resultSet = resultSet->connectionNext)
resultSet->transactionEnded();
+
+ for (Statement *statement = statements; statement; statement = statement->connectionNext)
+ statement->transactionEnded();
}
void Connection::prepare(int xidSize, const UCHAR *xid)
@@ -1400,11 +1404,13 @@
{
global.lock (Exclusive);
Statement *statement = statements;
+
if (statement)
{
statements = statement->connectionNext;
statement->connectionClosed();
}
+
global.unlock();
}
--- 1.5/storage/falcon/PreparedStatement.cpp 2007-05-14 14:05:25 -04:00
+++ 1.6/storage/falcon/PreparedStatement.cpp 2007-05-14 14:05:25 -04:00
@@ -126,11 +126,13 @@
case Delete:
case Replace:
executeUpdate();
+
return false;
case Select:
//executeQuery();
start (statement->node);
+
return true;
default:
@@ -206,7 +208,9 @@
{
if (p >= end)
throw SQLEXCEPTION (RUNTIME_ERROR, "overflow in setRecord");
+
TerType type = (TerType) *p++;
+
switch (type)
{
case terNull:
@@ -372,6 +376,7 @@
blob->setReference (repoLength, (UCHAR*) p);
p += repoLength;
int length = getTerLong (&p);
+
if (length >= 0)
{
blob->putSegment (length, p, true);
@@ -379,6 +384,7 @@
}
else
blob->unsetData();
+
setBlob (n, blob);
blob->release();
}
@@ -391,6 +397,7 @@
blob->setReference (repoLength, (UCHAR*) p);
p += repoLength;
int length = getTerLong (&p);
+
if (length >= 0)
{
blob->putSegment (length, p, true);
@@ -398,6 +405,7 @@
}
else
blob->unsetData();
+
setClob (n, blob);
blob->release();
}
--- 1.20/storage/falcon/Statement.cpp 2007-05-14 14:05:25 -04:00
+++ 1.21/storage/falcon/Statement.cpp 2007-05-14 14:05:25 -04:00
@@ -256,6 +256,7 @@
{
resultSet->close();
check->close();
+
throw SQLError (DDL_ERROR, "index %s already exists on table %s.%s",
name, table->schemaName, tableName);
}
@@ -361,8 +362,10 @@
***/
recordsUpdated = 0;
+
if (transaction)
transaction->release();
+
transaction = connection->getTransaction();
transaction->addRef();
@@ -387,6 +390,7 @@
{
if (!sorts)
sorts = new Sort* [numberSorts];
+
memset (sorts, 0, sizeof (Sort*) * numberSorts);
}
@@ -404,6 +408,7 @@
{
if (!bitmaps)
bitmaps = new Bitmap* [numberBitmaps];
+
memset (bitmaps, 0, sizeof (Bitmap*) * numberBitmaps);
}
@@ -411,6 +416,7 @@
{
if (!valueSets)
valueSets = new ValueSet* [numberValueSets];
+
memset (valueSets, 0, sizeof (ValueSet*) * numberValueSets);
}
@@ -418,6 +424,7 @@
{
if (!rowSlots)
rowSlots = new Row* [numberRowSlots];
+
memset (rowSlots, 0, sizeof (Row*) * numberRowSlots);
}
@@ -427,6 +434,7 @@
if (!contexts && (numberContexts = statement->numberContexts))
{
contexts = new Context [numberContexts];
+
FOR_OBJECTS (Context*, context, &statement->contexts)
contexts [context->contextId].initialize (context);
END_FOR;
@@ -445,8 +453,10 @@
recordsUpdated = 0;
updateStatements = false;
memset (&stats, 0, sizeof (stats));
+
if (transaction)
transaction->release();
+
transaction = connection->getTransaction();
transaction->addRef();
@@ -579,11 +589,13 @@
case nod_foreign_key:
{
ForeignKey *key = addForeignKey (table, NULL, clause);
+
if (table->findForeignKey (key))
{
delete key;
throw SQLEXCEPTION (DDL_ERROR, "foreign key already exits");
}
+
key->create();
key->save (database);
}
@@ -592,11 +604,13 @@
case nod_add_field:
{
Field *field = addField (table, clause->getChild (0));
+
if (field->foreignKey)
{
field->foreignKey->create();
field->foreignKey->save (database);
}
+
field->save ();
table->reformat();
}
@@ -614,13 +628,18 @@
{
Field *fields [16];
Syntax *list = clause->getChild (0);
+
if (list->count >= 16)
throw SQLError (DDL_ERROR, "too many segments in a foreign key");
+
for (int n = 0; n < list->count; ++n)
fields [n] = CompiledStatement::findField (table, list->getChild (n));
+
Table *refs = NULL;
+
if (clause->getChild (1))
refs = CompiledStatement::getTable (connection, clause->getChild (1));
+
if (!table->dropForeignKey (list->count, fields, refs))
throw SQLError (DDL_ERROR, "can't find foreign key");
}
@@ -806,10 +825,13 @@
case nod_set_namespace:
while (!connection->nameSpace.isEmpty())
connection->popSchemaName();
+
child = syntax->getChild (0);
+
FOR_SYNTAX (name, child)
connection->pushSchemaName (name->getString());
END_FOR;
+
break;
case nod_pop_namespace:
@@ -942,6 +964,7 @@
{
if (field->type != Asciiblob && field->type != Binaryblob)
throw SQLEXCEPTION (DDL_ERROR, "can't specify repository on non-blob field %s\n", field->name);
+
const char *repositoryName = clause->getChild(0)->getString();
Repository *repository = database->getRepository (table->schemaName, repositoryName);
field->setRepository (repository);
@@ -982,6 +1005,7 @@
else
{
Syntax *list = syntax->getChild (0);
+
for (int n = 0; n < list->count; ++n)
{
Field *field = statement->findField (foreignTable, list->getChild (n));
@@ -1013,6 +1037,7 @@
if (*ptr == resultList)
{
resultLists = resultList->sibling;
+
return;
}
@@ -1057,6 +1082,7 @@
(const char*) prior->statement->sqlString);
Log::debug ("setCursorName current Statement: %s\n",
(const char*) statement->sqlString);
+
throw SQLError (RUNTIME_ERROR, "cursor name \"%s\" is already in use", name);
}
@@ -1157,6 +1183,7 @@
{
const char *fldName = item->getChild (0)->getString();
Field *field = table->findField (fldName);
+
if (field)
{
if (upgradeField (table, field, item, newIndexes))
@@ -1217,6 +1244,7 @@
{
ForeignKey *key = addForeignKey (table, NULL, item);
ForeignKey *existingKey = table->findForeignKey(key);
+
if (existingKey && existingKey->deleteRule == key->deleteRule)
delete key;
else
@@ -1255,6 +1283,7 @@
if (key)
{
ForeignKey *existingKey = table->findForeignKey(key);
+
if (existingKey)
{
existingKey->setDeleteRule (key->deleteRule);
@@ -1264,8 +1293,10 @@
else
{
ForeignKey *alt = table->findForeignKey (field, true);
+
if (alt)
alt->deleteForeignKey();
+
field->foreignKey->create();
field->foreignKey->save (database);
}
@@ -1324,6 +1355,7 @@
for (int n = 0; n < numberSorts; ++n)
if (sorts [n])
delete sorts [n];
+
delete [] sorts;
sorts = NULL;
}
@@ -1333,6 +1365,7 @@
for (int n = 0; n < numberBitmaps; ++n)
if (bitmaps [0])
bitmaps[n]->release();
+
delete [] bitmaps;
bitmaps = NULL;
}
@@ -1342,6 +1375,7 @@
for (int n = 0; n < numberValueSets; ++n)
if (valueSets[n])
delete valueSets[n];
+
delete [] valueSets;
valueSets = NULL;
}
@@ -1501,10 +1535,12 @@
field->scale != type.scale)
{
field->type = type.type;
+
if (field->type != type.type ||
!((type.type == String || type.type == Char || type.type == Varchar) &&
field->length > type.length))
field->length = type.length;
+
field->scale = type.scale;
changed = true;
}
@@ -1538,8 +1574,7 @@
{
if (!notNull && !wasNotNull)
throw SQLEXCEPTION (DDL_ERROR, "primary keys must be \"not null\"");
- //char indexName [128];
- //sprintf (indexName, "%s_PRIMARY_KEY", table->getName());
+
Index *index = table->addIndex (table->getPrimaryKeyName(), 1, PrimaryKey);
index->addField (field, 0);
newIndexes.append (index);
@@ -1560,6 +1595,7 @@
{
const char *collationName = clause->getChild(0)->getString();
Collation *collation = CollationManager::getCollation (collationName);
+
if (collation != field->collation)
{
field->setCollation (collation);
@@ -1573,10 +1609,13 @@
{
if (field->type != Asciiblob && field->type != Binaryblob)
throw SQLEXCEPTION (DDL_ERROR, "can't specify repository on non-blob field %s\n", field->name);
+
const char *repositoryName = clause->getChild(0)->getString();
+
if (*repositoryName)
{
Repository *repository = database->getRepository (table->schemaName, repositoryName);
+
if (repository != field->repository)
{
field->setRepository (repository);
@@ -1599,6 +1638,7 @@
if (notNull != wasNotNull)
{
changed = true;
+
if (notNull)
field->flags |= NOT_NULL;
else
@@ -1626,6 +1666,7 @@
if (!field)
{
table->deleteIndex (index, transaction);
+
throw SQLEXCEPTION (DDL_ERROR, "can't find primary key %s in table %s",
fld->getString(), table->getName());
}
@@ -1633,6 +1674,7 @@
if (!(field->flags & NOT_NULL))
{
table->deleteIndex (index, transaction);
+
throw SQLEXCEPTION (DDL_ERROR, "primary keys must be \"not null\"");
}
@@ -1713,6 +1755,7 @@
for (ResultSet *resultSet; (resultSet = resultSets);)
{
resultSet->clearStatement();
+
if (forceRelease)
resultSet->close();
}
@@ -1720,6 +1763,7 @@
for (ResultList *resultList; (resultList = resultLists);)
{
resultList->clearStatement();
+
if (forceRelease)
resultList->close();
}
@@ -1816,14 +1860,12 @@
Role *role = roleModel->findRole (schema, name);
if (role)
+ {
if (upgrade)
- {
- // The following line is problematical.
- //roleModel->addUserRole (connection->user, role, true, 1);
return;
- }
- else
- throw SQLEXCEPTION (DDL_ERROR, "role %s.%s already exists", schema, name);
+
+ throw SQLEXCEPTION (DDL_ERROR, "role %s.%s already exists", schema, name);
+ }
roleModel->createRole (connection->user, schema, name);
}
@@ -1850,6 +1892,7 @@
if (!connection->checkAccess (GRANT_OPTION, role))
{
connection->checkAccess (GRANT_OPTION, role);
+
throw SQLEXCEPTION (SECURITY_ERROR, "user %s does not have Grant authority to %s.%s",
(const char*) connection->user->name,
(const char*) role->schemaName,
@@ -2465,6 +2508,7 @@
if (coterie && !upgrade)
{
throw SQLEXCEPTION (DDL_ERROR, "coterie %s already exists", name);
+
if (!connection->checkAccess (PrivAlter, coterie))
throw SQLEXCEPTION (SECURITY_ERROR, "coterie %s does not have alter authority to user %s",
(const char*) connection->user->name, name);
@@ -2480,6 +2524,7 @@
getString (fromNode, from, sizeof (from));
Syntax *toNode = rangeNode->getChild (1);
CoterieRange *range;
+
if (toNode)
{
char to [256];
@@ -2488,6 +2533,7 @@
}
else
range = new CoterieRange (from, from);
+
range->next = ranges;
ranges = range;
END_FOR
@@ -2499,6 +2545,7 @@
ranges = range->next;
delete range;
}
+
throw;
}
@@ -2535,8 +2582,10 @@
FOR_SYNTAX (name, node)
if (name->type == nod_wildcard)
throw SQLEXCEPTION (DDL_ERROR, "coterie wildcards not yet implemented");
+
if (p != buffer)
*p++ = '.';
+
p = getString (name, p, end - p);
END_FOR
break;
@@ -2546,6 +2595,7 @@
{
for (const char *q = node->getString(); *q && p < end;)
*p++ = *q++;
+
*p = 0;
}
break;
@@ -2621,6 +2671,7 @@
if (statement->ddl)
{
executeDDL();
+
return false;
}
@@ -2661,6 +2712,7 @@
{
stream->format ("%8x Statement uc %d, jc %d, cncnt %p, state %p, rs %p\n",
this, useCount, javaCount, connection, statement, resultSets);
+
if (statement)
stream->format (" %s\n", (const char*) statement->sqlString);
}
@@ -2708,12 +2760,16 @@
{
if (sequence)
repository->setSequence (sequence);
+
if (fileName)
repository->setFilePattern (fileName);
+
if (volume)
repository->setVolume (volume);
+
if (rollovers)
repository->setRollover (rollovers);
+
repository->save();
}
else
@@ -2761,6 +2817,7 @@
JString tableName = resultSet->getString (2);
resultSet->close();
statement->close();
+
throw SQLError (DDL_ERROR, "repository %s is in use in field %s.%s\n",
name, (const char*) fieldName, (const char*) tableName);
}
@@ -2830,5 +2887,14 @@
sync.unlock();
database->commitSystemTransaction();
+ }
+}
+
+void Statement::transactionEnded(void)
+{
+ if (transaction)
+ {
+ transaction->release();
+ transaction = NULL;
}
}
--- 1.3/storage/falcon/Statement.h 2007-05-14 14:05:25 -04:00
+++ 1.4/storage/falcon/Statement.h 2007-05-14 14:05:25 -04:00
@@ -213,6 +213,8 @@
volatile INTERLOCK_TYPE useCount;
volatile INTERLOCK_TYPE javaCount;
SyncObject syncObject;
+public:
+ void transactionEnded(void);
};
END_NAMESPACE
| Thread |
|---|
| • bk commit into 6.0-falcon tree (jas:1.2517) | U-ROWVWADEjas | 14 May |