这篇教程C++ CheckConnection函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CheckConnection函数的典型用法代码示例。如果您正苦于以下问题:C++ CheckConnection函数的具体用法?C++ CheckConnection怎么用?C++ CheckConnection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CheckConnection函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: UpdateClientsvoid StepManiaLanServer::UpdateClients(){ //Go through all the clients and check to see if it is being used. //If so then try to get a backet and parse the data. for (unsigned int x = 0; x < Client.size(); ++x) if (CheckConnection(x) && (Client[x]->GetData(Packet) >= 0)) ParseData(Packet, x);}
开发者ID:augustg,项目名称:stepmania-3.9,代码行数:8,
示例2: SetValGTM/* * Set values for sequence */intSetValGTM(char *seqname, GTM_Sequence nextval, bool iscalled){ GTM_SequenceKeyData seqkey; CheckConnection(); seqkey.gsk_keylen = strlen(seqname) + 1; seqkey.gsk_key = seqname; return conn ? set_val(conn, &seqkey, nextval, iscalled) : -1;}
开发者ID:kisehiroshi,项目名称:postgres-xc,代码行数:13,
示例3: AlterSequenceGTM/* * Alter a sequence on the GTM */intAlterSequenceGTM(char *seqname, GTM_Sequence increment, GTM_Sequence minval, GTM_Sequence maxval, GTM_Sequence startval, GTM_Sequence lastval, bool cycle, bool is_restart){ GTM_SequenceKeyData seqkey; CheckConnection(); seqkey.gsk_keylen = strlen(seqname) + 1; seqkey.gsk_key = seqname; return conn ? alter_sequence(conn, &seqkey, increment, minval, maxval, startval, lastval, cycle, is_restart) : 0;}
开发者ID:kisehiroshi,项目名称:postgres-xc,代码行数:14,
示例4: CheckPowervoid JohanCity::UpdateTime(float dt) { clock->Start(); // Optimized version of power checking... CheckPower(); // crawls from power plant outward... // Optimized version of water checking... CheckWater(); // crawls from water source outward... // TODO: optimize? CheckConnection(); checktilems = clock->Reset() * 1000.0f; // Then apply tile info to buildings CheckBuildingRequisites(); checkbuildingms = clock->Reset() * 1000.0f; // Done checking for required items? Spend the RCI for(int i = 0;i < tiles.size();i++) { for(int j = 0;j < tiles[i].size();j++) { TileType type = tiles[i][j]->type; if(type == ttResidential || type == ttCommercial || type == ttIndustrial) { tiles[i][j]->UpdateTime(dt); } // Undo checks (so they won't get invalid)? tiles[i][j]->checkid = -1;// tiles[i][j]->powered = false;// tiles[i][j]->watered = false;// tiles[i][j]->connected = false; } } updatetilems = clock->Reset() * 1000.0f; for(std::list<Building*>::iterator i = buildings.begin();i != buildings.end();i++) { Building* building = *i; building->UpdateTime(dt); } updatebuildingms = clock->Reset() * 1000.0f; snprintf(timingreport,256, "Check tile time: %.2f ms/r/nCheck building time: %.2f ms/r/nUpdate tile time: %.2f ms/r/nUpdate building time: %.2f ms/r/n", checktilems, checkbuildingms, updatetilems, updatebuildingms); UpdateBuffers();}
开发者ID:JohanMes,项目名称:JohanCity,代码行数:54,
示例5: DropSequenceGTM/* * Drop the sequence depending the key type * * Type of Sequence name use in key; * GTM_SEQ_FULL_NAME, full name of sequence * GTM_SEQ_DB_NAME, DB name part of sequence key */intDropSequenceGTM(char *name, GTM_SequenceKeyType type){ GTM_SequenceKeyData seqkey; CheckConnection(); seqkey.gsk_keylen = strlen(name) + 1; seqkey.gsk_key = name; seqkey.gsk_type = type; return conn ? close_sequence(conn, &seqkey) : -1;}
开发者ID:kisehiroshi,项目名称:postgres-xc,代码行数:18,
示例6: CreateSequenceGTM/* * Create a sequence on the GTM. */intCreateSequenceGTM(char *seqname, GTM_Sequence increment, GTM_Sequence minval, GTM_Sequence maxval, GTM_Sequence startval, bool cycle){ GTM_SequenceKeyData seqkey; CheckConnection(); seqkey.gsk_keylen = strlen(seqname) + 1; seqkey.gsk_key = seqname; return conn ? open_sequence(conn, &seqkey, increment, minval, maxval, startval, cycle) : 0;}
开发者ID:kisehiroshi,项目名称:postgres-xc,代码行数:14,
示例7: RenameSequenceGTM/* * Rename the sequence */intRenameSequenceGTM(char *seqname, const char *newseqname){ GTM_SequenceKeyData seqkey, newseqkey; CheckConnection(); seqkey.gsk_keylen = strlen(seqname) + 1; seqkey.gsk_key = seqname; newseqkey.gsk_keylen = strlen(newseqname) + 1; newseqkey.gsk_key = (char *) newseqname; return conn ? rename_sequence(conn, &seqkey, &newseqkey) : -1;}
开发者ID:kisehiroshi,项目名称:postgres-xc,代码行数:15,
示例8: ReportBarrierGTM/* * Report BARRIER */intReportBarrierGTM(char *barrier_id){ if (!gtm_backup_barrier) return; CheckConnection(); if (!conn) return EOF; return(report_barrier(conn, barrier_id));}
开发者ID:HunterChen,项目名称:postgres-xc,代码行数:16,
示例9: GetSnapshotGTMGTM_SnapshotGetSnapshotGTM(GlobalTransactionId gxid, bool canbe_grouped){ GTM_Snapshot ret_snapshot = NULL; CheckConnection(); if (conn) ret_snapshot = get_snapshot(conn, gxid, canbe_grouped); if (ret_snapshot == NULL) { CloseGTM(); InitGTM(); } return ret_snapshot;}
开发者ID:kisehiroshi,项目名称:postgres-xc,代码行数:14,
示例10: whilevoid NetworkThread::Run(){ while(ReceiveMessages()) { if(myPacket && !myPacket.endOfPacket()) { ParseMessages(); myPacket.clear(); } CheckConnection(); sf::sleep(sf::milliseconds(100)); }}
开发者ID:boomshanka,项目名称:Papouja,代码行数:15,
示例11: GetNextValGTMGetNextValGTM(char *seqname)#endif{ GTM_Sequence ret = -1; GTM_SequenceKeyData seqkey;#ifdef XCP char *coordName = IS_PGXC_COORDINATOR ? PGXCNodeName : MyCoordName; int coordPid = IS_PGXC_COORDINATOR ? MyProcPid : MyCoordPid; int status;#endif CheckConnection(); seqkey.gsk_keylen = strlen(seqname) + 1; seqkey.gsk_key = seqname;#ifdef XCP if (conn) status = get_next(conn, &seqkey, coordName, coordPid, range, &ret, rangemax); else status = GTM_RESULT_COMM_ERROR; /* retry once */ if (status == GTM_RESULT_COMM_ERROR) { CloseGTM(); InitGTM(); if (conn) status = get_next(conn, &seqkey, coordName, coordPid, range, &ret, rangemax); } if (status != GTM_RESULT_OK) ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR), errmsg("%s", GTMPQerrorMessage(conn))));#else if (conn) ret = get_next(conn, &seqkey); if (ret < 0) { CloseGTM(); InitGTM(); }#endif return ret;}
开发者ID:techdragon,项目名称:Postgres-XL,代码行数:45,
示例12: AcceptResult/* * AcceptResult * * Checks whether a result is valid, giving an error message if necessary; * and ensures that the connection to the backend is still up. * * Returns true for valid result, false for error state. */static boolAcceptResult(const PGresult *result){ bool OK; if (!result) OK = false; else switch (PQresultStatus(result)) { case PGRES_COMMAND_OK: case PGRES_TUPLES_OK: case PGRES_EMPTY_QUERY: case PGRES_COPY_IN: case PGRES_COPY_OUT: case PGRES_COPY_BOTH: /* Fine, do nothing */ OK = true; break; case PGRES_BAD_RESPONSE: case PGRES_NONFATAL_ERROR: case PGRES_FATAL_ERROR: OK = false; break; default: OK = false; psql_error("unexpected PQresultStatus (%d)", PQresultStatus(result)); break; } if (!OK) { const char *error = PQerrorMessage(pset.db); if (strlen(error)) psql_error("%s", error); CheckConnection(); } return OK;}
开发者ID:dankrusi,项目名称:postgres,代码行数:53,
示例13: DisconnectNow/* Update is run regulary and we gather the state of the Wiiremote and see if the user have pressed on a button or moved the wiiremote This could have been done with callbacks instead but it doesn't look nice in C++*/void CWiiRemote::Update(){ if (m_DisconnectWhenPossible) {//If the user have choosen to disconnect or lost comunication DisconnectNow(true); m_DisconnectWhenPossible = false; }#ifdef CWIID_OLD if(m_connected) {//Here we check if the connection is suddenly broken if (!CheckConnection()) { DisconnectNow(true); return; } }#endif}
开发者ID:1c0n,项目名称:xbmc,代码行数:20,
示例14: GetNextValGTM/* * Get the next sequence value */GTM_SequenceGetNextValGTM(char *seqname){ GTM_Sequence ret = -1; GTM_SequenceKeyData seqkey; CheckConnection(); seqkey.gsk_keylen = strlen(seqname) + 1; seqkey.gsk_key = seqname; if (conn) ret = get_next(conn, &seqkey); if (ret < 0) { CloseGTM(); InitGTM(); } return ret;}
开发者ID:kisehiroshi,项目名称:postgres-xc,代码行数:21,
示例15: SetValGTM/* * Set values for sequence */intSetValGTM(char *seqname, GTM_Sequence nextval, bool iscalled){ GTM_SequenceKeyData seqkey;#ifdef XCP char *coordName = IS_PGXC_COORDINATOR ? PGXCNodeName : MyCoordName; int coordPid = IS_PGXC_COORDINATOR ? MyProcPid : MyCoordPid;#endif CheckConnection(); seqkey.gsk_keylen = strlen(seqname) + 1; seqkey.gsk_key = seqname;#ifdef XCP return conn ? set_val(conn, &seqkey, coordName, coordPid, nextval, iscalled) : -1;#else return conn ? set_val(conn, &seqkey, nextval, iscalled) : -1;#endif}
开发者ID:techdragon,项目名称:Postgres-XL,代码行数:21,
示例16: ProcessCopyResult/* * ProcessCopyResult: if command was a COPY FROM STDIN/TO STDOUT, handle it * * Note: Utility function for use by SendQuery() only. * * Returns true if the query executed successfully, false otherwise. */static boolProcessCopyResult(PGresult *results){ bool success = false; if (!results) return false; switch (PQresultStatus(results)) { case PGRES_TUPLES_OK: case PGRES_COMMAND_OK: case PGRES_EMPTY_QUERY: /* nothing to do here */ success = true; break; case PGRES_COPY_OUT: SetCancelConn(); success = handleCopyOut(pset.db, pset.queryFout); ResetCancelConn(); break; case PGRES_COPY_IN: SetCancelConn(); success = handleCopyIn(pset.db, pset.cur_cmd_source, PQbinaryTuples(results)); ResetCancelConn(); break; default: break; } /* may need this to recover from conn loss during COPY */ if (!CheckConnection()) return false; return success;}
开发者ID:GisKook,项目名称:Gis,代码行数:47,
示例17: ProcessCopyResult/* * ProcessCopyResult: if command was a COPY FROM STDIN/TO STDOUT, handle it * * Note: Utility function for use by SendQuery() only. * * Returns true if the query executed successfully, false otherwise. */static boolProcessCopyResult(PGresult *results){ bool success = false; if (!results) return false; switch (PQresultStatus(results)) { case PGRES_TUPLES_OK: case PGRES_COMMAND_OK: case PGRES_EMPTY_QUERY: /* nothing to do here */ success = true; break; case PGRES_COPY_OUT: success = handleCopyOut(pset.db, pset.queryFout); break; case PGRES_COPY_IN: if (pset.cur_cmd_interactive && !QUIET()) puts(gettext("Enter data to be copied followed by a newline./n" "End with a backslash and a period on a line by itself.")); success = handleCopyIn(pset.db, pset.cur_cmd_source, pset.cur_cmd_interactive ? get_prompt(PROMPT_COPY) : NULL); break; default: break; } /* may need this to recover from conn loss during COPY */ if (!CheckConnection()) return false; return success;}
开发者ID:sunyangkobe,项目名称:cscd43,代码行数:47,
示例18: PrepareTranGTMintPrepareTranGTM(GlobalTransactionId gxid){ int ret; if (!GlobalTransactionIdIsValid(gxid)) return 0; CheckConnection(); ret = prepare_transaction(conn, gxid); /* * If something went wrong (timeout), try and reset GTM connection. * We will close the transaction locally anyway, and closing GTM will force * it to be closed on GTM. */ if (ret < 0) { CloseGTM(); InitGTM(); } return ret;}
开发者ID:kisehiroshi,项目名称:postgres-xc,代码行数:22,
示例19: SendCommandbool cSQL::SendCommand(const String &request){#ifdef NODB return true;#endif if (!CheckConnection()) { return false; } try { if (mEnableLog) log.push_back(Time().TimeString() + "---" + request); cmd->CommandText = request; cmd->Execute(); return true; } catch (Exception &exception) { return false; }}
开发者ID:firef0xff,项目名称:SQL,代码行数:22,
示例20: BeginTranGTMGlobalTransactionIdBeginTranGTM(GTM_Timestamp *timestamp){ GlobalTransactionId xid = InvalidGlobalTransactionId; CheckConnection(); // TODO Isolation level if (conn) xid = begin_transaction(conn, GTM_ISOLATION_RC, timestamp); /* If something went wrong (timeout), try and reset GTM connection * and retry. This is safe at the beginning of a transaction. */ if (!TransactionIdIsValid(xid)) { CloseGTM(); InitGTM(); if (conn) xid = begin_transaction(conn, GTM_ISOLATION_RC, timestamp); } return xid;}
开发者ID:kisehiroshi,项目名称:postgres-xc,代码行数:22,
示例21: mainint main(){ DBusServer* server; DBusConnection* connection; DBusError error; char* address; dbus_error_init(&error); server = dbus_server_listen("tcp:host=localhost,port=8085", &error); if(!server) { std_log(LOG_FILENAME_LINE, "Error :: %s/n%s",error.name,error.message); std_log(LOG_FILENAME_LINE, "Fail"); create_xml(1); return 1; } address = dbus_server_get_address(server); std_log(LOG_FILENAME_LINE, "Address :; %s",address); connection = dbus_connection_open_private("tcp:host=localhost,port=8085", &error); if(!CheckConnection(connection, &error)) return 1; dbus_connection_close(connection); dbus_connection_unref(connection); dbus_shutdown(); dbus_server_disconnect(server); std_log(LOG_FILENAME_LINE, "SUCCESS"); create_xml(0); return 0;}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:38,
示例22: RegisterGTM/* * Register Given Node * Connection for registering is just used once then closed */intRegisterGTM(GTM_PGXCNodeType type, GTM_PGXCNodePort port, char *datafolder){ int ret; CheckConnection(); if (!conn) return EOF; ret = node_register(conn, type, port, PGXCNodeName, datafolder); /* If something went wrong, retry once */ if (ret < 0) { CloseGTM(); InitGTM(); if (conn) ret = node_register(conn, type, port, PGXCNodeName, datafolder); } return ret;}
开发者ID:kisehiroshi,项目名称:postgres-xc,代码行数:27,
示例23: GetNextValGTM/* * Get the next sequence value */GTM_SequenceGetNextValGTM(char *seqname){ GTM_Sequence ret = -1; GTM_SequenceKeyData seqkey; int status; CheckConnection(); seqkey.gsk_keylen = strlen(seqname) + 1; seqkey.gsk_key = seqname; if (conn) status = get_next(conn, &seqkey, &ret); if (status != GTM_RESULT_OK) { CloseGTM(); InitGTM(); ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR), errmsg("%s", GTMPQerrorMessage(conn)))); } return ret;}
开发者ID:HunterChen,项目名称:postgres-xc,代码行数:26,
示例24: BeginTranAutovacuumGTMGlobalTransactionIdBeginTranAutovacuumGTM(void){ GlobalTransactionId xid = InvalidGlobalTransactionId; CheckConnection(); // TODO Isolation level if (conn) xid = begin_transaction_autovacuum(conn, GTM_ISOLATION_RC); /* * If something went wrong (timeout), try and reset GTM connection and retry. * This is safe at the beginning of a transaction. */ if (!TransactionIdIsValid(xid)) { CloseGTM(); InitGTM(); if (conn) xid = begin_transaction_autovacuum(conn, GTM_ISOLATION_RC); } return xid;}
开发者ID:kisehiroshi,项目名称:postgres-xc,代码行数:23,
示例25: CommitTranGTMintCommitTranGTM(GlobalTransactionId gxid, int waited_xid_count, GlobalTransactionId *waited_xids){ int ret; if (!GlobalTransactionIdIsValid(gxid)) return 0; CheckConnection();#ifdef XCP ret = -1; if (conn)#endif ret = commit_transaction(conn, gxid, waited_xid_count, waited_xids); /* * If something went wrong (timeout), try and reset GTM connection. * We will close the transaction locally anyway, and closing GTM will force * it to be closed on GTM. */ if (ret < 0) { CloseGTM(); InitGTM();#ifdef XCP if (conn) ret = commit_transaction(conn, gxid, waited_xid_count, waited_xids);#endif } /* Close connection in case commit is done by autovacuum worker or launcher */ if (IsAutoVacuumWorkerProcess() || IsAutoVacuumLauncherProcess()) CloseGTM(); currentGxid = InvalidGlobalTransactionId; return ret;}
开发者ID:techdragon,项目名称:Postgres-XL,代码行数:37,
示例26: AcceptResult/* * AcceptResult * * Checks whether a result is valid, giving an error message if necessary; * resets cancelConn as needed, and ensures that the connection to the backend * is still up. * * Returns true for valid result, false for error state. */static boolAcceptResult(const PGresult *result){ bool OK = true; ResetCancelConn(); if (!result) OK = false; else switch (PQresultStatus(result)) { case PGRES_COMMAND_OK: case PGRES_TUPLES_OK: case PGRES_EMPTY_QUERY: case PGRES_COPY_IN: /* Fine, do nothing */ break; case PGRES_COPY_OUT: /* keep cancel connection for copy out state */ SetCancelConn(); break; default: OK = false; break; } if (!OK) { psql_error("%s", PQerrorMessage(pset.db)); CheckConnection(); } return OK;}
开发者ID:sunyangkobe,项目名称:cscd43,代码行数:46,
示例27: CommitPreparedTranGTM/* * For a prepared transaction, commit the gxid used for PREPARE TRANSACTION * and for COMMIT PREPARED. */intCommitPreparedTranGTM(GlobalTransactionId gxid, GlobalTransactionId prepared_gxid){ int ret = 0; if (!GlobalTransactionIdIsValid(gxid) || !GlobalTransactionIdIsValid(prepared_gxid)) return ret; CheckConnection(); ret = commit_prepared_transaction(conn, gxid, prepared_gxid); /* * If something went wrong (timeout), try and reset GTM connection. * We will close the transaction locally anyway, and closing GTM will force * it to be closed on GTM. */ if (ret < 0) { CloseGTM(); InitGTM(); } currentGxid = InvalidGlobalTransactionId; return ret;}
开发者ID:HunterChen,项目名称:postgres-xc,代码行数:28,
示例28: RollbackTranGTMintRollbackTranGTM(GlobalTransactionId gxid){ int ret = -1; if (!GlobalTransactionIdIsValid(gxid)) return 0; CheckConnection(); if (conn) ret = abort_transaction(conn, gxid); /* * If something went wrong (timeout), try and reset GTM connection. * We will abort the transaction locally anyway, and closing GTM will force * it to end on GTM. */ if (ret < 0) { CloseGTM(); InitGTM(); } return ret;}
开发者ID:kisehiroshi,项目名称:postgres-xc,代码行数:24,
注:本文中的CheckConnection函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CheckDlgButton函数代码示例 C++ CheckCondition函数代码示例 |