bool DatabaseConnectionManager::ExecuteScript(const String &sFile, String &sErrorMessage) { boost::shared_ptr<DALConnection> pConnection = _GetConnection(); SQLScriptRunner scriptRunner; bool result = scriptRunner.ExecuteScript(pConnection, sFile, sErrorMessage); _ReleaseConnection(pConnection); return result; }
bool DatabaseConnectionManager::EnsuresPrerequisites(long DBVersion, String &sErrorMessage) { PrerequisiteList prerequisites; boost::shared_ptr<DALConnection> pConnection = _GetConnection(); bool result = prerequisites.Ensure(pConnection, DBVersion, sErrorMessage); _ReleaseConnection(pConnection); return result; }
boost::shared_ptr<DALConnection> DatabaseConnectionManager::BeginTransaction(String &sErrorMessage) { boost::shared_ptr<DALConnection> pDALConnection = _GetConnection(); if (!pDALConnection->BeginTransaction(sErrorMessage)) { // Could not start database transaction. boost::shared_ptr<DALConnection> pEmpty; return pEmpty; } return pDALConnection; }
bool DatabaseConnectionManager::Execute(const SQLCommand &command, __int64 *iInsertID, int iIgnoreErrors, String &sErrorMessage) { boost::shared_ptr<DALConnection> pDALConn = _GetConnection(); if (!pDALConn) { assert(0); return false; } bool bResult = pDALConn->Execute(command, sErrorMessage, iInsertID, iIgnoreErrors); _ReleaseConnection(pDALConn); return bResult; }
boost::shared_ptr<DALRecordset> DatabaseConnectionManager::OpenRecordset(const SQLCommand &command) { boost::shared_ptr<DALRecordset> pRecordset; boost::shared_ptr<DALConnection> pDALConn = _GetConnection(); if (!pDALConn) { assert(0); return pRecordset; } pRecordset = pDALConn->CreateRecordset(); if (!pRecordset->Open(pDALConn, command)) pRecordset.reset(); _ReleaseConnection(pDALConn); return pRecordset; }
void Video::GetComments(List<Comment> *list, const PagingInfo *paging /* = NULL */) const { _GetConnection(id_, "/comments", paging, list); }
void Group::GetMembers(List<Friend> *list, const PagingInfo *paging /*= NULL*/) const { _GetConnection(id_, "members", paging, list); }
void Group::GetFeed(List<PolymorphicObject> *list, const PagingInfo *paging /* = NULL */) const { _GetConnection(id_, "feed", paging, list); }
DLL_EXPORT int _ConnectLayer(NLAYER *first, NLAYER *second, int method, int (*func)(NLAYER *, NLAYER *)) { int tempintval = 0; LINK *templink = NULL; NEURON *tempf = NULL, *temp2f = NULL; NEURON *temps = NULL, *temp2s = NULL; NEURON *tempneuro = NULL, *tempneuro2 = NULL; if ((!first) || (!second))return -1; if (!first->first)return -2; if (!second->first)return -3; switch (method) { case 0: { if (func) return func(first, second); else return 0; } case 1: { //Метод @Галлактика+-@ tempf = first->first, temp2f = first->end; temps = second->first, temp2s = second->end; while (tempf && temp2s) { templink = _ConnectNeuron(tempf, temp2s, tempintval); if (!templink)break; tempintval++; tempf = tempf->next; temp2s = temp2s->prev; } while (temps && temp2f) { templink = _ConnectNeuron(temps, temp2f, tempintval); if (!templink)break; tempintval--; temps = temps->next; temp2f = temp2f->prev; } //По кругу с разных сторон пока не сойдуться в центре //!Плевать на количественную разницу. //!В ущерб идет качественная структурная оптимизация //!Существует вероятность неподключенных остатков break; } case 2: { //Прямой путь "Правильный" tempf = first->first, temp2f = first->end; temps = second->first, temp2s = second->end; while (tempf && temps) { templink = _ConnectNeuron(tempf, temps, tempintval); if (!templink)break; tempintval++; tempf = tempf->next; temps = temps->next; } tempintval = 0; while (temp2f && temp2s) { templink = _ConnectNeuron(temp2f, temp2s, tempintval); if (!templink)break; tempintval++; temp2f = temp2f->prev; temp2s = temp2s->prev; } break; //По с разных сторон пока не всё //!Плевать на количественную разницу. //!В ущерб не идет качественная структурная оптимизация //!Существует вероятность неподключенных остатков } case 3: { //Метод "MechanicaLoop" (.спустись в ад и вернись назад.) tempf = first->first, temp2f = first->end; temps = second->first, temp2s = second->end; char breakbyte = 0; LINK *temp = 0; temps = temps->next; while (tempf) { if (temps) { templink = _ConnectNeuron(tempf, temps, tempintval); if (!templink)break; } else while (tempf) { if (tempf->next) { templink = _ConnectNeuron(tempf, tempf->next, tempintval); if (!templink)break; } else { breakbyte = 1; break; } tempf = tempf->next; } tempintval++; if (!breakbyte) { tempf = tempf->next; } else break; temps = temps->next; } while (temp2s) { if (breakbyte) { while (tempf) { temp = _GetConnection(tempf, tempf->prev); if (temp->weight == tempintval - 1) { templink = _ConnectNeuron(tempf, temp2s, tempintval); if (!templink)break; } else { templink = _ConnectNeuron(temp2s, tempf, tempintval); if (!templink)break; temp2s = temp2s->prev; break; } tempf = tempf->prev; } breakbyte = 0; } templink = _ConnectNeuron(tempf, temp2s, tempintval); if (!templink)break; if (temp2s->prev) { templink = _ConnectNeuron(temp2s, tempf->prev, tempintval); temp2s = temp2s->prev; } tempintval--; tempf = tempf->prev; } //По с разных сторон перекрестным огнем, по остаткам как по головам. //!Плевать на количественную разницу. //!В ущерб не идет качественная структурная оптимизация но есть вероятность залупиться //!Не существует вероятности неподключенных остатков } case 4: { //Метод "О-о-."(+79033235592) 18:02 (Скат покрыжен, Shina получена) tempf = first->first, temp2f = first->end; temps = second->first, temp2s = second->end; tempneuro = tempf, tempneuro2 = temp2f; tempintval = 0; while (tempneuro && tempneuro2) { while (tempf) { templink = _ConnectNeuron(tempf, temp2s, tempintval); if (!templink)break; tempf = tempf->next; } tempneuro = tempneuro->next; tempneuro2 = tempneuro2->prev; tempf = tempneuro; temp2s = tempneuro2; } break; //Это внеземная технология, описывать не имею права, все следует из названия метода. } case 5: { //Метод оптимизации Ni+N(i+1)=Zi;Ni=N(i+1);Zi=Z(i+1) //Требует оптимизации.../ tempf = first->first, temp2f = first->end; temps = second->first, temp2s = second->end; while (tempf->next) { templink = _ConnectNeuron(tempf, temps, tempintval); if (!templink)break; templink = _ConnectNeuron(tempf->next, temps, tempintval * (-1)); if (!templink)break; tempf = tempf->next; temps = temps->next; } while (temps) { templink = _ConnectNeuron(temp2f, temps, tempintval); if (!templink)break; temps = temps->next; } break; //Точнее и однозначнее быть не может //!Лучше из большего к меньшему количеству. //хзхз!В ущерб не идет качественная структурная оптимизация //!Существует вероятность неподключенных остатков } case 6: { //Метод цели Ni+N(i+1)=Zi;Ni=N(i+2);Zi=Z(i+1) tempf = first->first, temp2f = first->end; temps = second->first, temp2s = second->end; while (tempf && tempf->next) { templink = _ConnectNeuron(tempf, temps, tempintval); if (!templink)break; templink = _ConnectNeuron(tempf->next, temps, tempintval * (-1)); tempf = tempf->next->next; temps = temps->next; } while (temps) { templink = _ConnectNeuron(temp2f, temps, tempintval); if (!templink)break; temps = temps->next; } break; //Разнообразнее быть не может //!Лучше из большего к меньшему количеству. //В ущерб идет качественная структурная оптимизация при кривизне //организации выбора метода связи! //(ващпе не страшно, с 1 раза не въедут, придется въехать с другого раза) //не существует вероятности неподключенных остатков } default: { if (!func)return -4; else return func(first, second); } } return 1; }