~ubuntu-branches/ubuntu/hardy/mysql-dfsg-5.0/hardy-updates

« back to all changes in this revision

Viewing changes to ndb/src/ndbapi/Ndb.cpp

  • Committer: Bazaar Package Importer
  • Author(s): sean finney
  • Date: 2007-05-13 12:32:45 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20070513123245-8c3l187dk34cz2ar
Tags: 5.0.41-2
the previous "translation changes" inadvertently introduced unrelated
changes in the package control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
// We have connections now to the desired node. Return
57
57
//****************************************************************************
58
58
      DBUG_RETURN(getConnectedNdbTransaction(tConNode));
 
59
    } else if (TretCode < 0) {
 
60
      DBUG_RETURN(NULL);
59
61
    } else if (TretCode != 0) {
60
62
      tAnyAlive = 1;
61
63
    }//if
79
81
// We have connections now to the desired node. Return
80
82
//****************************************************************************
81
83
        DBUG_RETURN(getConnectedNdbTransaction(tNode));
 
84
      } else if (TretCode < 0) {
 
85
        DBUG_RETURN(NULL);
82
86
      } else if (TretCode != 0) {
83
87
        tAnyAlive= 1;
84
88
      }//if
107
111
// We have connections now to the desired node. Return
108
112
//****************************************************************************
109
113
        DBUG_RETURN(getConnectedNdbTransaction(tNode));
 
114
      } else if (TretCode < 0) {
 
115
        DBUG_RETURN(NULL);
110
116
      } else if (TretCode != 0) {
111
117
        tAnyAlive= 1;
112
118
      }//if
176
182
    nodeSequence = tp->getNodeSequence(tNode);
177
183
    bool node_is_alive = tp->get_node_alive(tNode);
178
184
    if (node_is_alive) { 
 
185
      DBUG_PRINT("info",("Sending signal to node %u", tNode));
179
186
      tReturnCode = tp->sendSignal(tSignal, tNode);  
180
187
      releaseSignal(tSignal); 
181
188
      if (tReturnCode != -1) {
207
214
    DBUG_PRINT("info",
208
215
               ("unsuccessful connect tReturnCode %d, tNdbCon->Status() %d",
209
216
                tReturnCode, tNdbCon->Status()));
 
217
    if (theError.code == 299)
 
218
    {
 
219
      // single user mode so no need to retry with other node
 
220
      DBUG_RETURN(-1);
 
221
    }
210
222
    DBUG_RETURN(3);
211
223
  }//if
212
224
}//Ndb::NDB_connect()
438
450
 
439
451
  theRemainingStartTransactions--;
440
452
  NdbTransaction* tConNext = theTransactionList;
441
 
  tConnection->init();
 
453
  if (tConnection->init())
 
454
  {
 
455
    theError.code = tConnection->theError.code;
 
456
    DBUG_RETURN(NULL);
 
457
  }
442
458
  theTransactionList = tConnection;        // into a transaction list.
443
459
  tConnection->next(tConNext);   // Add the active connection object
444
460
  tConnection->setTransactionId(tFirstTransId);
1118
1134
}
1119
1135
 
1120
1136
 
1121
 
void Ndb::setCatalogName(const char * a_catalog_name)
 
1137
int Ndb::setCatalogName(const char * a_catalog_name)
1122
1138
{
1123
1139
  if (a_catalog_name)
1124
1140
  {
1125
 
    theImpl->m_dbname.assign(a_catalog_name);
1126
 
    theImpl->update_prefix();
 
1141
    if (!theImpl->m_dbname.assign(a_catalog_name) ||
 
1142
        theImpl->update_prefix())
 
1143
    {
 
1144
      theError.code = 4000;
 
1145
      return -1;
 
1146
    }
1127
1147
  }
 
1148
  return 0;
1128
1149
}
1129
1150
 
1130
 
 
1131
1151
const char * Ndb::getSchemaName() const
1132
1152
{
1133
1153
  return theImpl->m_schemaname.c_str();
1134
1154
}
1135
1155
 
1136
1156
 
1137
 
void Ndb::setSchemaName(const char * a_schema_name)
 
1157
int Ndb::setSchemaName(const char * a_schema_name)
1138
1158
{
1139
1159
  if (a_schema_name) {
1140
 
    theImpl->m_schemaname.assign(a_schema_name);
1141
 
    theImpl->update_prefix();
 
1160
    if (!theImpl->m_schemaname.assign(a_schema_name) ||
 
1161
        theImpl->update_prefix())
 
1162
    {
 
1163
      theError.code = 4000;
 
1164
      return -1;
 
1165
    }
1142
1166
  }
 
1167
  return 0;
1143
1168
}
1144
1169
 
1145
1170
/*
1150
1175
  return getCatalogName();
1151
1176
}
1152
1177
 
1153
 
void Ndb::setDatabaseName(const char * a_catalog_name)
 
1178
int Ndb::setDatabaseName(const char * a_catalog_name)
1154
1179
{
1155
 
  setCatalogName(a_catalog_name);
 
1180
  return setCatalogName(a_catalog_name);
1156
1181
}
1157
1182
 
1158
1183
const char * Ndb::getDatabaseSchemaName() const
1160
1185
  return getSchemaName();
1161
1186
}
1162
1187
 
1163
 
void Ndb::setDatabaseSchemaName(const char * a_schema_name)
 
1188
int Ndb::setDatabaseSchemaName(const char * a_schema_name)
1164
1189
{
1165
 
  setSchemaName(a_schema_name);
 
1190
  return setSchemaName(a_schema_name);
1166
1191
}
1167
1192
 
1168
1193
bool Ndb::usingFullyQualifiedNames()
1276
1301
Ndb::getDatabaseFromInternalName(const char * internalName)
1277
1302
{
1278
1303
  char * databaseName = new char[strlen(internalName) + 1];
 
1304
  if (databaseName == NULL)
 
1305
  {
 
1306
    errno = ENOMEM;
 
1307
    return BaseString(NULL);
 
1308
  }
1279
1309
  strcpy(databaseName, internalName);
1280
1310
  register char *ptr = databaseName;
1281
1311
   
1292
1322
Ndb::getSchemaFromInternalName(const char * internalName)
1293
1323
{
1294
1324
  char * schemaName = new char[strlen(internalName)];
 
1325
  if (schemaName == NULL)
 
1326
  {
 
1327
    errno = ENOMEM;
 
1328
    return BaseString(NULL);
 
1329
  }
1295
1330
  register const char *ptr1 = internalName;
1296
1331
   
1297
1332
  /* Scan name for the second table_name_separator */