您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ sqlite3_bind_int64函数代码示例

51自学网 2021-06-03 08:14:55
  C++
这篇教程C++ sqlite3_bind_int64函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中sqlite3_bind_int64函数的典型用法代码示例。如果您正苦于以下问题:C++ sqlite3_bind_int64函数的具体用法?C++ sqlite3_bind_int64怎么用?C++ sqlite3_bind_int64使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了sqlite3_bind_int64函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: oss

  void SerializedMap<T,A>::set(::boost::uint64_t id, const T & value)  {          int result;    try {      // Step 1 is to serialize the object. There is no way to know how big the object will be      // so unfortunately, this will incur an extra copy.            // The binary flag is important here.      std::ostringstream oss(std::ios_base::binary);      oarchive_t oa(oss);      oa << value;	      //std::cout << "Saving " << oss.str().size() << " bytes/n";      // Step 2 is to bind the frameId and data to the insert statement.      // http://sqlite.org/c3ref/bind_blob.html      result = sqlite3_bind_int64(_iStmt, 1, id);      SM_ASSERT_EQ(SqlException, result, SQLITE_OK, "Unable to bind id " << id << " to INSERT statement: " << sqlite3_errmsg(_db->db()));      result = static_cast<int>(sqlite3_bind_blob(_iStmt, 2, oss.str().c_str(), oss.str().size(), SQLITE_TRANSIENT));      SM_ASSERT_EQ(SqlException, result, SQLITE_OK, "Unable to bind blob of size " << oss.str().size() << " to INSERT statement: " << sqlite3_errmsg(_db->db()));      // Finally, we execute the bound insert statement.      result = sqlite3_step(_iStmt);      SM_ASSERT_EQ(SqlException, result, SQLITE_DONE, "Unable to execute INSERT statement for id " << id << " and blob of size " << oss.str().size() << ": " << sqlite3_errmsg(_db->db()));	    }    catch(const SqlException & e)      {	sqlite3_reset(_iStmt);	throw;      }    // After executing, we have to reset the statement    // http://www.sqlite.org/c3ref/step.html    result = sqlite3_reset(_iStmt);    SM_ASSERT_EQ(SqlException, result, SQLITE_OK, "Unable to reset the INSERT  statement: " << sqlite3_errmsg(_db->db()));  }
开发者ID:RIVeR-Lab,项目名称:ihmc-open-robotics-software,代码行数:36,


示例2: __del_container_one_service

static GError *__del_container_one_service(struct sqlx_sqlite3_s *sq3,		struct oio_url_s *url, const char *srvtype, gint64 seq){	static const char *sql = "DELETE FROM services WHERE cid = ? AND srvtype = ? AND seq = ?";	sqlite3_stmt *stmt = NULL;	GError *err = NULL;	int rc;	sqlite3_prepare_debug(rc, sq3->db, sql, -1, &stmt, NULL);	if (rc != SQLITE_OK)		err = M1_SQLITE_GERROR(sq3->db, rc);	else {		(void) sqlite3_bind_blob(stmt, 1, oio_url_get_id(url), oio_url_get_id_size(url), NULL);		(void) sqlite3_bind_text(stmt, 2, srvtype, -1, NULL);		(void) sqlite3_bind_int64(stmt, 3, seq);		sqlite3_step_debug_until_end (rc, stmt);		if (rc != SQLITE_OK && rc != SQLITE_DONE)			err = M1_SQLITE_GERROR(sq3->db, rc);		sqlite3_finalize_debug(rc, stmt);	}	return err;}
开发者ID:cloudcache,项目名称:oio-sds,代码行数:24,


示例3: insert_pr

static boolinsert_pr(struct prbot_pr *pr){    sqlite3_stmt *stmt;    if (sqlite3_prepare(db, INSERT_PR, -1, &stmt, NULL) != SQLITE_OK) {        // Something broke. :(        return false;    }    sqlite3_bind_text(stmt, 1, pr->nick, -1, NULL);    sqlite3_bind_text(stmt, 2, pr->lift, -1, NULL);    sqlite3_bind_int64(stmt, 3, (sqlite3_int64) pr->date);    sqlite3_bind_int(stmt, 4, pr->sets);    sqlite3_bind_int(stmt, 5, pr->reps);    sqlite3_bind_double(stmt, 6, pr->kgs);    if (sqlite3_step(stmt) != SQLITE_DONE) {        // Couldn't run this statement.        return false;    }    if (sqlite3_finalize(stmt)) {        // Couldn't finalize statement.        return false;    }    return true;}
开发者ID:sstangl,项目名称:prbot,代码行数:24,


示例4: _set_id

		SQLiteBundleSet::SQLiteBundleSet(const size_t id, bool persistant, dtn::data::BundleSet::Listener *listener, dtn::data::Size bf_size, dtn::storage::SQLiteDatabase& database)		 : _set_id(id), _bf_size(bf_size), _bf(bf_size * 8), _listener(listener), _consistent(true),_sqldb(database), _persistent(persistant)		{			// if this is a persitant bundle-set			if (_persistent) {				// rebuild the bloom filter				rebuild_bloom_filter();				// load the next expiration from the storage				try {					SQLiteDatabase::Statement st(_sqldb._database, SQLiteDatabase::_sql_queries[SQLiteDatabase::BUNDLE_SET_EXPIRE_NEXT_TIMESTAMP]);					sqlite3_bind_int64(*st, 1, _set_id);					int err = st.step();					if (err == SQLITE_ROW)					{						_next_expiration = sqlite3_column_int64(*st, 0);					}				} catch (const SQLiteDatabase::SQLiteQueryException&) {					// error				}			}		}
开发者ID:adoniscyp,项目名称:ibrdtn,代码行数:24,


示例5: st

		void SQLiteBundleSet::rebuild_bloom_filter()		{			// rebuild the bloom-filter			_bf.clear();			try {				SQLiteDatabase::Statement st(_sqldb._database, SQLiteDatabase::_sql_queries[SQLiteDatabase::BUNDLE_SET_GET_ALL]);				sqlite3_bind_int64(*st, 1, _set_id);				std::set<dtn::data::MetaBundle> ret;				dtn::data::BundleID id;				while (st.step() == SQLITE_ROW)				{					// get the bundle id					get_bundleid(st, id);					id.addTo(_bf);				}				_consistent = true;			} catch (const SQLiteDatabase::SQLiteQueryException&) {				// error			}		}
开发者ID:adoniscyp,项目名称:ibrdtn,代码行数:24,


示例6: term_select

static int term_select(fulltext_vtab *v, const char *zTerm, int nTerm,                       sqlite_int64 iFirst,                       sqlite_int64 *rowid,                       DocList *out){  sqlite3_stmt *s;  int rc = sql_get_statement(v, TERM_SELECT_STMT, &s);  if( rc!=SQLITE_OK ) return rc;  rc = sqlite3_bind_text(s, 1, zTerm, nTerm, SQLITE_TRANSIENT);  if( rc!=SQLITE_OK ) return rc;  rc = sqlite3_bind_int64(s, 2, iFirst);  if( rc!=SQLITE_OK ) return rc;  rc = sql_step_statement(v, TERM_SELECT_STMT, &s);  if( rc!=SQLITE_ROW ) return rc==SQLITE_DONE ? SQLITE_ERROR : rc;  *rowid = sqlite3_column_int64(s, 0);  docListInit(out, DL_POSITIONS_OFFSETS,              sqlite3_column_blob(s, 1), sqlite3_column_bytes(s, 1));  rc = sqlite3_step(s);  return rc==SQLITE_DONE ? SQLITE_OK : rc;}
开发者ID:qtekfun,项目名称:htcDesire820Kernel,代码行数:24,


示例7: SQLITE_BUSY_HANDLED

/* caller must free the memory */csync_file_stat_t *csync_statedb_get_stat_by_hash(CSYNC *ctx,                                                  uint64_t phash){  csync_file_stat_t *st = NULL;  int rc;  if( !ctx || ctx->db_is_empty ) {      return NULL;  }  if( ctx->statedb.by_hash_stmt == NULL ) {      const char *hash_query = "SELECT * FROM metadata WHERE phash=?1";      SQLITE_BUSY_HANDLED(sqlite3_prepare_v2(ctx->statedb.db, hash_query, strlen(hash_query), &ctx->statedb.by_hash_stmt, NULL));      ctx->statedb.lastReturnValue = rc;      if( rc != SQLITE_OK ) {          CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR, "WRN: Unable to create stmt for hash query.");          return NULL;      }  }  if( ctx->statedb.by_hash_stmt == NULL ) {    return NULL;  }  sqlite3_bind_int64(ctx->statedb.by_hash_stmt, 1, (long long signed int)phash);  rc = _csync_file_stat_from_metadata_table(&st, ctx->statedb.by_hash_stmt);  ctx->statedb.lastReturnValue = rc;  if( !(rc == SQLITE_ROW || rc == SQLITE_DONE) )  {      CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR, "WRN: Could not get line from metadata: %d!", rc);  }  sqlite3_reset(ctx->statedb.by_hash_stmt);  return st;}
开发者ID:JamesFmoran,项目名称:client,代码行数:37,


示例8: sqlite3_bind_int64

void QgsOSMXmlImport::readNode( QXmlStreamReader& xml ){  // <node id="2197214" lat="50.0682113" lon="14.4348483" user="viduka" uid="595326" visible="true" version="10" changeset="10714591" timestamp="2012-02-17T19:58:49Z">  QXmlStreamAttributes attrs = xml.attributes();  QgsOSMId id = attrs.value( "id" ).toString().toLongLong();  double lat = attrs.value( "lat" ).toString().toDouble();  double lon = attrs.value( "lon" ).toString().toDouble();  // insert to DB  sqlite3_bind_int64( mStmtInsertNode, 1, id );  sqlite3_bind_double( mStmtInsertNode, 2, lat );  sqlite3_bind_double( mStmtInsertNode, 3, lon );  if ( sqlite3_step( mStmtInsertNode ) != SQLITE_DONE )  {    xml.raiseError( QString( "Storing node %1 failed." ).arg( id ) );  }  sqlite3_reset( mStmtInsertNode );  while ( !xml.atEnd() )  {    xml.readNext();    if ( xml.isEndElement() ) // </node>      break;    if ( xml.isStartElement() )    {      if ( xml.name() == "tag" )        readTag( false, id, xml );      else        xml.raiseError( "Invalid tag in <node>" );    }  }}
开发者ID:Br1ndavoine,项目名称:QGIS,代码行数:36,


示例9: irc_sq_lite_db_Insert

void irc_sq_lite_db_Insert (IRCMessage* message) {	char* commandText;	sqlite3_stmt* statement;	sqlite3_stmt* _tmp0_ = NULL;	sqlite3_stmt* _tmp1_;	g_return_if_fail (message != NULL);	if (irc_sq_lite_db_DataBase == NULL) {		fprintf (stdout, "Datenbank wird erstellt!/n");		irc_sq_lite_db_CreateDB ();	}	commandText = g_strdup ("INSERT INTO MyLogData (Username, Message, Channel, Server, Timestamp) " /"VALUES (@1, @2, @3, @4, @5)");	statement = NULL;	sqlite3_prepare_v2 (irc_sq_lite_db_DataBase, commandText, -1, &_tmp0_, NULL);	statement = (_tmp1_ = _tmp0_, _sqlite3_finalize0 (statement), _tmp1_);	sqlite3_bind_text (statement, 1, g_strdup (irc_message_get_Username (message)), -1, g_free);	sqlite3_bind_text (statement, 2, g_strdup (irc_message_get_MessageContent (message)), -1, g_free);	sqlite3_bind_text (statement, 3, g_strdup (irc_message_get_Channel (message)), -1, g_free);	sqlite3_bind_text (statement, 4, g_strdup (irc_message_get_Server (message)), -1, g_free);	sqlite3_bind_int64 (statement, 5, irc_message_get_UnixTime (message));	sqlite3_step (statement);	_sqlite3_finalize0 (statement);	_g_free0 (commandText);}
开发者ID:dimitrovventzislav,项目名称:IRCClient,代码行数:24,


示例10: gf_sqlite3_find_unchanged_for_time

/* * Find unchanged files from a specified time from the DB * Input: *      query_callback  :       query callback fuction to handle *                              result records from the query *      for_time        :        Time from where the file/s are not changed * */intgf_sqlite3_find_unchanged_for_time (void *db_conn,                                        gf_query_callback_t query_callback,                                        void *query_cbk_args,                                        gfdb_time_t *for_time){        int ret                                 =       -1;        char *query_str                         =       NULL;        gf_sql_connection_t *sql_conn           =       db_conn;        sqlite3_stmt *prep_stmt                 =       NULL;        long int  for_time_usec                =       0;        CHECK_SQL_CONN (sql_conn, out);        GF_VALIDATE_OR_GOTO(GFDB_STR_SQLITE3, query_callback, out);        query_str = "select GF_FILE_TB.GF_ID,"                " (select group_concat( GF_PID || ',' || FNAME || ','"                " || FPATH || ',' || W_DEL_FLAG ||',' || LINK_UPDATE , '::')"                " from GF_FLINK_TB where GF_FILE_TB.GF_ID = GF_FLINK_TB.GF_ID)"                "  from GF_FILE_TB where "                /*First condition: For writes*/                "((" GF_COL_TB_WSEC " * " TOSTRING(GFDB_MICROSEC) " + "                GF_COL_TB_WMSEC ") <= ? )"                " OR "                /*Second condition: For reads*/                "((" GF_COL_TB_RWSEC " * " TOSTRING(GFDB_MICROSEC) " + "                GF_COL_TB_RWMSEC ") <= ?)";        for_time_usec = gfdb_time_2_usec(for_time);        ret = sqlite3_prepare(sql_conn->sqlite3_db_conn, query_str, -1,                                &prep_stmt, 0);        if (ret != SQLITE_OK) {                gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,                        "Failed preparing statment %s : %s", query_str,                        sqlite3_errmsg(sql_conn->sqlite3_db_conn));                ret = -1;                goto out;        }        /*Bind write wind time*/        ret = sqlite3_bind_int64(prep_stmt, 1, for_time_usec);        if (ret != SQLITE_OK) {                gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,                        "Failed binding for_time_usec %ld : %s", for_time_usec,                        sqlite3_errmsg(sql_conn->sqlite3_db_conn));                ret = -1;                goto out;        }        /*Bind read wind time*/        ret = sqlite3_bind_int64(prep_stmt, 2, for_time_usec);        if (ret != SQLITE_OK) {                gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,                        "Failed binding for_time_usec %ld : %s", for_time_usec,                        sqlite3_errmsg(sql_conn->sqlite3_db_conn));                ret = -1;                goto out;        }        /*Execute the query*/        ret = gf_sql_query_function(prep_stmt, query_callback, query_cbk_args);        if (ret) {                gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,                        "Failed Query %s", query_str);                goto out;        }        ret = 0;out:        sqlite3_finalize(prep_stmt);        return ret;}
开发者ID:ernetas,项目名称:glusterfs,代码行数:80,


示例11: sqlite3_bind_parameter_index

// Bind a 64bits int value to a parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statementvoid Statement::bind(const char* apName, const sqlite3_int64& aValue){    int index = sqlite3_bind_parameter_index(mStmtPtr, apName);    int ret   = sqlite3_bind_int64(mStmtPtr, index, aValue);    check(ret);}
开发者ID:rAndom69,项目名称:WTTSC,代码行数:7,


示例12: db_share_files

int db_share_files( const struct pub_file *files, size_t count, const struct client *owner ){        /* todo: do it in transaction */        while ( count-- > 0 ) {                sqlite3_stmt *stmt;                const char *ext;                int ext_len;                int i;                uint64_t fid;                if ( !files->name_len ) {                        files++;                        continue;                }                fid = MAKE_FID(files->hash);                // find extension                ext = file_extension(files->name, files->name_len);                if ( ext )                         ext_len = files->name + files->name_len - ext;                else                        ext_len = 0;                i=1;                stmt = s_stmt[SHARE_UPD];                DB_CHECK( SQLITE_OK == sqlite3_reset(stmt) );                DB_CHECK( SQLITE_OK == sqlite3_bind_text(stmt, i++, files->name, files->name_len, SQLITE_STATIC) );                DB_CHECK( SQLITE_OK == sqlite3_bind_text(stmt, i++, ext, ext_len, SQLITE_STATIC) );                DB_CHECK( SQLITE_OK == sqlite3_bind_int64(stmt, i++, files->size) );                DB_CHECK( SQLITE_OK == sqlite3_bind_int(stmt, i++, files->type) );                DB_CHECK( SQLITE_OK == sqlite3_bind_int(stmt, i++, files->media_length) );                DB_CHECK( SQLITE_OK == sqlite3_bind_int(stmt, i++, files->media_bitrate) );                DB_CHECK( SQLITE_OK == sqlite3_bind_text(stmt, i++, files->media_codec, files->media_codec_len, SQLITE_STATIC) );                DB_CHECK( SQLITE_OK == sqlite3_bind_int64(stmt, i++,  fid) );                DB_CHECK( SQLITE_DONE == sqlite3_step(stmt) );                if ( !sqlite3_changes(s_db) ) {                        i=1;                        stmt = s_stmt[SHARE_INS];                        DB_CHECK( SQLITE_OK == sqlite3_reset(stmt) );                        DB_CHECK( SQLITE_OK == sqlite3_bind_int64(stmt, i++,  fid) );                        DB_CHECK( SQLITE_OK == sqlite3_bind_blob(stmt, i++, files->hash, sizeof(files->hash), SQLITE_STATIC) );                        DB_CHECK( SQLITE_OK == sqlite3_bind_text(stmt, i++, files->name, files->name_len, SQLITE_STATIC) );                        DB_CHECK( SQLITE_OK == sqlite3_bind_text(stmt, i++, ext, ext_len, SQLITE_STATIC) );                        DB_CHECK( SQLITE_OK == sqlite3_bind_int64(stmt, i++, files->size) );                        DB_CHECK( SQLITE_OK == sqlite3_bind_int(stmt, i++, files->type) );                        DB_CHECK( SQLITE_OK == sqlite3_bind_int(stmt, i++, files->media_length) );                        DB_CHECK( SQLITE_OK == sqlite3_bind_int(stmt, i++, files->media_bitrate) );                        DB_CHECK( SQLITE_OK == sqlite3_bind_text(stmt, i++, files->media_codec, files->media_codec_len, SQLITE_STATIC) );                        DB_CHECK( SQLITE_DONE == sqlite3_step(stmt) );                }                i=1;                stmt = s_stmt[SHARE_SRC];                DB_CHECK( SQLITE_OK == sqlite3_reset(stmt) );                DB_CHECK( SQLITE_OK == sqlite3_bind_int64(stmt, i++, fid) );                DB_CHECK( SQLITE_OK == sqlite3_bind_int64(stmt, i++, MAKE_SID(owner)) );                DB_CHECK( SQLITE_OK == sqlite3_bind_int(stmt, i++, files->complete) );                DB_CHECK( SQLITE_OK == sqlite3_bind_int(stmt, i++, files->rating) );                DB_CHECK( SQLITE_DONE == sqlite3_step(stmt) );                files++;        }        return 1;failed:        ED2KD_LOGERR("failed to add file to db (%s)", sqlite3_errmsg(s_db));        return 0;}
开发者ID:nexie,项目名称:ed2kd,代码行数:72,


示例13: THROW_ERR

 statement& statement::bind(int idx, uint64_t value) {     THROW_ERR(sqlite3_bind_int64(stmt_, idx, static_cast<int64_t>(value)));     return *this; }
开发者ID:larroy,项目名称:sqlite3pp,代码行数:5,


示例14: db_execute

static VALUE db_execute(int argc, VALUE *argv, VALUE self){	sqlite3 * db = NULL;	void **ppDB = NULL;			sqlite3_stmt *statement = NULL;	const char* sql = NULL;	VALUE arRes = rb_ary_new();    VALUE* colNames = NULL;	int nRes = 0;    char * szErrMsg = 0;    int is_batch = 0;	if ((argc < 2) || (argc > 3))		rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc);		Data_Get_Struct(self, void *, ppDB);	db = (sqlite3 *)rho_db_get_handle(*ppDB);	sql = RSTRING_PTR(argv[0]);    is_batch = argv[1] == Qtrue ? 1 : 0;    RAWTRACE1("db_execute: %s", sql);    PROF_START_CREATED("SQLITE");    if ( is_batch )    {        PROF_START_CREATED("SQLITE_EXEC");        rho_db_lock(*ppDB);        nRes = sqlite3_exec(db, sql,  NULL, NULL, &szErrMsg);        rho_db_unlock(*ppDB);        PROF_STOP("SQLITE_EXEC");    }    else    {        rho_db_lock(*ppDB);        PROF_START_CREATED("SQLITE_PREPARE");        nRes = rho_db_prepare_statement(*ppDB, sql, -1, &statement);        PROF_STOP("SQLITE_PREPARE");        //nRes = sqlite3_prepare_v2(db, sql, -1, &statement, NULL);        if ( nRes != SQLITE_OK)        {            szErrMsg = (char *)sqlite3_errmsg(db);            rho_db_unlock(*ppDB);            rb_raise(rb_eArgError, "could not prepare statement: %d; Message: %s",nRes, (szErrMsg?szErrMsg:""));        }        if ( argc > 2 )        {            int i = 0;            VALUE args = argv[2];            if ( RARRAY_LEN(args) > 0 && TYPE(RARRAY_PTR(args)[0]) == T_ARRAY )                args = RARRAY_PTR(args)[0];            for( ; i < RARRAY_LEN(args); i++ )            {                VALUE arg = RARRAY_PTR(args)[i];                if (NIL_P(arg))                {                    sqlite3_bind_null(statement, i+1);                    continue;                }                switch( TYPE(arg) )                {                case T_STRING:                    sqlite3_bind_text(statement, i+1, RSTRING_PTR(arg), RSTRING_LEN(arg), SQLITE_TRANSIENT);                    break;                case T_FLOAT:                    sqlite3_bind_double(statement, i+1, NUM2DBL(arg));                    break;                case T_FIXNUM:                case T_BIGNUM:                    sqlite3_bind_int64(statement, i+1, NUM2LL(arg));                    break;                default:					{						VALUE strVal = rb_funcall(arg, rb_intern("to_s"), 0);		                    sqlite3_bind_text(statement, i+1, RSTRING_PTR(strVal), -1, SQLITE_TRANSIENT);						}					break;                }            }        }        PROF_START_CREATED("SQLITE_EXEC");        nRes = sqlite3_step(statement);        PROF_STOP("SQLITE_EXEC");	    while( nRes== SQLITE_ROW ) {		    int nCount = sqlite3_data_count(statement);		    int nCol = 0;		    VALUE hashRec = rb_hash_new();            //if ( !colNames )            //    colNames = getColNames(statement, nCount);		    for(;nCol<nCount;nCol++){			    int nColType = sqlite3_column_type(statement,nCol);//.........这里部分代码省略.........
开发者ID:algernon83,项目名称:rhodes,代码行数:101,


示例15: Q_UNUSED

void QgsOSMDatabase::exportSpatiaLiteWays( bool closed, const QString& tableName,    const QStringList& tagKeys,    const QStringList& notNullTagKeys ){  Q_UNUSED( tagKeys );  QString sqlInsertLine = QString( "INSERT INTO %1 VALUES (?" ).arg( quotedIdentifier( tableName ) );  for ( int i = 0; i < tagKeys.count(); ++i )    sqlInsertLine += QString( ",?" );  sqlInsertLine += ", GeomFromWKB(?, 4326))";  sqlite3_stmt* stmtInsert;  if ( sqlite3_prepare_v2( mDatabase, sqlInsertLine.toUtf8().constData(), -1, &stmtInsert, nullptr ) != SQLITE_OK )  {    mError = "Prepare SELECT FROM ways failed.";    return;  }  QgsOSMWayIterator ways = listWays();  QgsOSMWay w;  while (( w = ways.next() ).isValid() )  {    QgsOSMTags t = tags( true, w.id() );    QgsPolyline polyline = wayPoints( w.id() );    if ( polyline.count() < 2 )      continue; // invalid way    bool isArea = ( polyline.first() == polyline.last() ); // closed way?    // filter out closed way that are not areas through tags    if ( isArea && ( t.contains( "highway" ) || t.contains( "barrier" ) ) )    {      // make sure tags that indicate areas are taken into consideration when deciding on a closed way is or isn't an area      // and allow for a closed way to be exported both as a polygon and a line in case both area and non-area tags are present      if (( t.value( "area" ) != "yes" && !t.contains( "amenity" ) && !t.contains( "landuse" ) && !t.contains( "building" ) && !t.contains( "natural" ) && !t.contains( "leisure" ) && !t.contains( "aeroway" ) ) || !closed )        isArea = false;    }    if ( closed != isArea )      continue; // skip if it's not what we're looking for    //check not null tags    bool skipNull = false;    for ( int i = 0; i < notNullTagKeys.count() && !skipNull; ++i )      if ( !t.contains( notNullTagKeys[i] ) )        skipNull = true;    if ( skipNull )      continue;    QgsGeometry geom = closed ? QgsGeometry::fromPolygon( QgsPolygon() << polyline ) : QgsGeometry::fromPolyline( polyline );    int col = 0;    sqlite3_bind_int64( stmtInsert, ++col, w.id() );    // tags    for ( int i = 0; i < tagKeys.count(); ++i )    {      if ( t.contains( tagKeys[i] ) )        sqlite3_bind_text( stmtInsert, ++col, t.value( tagKeys[i] ).toUtf8().constData(), -1, SQLITE_TRANSIENT );      else        sqlite3_bind_null( stmtInsert, ++col );    }    if ( !geom.isEmpty() )      sqlite3_bind_blob( stmtInsert, ++col, geom.asWkb(), ( int ) geom.wkbSize(), SQLITE_STATIC );    else      sqlite3_bind_null( stmtInsert, ++col );    int insertRes = sqlite3_step( stmtInsert );    if ( insertRes != SQLITE_DONE )    {      mError = QString( "Error inserting way %1 [%2]" ).arg( w.id() ).arg( insertRes );      break;    }    sqlite3_reset( stmtInsert );    sqlite3_clear_bindings( stmtInsert );  }  sqlite3_finalize( stmtInsert );}
开发者ID:NyakudyaA,项目名称:QGIS,代码行数:81,


示例16: DatabaseException

void Database::Statement::bind(int parameter, uint64_t value){	if(!parameter) return;	if(sqlite3_bind_int64(mStmt, parameter, sqlite3_int64(value)) != SQLITE_OK)		throw DatabaseException(mDb, String("Unable to bind parameter ") + String::number(parameter));}
开发者ID:paullouisageneau,项目名称:Teapotnet,代码行数:6,


示例17: result_or_bind

static voidresult_or_bind(sqlite3_context *ctx, sqlite3_stmt *stmt, int idx,	       char *data, int len, int type){    char *endp;    if (!data) {	if (ctx) {	    sqlite3_result_null(ctx);	} else {	    sqlite3_bind_null(stmt, idx);	}	return;    }    if (type == SQLITE_INTEGER) {	sqlite_int64 val;#if defined(_WIN32) || defined(_WIN64)	char endc;	if (sscanf(data, "%I64d%c", &val, &endc) == 1) {	    if (ctx) {		sqlite3_result_int64(ctx, val);	    } else {		sqlite3_bind_int64(stmt, idx, val);	    }	    return;	}#else	endp = 0;#ifdef __osf__	val = strtol(data, &endp, 0);#else	val = strtoll(data, &endp, 0);#endif	if (endp && (endp != data) && !*endp) {	    if (ctx) {		sqlite3_result_int64(ctx, val);	    } else {		sqlite3_bind_int64(stmt, idx, val);	    }	    return;	}#endif    } else if (type == SQLITE_FLOAT) {	double val;	endp = 0;	val = strtod(data, &endp);	if (endp && (endp != data) && !*endp) {	    if (ctx) {		sqlite3_result_double(ctx, val);	    } else {		sqlite3_bind_double(stmt, idx, val);	    }	    return;	}    }    if (ctx) {	sqlite3_result_text(ctx, data, len, SQLITE_TRANSIENT);    } else {	sqlite3_bind_text(stmt, idx, data, len, SQLITE_TRANSIENT);    }}
开发者ID:softace,项目名称:sqliteodbc,代码行数:63,


示例18: main

//.........这里部分代码省略.........    pk = 0;    for (ix = 0; ix < 1000; ix++)      {	  x = 1000000.0 + (ix * 10.0);	  for (iy = 0; iy < 1000; iy++)	    {/* this double loop will insert 1 million rows into the the test table */		y = 4000000.0 + (iy * 10.0);		pk++;		if ((pk % 25000) == 0)		  {		      t1 = clock ();		      printf ("insert row: %d/t/t[elapsed time: %1.3f]/n",			      pk, (double) (t1 - t0) / CLOCKS_PER_SEC);		  }/* preparing the geometry to insert */		geo = gaiaAllocGeomColl ();		geo->Srid = 3003;		gaiaAddPointToGeomColl (geo, x, y);/* transforming this geometry into the SpatiaLite BLOB format */		gaiaToSpatiaLiteBlobWkb (geo, &blob, &blob_size);/* we can now destroy the geometry object */		gaiaFreeGeomColl (geo);/* resetting Prepared Statement and bindings */		sqlite3_reset (stmt);		sqlite3_clear_bindings (stmt);/* binding parameters to Prepared Statement */		sqlite3_bind_int64 (stmt, 1, pk);		sqlite3_bind_blob (stmt, 2, blob, blob_size, free);/* performing actual row insert */		ret = sqlite3_step (stmt);		if (ret == SQLITE_DONE || ret == SQLITE_ROW)		    ;		else		  {/* an unexpected error occurred */		      printf ("sqlite3_step() error: %s/n",			      sqlite3_errmsg (handle));		      sqlite3_finalize (stmt);		      goto abort;		  }	    }      }/* we have now to finalize the query [memory cleanup] */    sqlite3_finalize (stmt);/*committing the transaction*** this step is absolutely critical ***if we don't confirm the still pending transaction,any update will be lost*/    strcpy (sql, "COMMIT");    ret = sqlite3_exec (handle, sql, NULL, NULL, &err_msg);
开发者ID:kochizufan,项目名称:spatiasql.js,代码行数:67,


示例19: hdb_sqlite_store

/** * Stores an hdb_entry in the database. If flags contains HDB_F_REPLACE * a previous entry may be replaced. * * @param context The current krb5_context * @param db      Heimdal database handle * @param flags   May currently only contain HDB_F_REPLACE * @param entry   The data to store * * @return        0 if everything worked, an error code if not */static krb5_error_codehdb_sqlite_store(krb5_context context, HDB *db, unsigned flags,                 hdb_entry_ex *entry){    int ret;    int i;    sqlite_int64 entry_id;    char *principal_string = NULL;    char *alias_string;    const HDB_Ext_Aliases *aliases;    hdb_sqlite_db *hsdb = (hdb_sqlite_db *)(db->hdb_db);    krb5_data value;    sqlite3_stmt *get_ids = hsdb->get_ids;    ret = hdb_sqlite_exec_stmt(context, hsdb->db,                               "BEGIN IMMEDIATE TRANSACTION", EINVAL);    if(ret != SQLITE_OK) {        krb5_set_error_string(context, "SQLite BEGIN TRANSACTION failed: %s",                              sqlite3_errmsg(hsdb->db));        goto rollback;    }        ret = krb5_unparse_name(context,                            entry->entry.principal, &principal_string);    if (ret) {        goto rollback;    }    ret = hdb_seal_keys(context, db, &entry->entry);    if(ret) {        goto rollback;    }    ret = hdb_entry2value(context, &entry->entry, &value);    if(ret) {        goto rollback;    }    sqlite3_bind_text(get_ids, 1, principal_string, -1, SQLITE_STATIC);    ret = hdb_sqlite_step(context, hsdb->db, get_ids);    if(ret == SQLITE_DONE) { /* No such principal */        sqlite3_bind_blob(hsdb->add_entry, 1,                          value.data, value.length, SQLITE_STATIC);        ret = hdb_sqlite_step(context, hsdb->db, hsdb->add_entry);        sqlite3_clear_bindings(hsdb->add_entry);        sqlite3_reset(hsdb->add_entry);        if(ret != SQLITE_DONE)            goto rollback;        sqlite3_bind_text(hsdb->add_principal, 1,                          principal_string, -1, SQLITE_STATIC);        ret = hdb_sqlite_step(context, hsdb->db, hsdb->add_principal);        sqlite3_clear_bindings(hsdb->add_principal);        sqlite3_reset(hsdb->add_principal);        if(ret != SQLITE_DONE)            goto rollback;        entry_id = sqlite3_column_int64(get_ids, 1);            } else if(ret == SQLITE_ROW) { /* Found a principal */        if(! (flags & HDB_F_REPLACE)) /* Not allowed to replace it */            goto rollback;        entry_id = sqlite3_column_int64(get_ids, 1);        sqlite3_bind_int64(hsdb->delete_aliases, 1, entry_id);        ret = hdb_sqlite_step_once(context, db, hsdb->delete_aliases);        if(ret != SQLITE_DONE)            goto rollback;        sqlite3_bind_blob(hsdb->update_entry, 1,                          value.data, value.length, SQLITE_STATIC);        sqlite3_bind_int64(hsdb->update_entry, 2, entry_id);        ret = hdb_sqlite_step_once(context, db, hsdb->update_entry);        if(ret != SQLITE_DONE)            goto rollback;    } else {	/* Error! */        goto rollback;    }    ret = hdb_entry_get_aliases(&entry->entry, &aliases);    if(ret || aliases == NULL)        goto commit;//.........这里部分代码省略.........
开发者ID:SimonWilkinson,项目名称:heimdal,代码行数:101,


示例20: vxpath_read_row

static voidvxpath_read_row (VirtualXPathCursorPtr cursor){/* trying to read a row from the real-table */    sqlite3_stmt *stmt;    int ret;    sqlite3_int64 pk;    int eof;    if (cursor->stmt == NULL || cursor->xpathExpr == NULL)	return;    if (cursor->xpathObj)	xmlXPathFreeObject (cursor->xpathObj);    if (cursor->xpathContext)	xmlXPathFreeContext (cursor->xpathContext);    if (cursor->xmlDoc)	xmlFreeDoc (cursor->xmlDoc);    cursor->xmlDoc = NULL;    cursor->xpathContext = NULL;    cursor->xpathObj = NULL;    stmt = cursor->stmt;    sqlite3_bind_int64 (stmt, 1, cursor->current_row);    while (1)      {	  ret = sqlite3_step (stmt);	  if (ret == SQLITE_ROW)	    {		pk = sqlite3_column_int64 (stmt, 0);		/* filtering the PK value */		eof = 0;		switch (cursor->keyOp1)		  {		  case SQLITE_INDEX_CONSTRAINT_EQ:		      if (pk > cursor->keyVal1)			  eof = 1;		      break;		  case SQLITE_INDEX_CONSTRAINT_LT:		      if (pk >= cursor->keyVal1)			  eof = 1;		      break;		  case SQLITE_INDEX_CONSTRAINT_LE:		      if (pk > cursor->keyVal1)			  eof = 1;		      break;		  };		switch (cursor->keyOp2)		  {		  case SQLITE_INDEX_CONSTRAINT_EQ:		      if (pk > cursor->keyVal2)			  eof = 1;		      break;		  case SQLITE_INDEX_CONSTRAINT_LT:		      if (pk >= cursor->keyVal2)			  eof = 1;		      break;		  case SQLITE_INDEX_CONSTRAINT_LE:		      if (pk > cursor->keyVal2)			  eof = 1;		      break;		  };		if (eof)		  {		      cursor->eof = 1;		      return;		  }		if (sqlite3_column_type (stmt, 1) == SQLITE_BLOB)		  {		      xmlDocPtr xml_doc;		      int xml_len;		      unsigned char *xml;		      const unsigned char *blob = sqlite3_column_blob (stmt, 1);		      int size = sqlite3_column_bytes (stmt, 1);		      gaiaXmlFromBlob (blob, size, -1, &xml, &xml_len);		      if (!xml)			  continue;		      xml_doc =			  xmlReadMemory ((const char *) xml, xml_len,					 "noname.xml", NULL, 0);		      if (xml_doc != NULL)			{			    xmlXPathContextPtr xpathCtx;			    xmlXPathObjectPtr xpathObj;			    if (vxpath_eval_expr				(cursor->pVtab->p_cache, xml_doc,				 cursor->xpathExpr, &xpathCtx, &xpathObj))			      {				  free (xml);				  if (cursor->xpathObj)				      xmlXPathFreeObject (cursor->xpathObj);				  if (cursor->xpathContext)				      xmlXPathFreeContext					  (cursor->xpathContext);				  if (cursor->xmlDoc)				      xmlFreeDoc (cursor->xmlDoc);				  cursor->xmlDoc = xml_doc;				  cursor->xpathContext = xpathCtx;				  cursor->xpathObj = xpathObj;				  cursor->xpathIdx = 0;//.........这里部分代码省略.........
开发者ID:MarkusMattinen,项目名称:libspatialite,代码行数:101,


示例21: sqlite3_bind_int64

 int statement::bind(int idx, sqlite3_int64 value) {   return sqlite3_bind_int64(stmt_, idx, value); }
开发者ID:brettin,项目名称:taxator-tk,代码行数:4,


示例22: pkg_repo_binary_register_conflicts

static intpkg_repo_binary_register_conflicts(const char *origin, char **conflicts,		int conflicts_num, sqlite3 *sqlite){	const char clean_conflicts_sql[] = ""			"DELETE FROM pkg_conflicts "			"WHERE package_id = ?1;";	const char select_id_sql[] = ""			"SELECT id FROM packages "			"WHERE origin = ?1;";	const char insert_conflict_sql[] = ""			"INSERT INTO pkg_conflicts "			"(package_id, conflict_id) "			"VALUES (?1, ?2);";	sqlite3_stmt *stmt = NULL;	int ret, i;	int64_t origin_id, conflict_id;	pkg_debug(4, "pkgdb_repo_register_conflicts: running '%s'", select_id_sql);	if (sqlite3_prepare_v2(sqlite, select_id_sql, -1, &stmt, NULL) != SQLITE_OK) {		ERROR_SQLITE(sqlite, select_id_sql);		return (EPKG_FATAL);	}	sqlite3_bind_text(stmt, 1, origin, -1, SQLITE_TRANSIENT);	ret = sqlite3_step(stmt);	if (ret == SQLITE_ROW) {		origin_id = sqlite3_column_int64(stmt, 0);	}	else {		ERROR_SQLITE(sqlite, select_id_sql);		return (EPKG_FATAL);	}	sqlite3_finalize(stmt);	pkg_debug(4, "pkgdb_repo_register_conflicts: running '%s'", clean_conflicts_sql);	if (sqlite3_prepare_v2(sqlite, clean_conflicts_sql, -1, &stmt, NULL) != SQLITE_OK) {		ERROR_SQLITE(sqlite, clean_conflicts_sql);		return (EPKG_FATAL);	}	sqlite3_bind_int64(stmt, 1, origin_id);	/* Ignore cleanup result */	(void)sqlite3_step(stmt);	sqlite3_finalize(stmt);	for (i = 0; i < conflicts_num; i ++) {		/* Select a conflict */		pkg_debug(4, "pkgdb_repo_register_conflicts: running '%s'", select_id_sql);		if (sqlite3_prepare_v2(sqlite, select_id_sql, -1, &stmt, NULL) != SQLITE_OK) {			ERROR_SQLITE(sqlite, select_id_sql);			return (EPKG_FATAL);		}		sqlite3_bind_text(stmt, 1, conflicts[i], -1, SQLITE_TRANSIENT);		ret = sqlite3_step(stmt);		if (ret == SQLITE_ROW) {			conflict_id = sqlite3_column_int64(stmt, 0);		}		else {			ERROR_SQLITE(sqlite, select_id_sql);			return (EPKG_FATAL);		}		sqlite3_finalize(stmt);		/* Insert a pair */		pkg_debug(4, "pkgdb_repo_register_conflicts: running '%s'", insert_conflict_sql);		if (sqlite3_prepare_v2(sqlite, insert_conflict_sql, -1, &stmt, NULL) != SQLITE_OK) {			ERROR_SQLITE(sqlite, insert_conflict_sql);			return (EPKG_FATAL);		}		sqlite3_bind_int64(stmt, 1, origin_id);		sqlite3_bind_int64(stmt, 2, conflict_id);		ret = sqlite3_step(stmt);		if (ret != SQLITE_DONE) {			ERROR_SQLITE(sqlite, insert_conflict_sql);			return (EPKG_FATAL);		}		sqlite3_finalize(stmt);	}	return (EPKG_OK);}
开发者ID:zxombie,项目名称:pkg,代码行数:90,


示例23: database_error

void sqlite3_command::bind(int index, long long data) {	if(sqlite3_bind_int64(this->stmt, index, data)!=SQLITE_OK)		throw database_error(this->con);}
开发者ID:Tudi,项目名称:PG2-firewall,代码行数:4,


示例24: db_search_files

//.........这里部分代码省略.........        }        if ( params.maxsize ) {                strcat(query, " AND f.size<?");        }        if ( params.srcavail ) {                strcat(query, " AND f.srcavail>?");        }        if ( params.srccomplete ) {                strcat(query, " AND f.srccomplete>?");        }        if ( params.minbitrate ) {                strcat(query, " AND f.mbitrate>?");        }        if ( params.minlength ) {                strcat(query, " AND f.mlength>?");        }        if ( params.type_node ) {                strcat(query, " AND f.type=?");        }        strcat(query, " LIMIT ?");        DB_CHECK( SQLITE_OK == sqlite3_prepare_v2(s_db, query, strlen(query)+1, &stmt, &tail) );        i=1;        DB_CHECK( SQLITE_OK == sqlite3_bind_text(stmt, i++, params.name_term, params.name_len+1, SQLITE_STATIC) );        if ( params.ext_node ) {                DB_CHECK( SQLITE_OK == sqlite3_bind_text(stmt, i++, params.ext_node->str_val, params.ext_node->str_len, SQLITE_STATIC) );        }        if ( params.codec_node ) {                DB_CHECK( SQLITE_OK == sqlite3_bind_text(stmt, i++, params.codec_node->str_val, params.codec_node->str_len, SQLITE_STATIC) );        }        if ( params.minsize ) {                DB_CHECK( SQLITE_OK == sqlite3_bind_int64(stmt, i++, params.minsize) );        }        if ( params.maxsize ) {                DB_CHECK( SQLITE_OK == sqlite3_bind_int64(stmt, i++, params.maxsize) );        }        if ( params.srcavail ) {                DB_CHECK( SQLITE_OK == sqlite3_bind_int64(stmt, i++, params.srcavail) );        }        if ( params.srccomplete ) {                DB_CHECK( SQLITE_OK == sqlite3_bind_int64(stmt, i++, params.srccomplete) );        }        if ( params.minbitrate ) {                DB_CHECK( SQLITE_OK == sqlite3_bind_int64(stmt, i++, params.minbitrate) );        }        if ( params.minlength ) {                DB_CHECK( SQLITE_OK == sqlite3_bind_int64(stmt, i++, params.minlength) );        }        if ( params.type_node ) {                uint8_t type = get_ed2k_file_type(params.type_node->str_val, params.type_node->str_len);                DB_CHECK( SQLITE_OK == sqlite3_bind_int(stmt, i++, type) );        }        DB_CHECK( SQLITE_OK == sqlite3_bind_int(stmt, i++, *count) );        i = 0;        while ( ((err = sqlite3_step(stmt)) == SQLITE_ROW) && (i < *count) ) {                struct search_file sfile;                uint64_t sid;                int col = 0;                memset(&sfile, 0, sizeof sfile);                sfile.hash = (const unsigned char*)sqlite3_column_blob(stmt, col++);
开发者ID:nexie,项目名称:ed2kd,代码行数:67,


示例25: CHECK_DB_HANDLE

int PinnedMediaDBManager::selectPinnedMediaItem(const std::string& object_id, u64 device_id, PinnedMediaItem& output_pinned_media_item){    int rv = 0;    int rc;    static const char* SQL_SELECT_PINNED_MEDIA_ITEM_BY_OBJECT_ID_AND_DEVICE_ID =            "SELECT path, object_id, device_id "            "FROM pin_item "            "WHERE object_id=? AND device_id=?";    sqlite3_stmt *stmt = NULL;    CHECK_DB_HANDLE(rv, m_db, end);    rc = sqlite3_prepare_v2(m_db, SQL_SELECT_PINNED_MEDIA_ITEM_BY_OBJECT_ID_AND_DEVICE_ID, -1, &stmt, NULL);    CHECK_PREPARE(rv, rc, SQL_SELECT_PINNED_MEDIA_ITEM_BY_OBJECT_ID_AND_DEVICE_ID, m_db, end);    rc = sqlite3_bind_text(stmt, 1, object_id.c_str(), -1, SQLITE_STATIC);    CHECK_BIND(rv, rc, m_db, end);    rc = sqlite3_bind_int64(stmt, 2, device_id);    CHECK_BIND(rv, rc, m_db, end);    {        std::string path;        std::string object_id;        u64 device_id;        int sql_type;        rc = sqlite3_step(stmt);        CHECK_STEP(rv, rc, m_db, end);        CHECK_ROW_EXIST(rv, rc, m_db, end);        sql_type = sqlite3_column_type(stmt, 0);        if (sql_type == SQLITE_TEXT) {            path = reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0));        } else {            LOG_WARN("Bad column type index: %d", 0);            rv = -1;            goto end;        }        sql_type = sqlite3_column_type(stmt, 1);        if (sql_type == SQLITE_TEXT) {            object_id = reinterpret_cast<const char*>(sqlite3_column_text(stmt, 1));        } else {            LOG_WARN("Bad column type index: %d", 1);            rv = -1;            goto end;        }        sql_type = sqlite3_column_type(stmt, 2);        if (sql_type == SQLITE_INTEGER) {            device_id = sqlite3_column_int64(stmt, 2);        } else {            LOG_WARN("Bad column type index: %d", 2);            rv = -1;            goto end;        }        output_pinned_media_item.path = path;        output_pinned_media_item.object_id = object_id;        output_pinned_media_item.device_id = device_id;    }end:    FINALIZE_STMT(rv, rc, m_db, stmt);    return rv;}
开发者ID:iversonjimmy,项目名称:acer_cloud_wifi_copy,代码行数:66,


示例26: sqlite3_bind_int64

// Bind a 64bits int value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statementvoid Statement::bind(const int aIndex, const sqlite3_int64& aValue){    int ret = sqlite3_bind_int64(mStmtPtr, aIndex, aValue);    check(ret);}
开发者ID:rAndom69,项目名称:WTTSC,代码行数:6,


示例27: sqlite3_bind_int

int sqlite3_bind_int(sqlite3_stmt *p, int i, int iValue){  return sqlite3_bind_int64(p, i, (i64)iValue);}
开发者ID:Farteen,项目名称:firefox-ios,代码行数:3,


示例28: gf_sqlite3_find_unchanged_for_time_freq

/* * Find unchanged files from a specified time, w.r.t to frequency, from the DB * Input: *      query_callback  :       query callback fuction to handle *                              result records from the query *      for_time       :        Time from where the file/s are not changed *      freq_write_cnt  :       Frequency thresold for write *      freq_read_cnt   :       Frequency thresold for read *      clear_counters  :       Clear counters (r/w) for all inodes in DB * */intgf_sqlite3_find_unchanged_for_time_freq (void *db_conn,                                        gf_query_callback_t query_callback,                                        void *query_cbk_args,                                        gfdb_time_t *for_time,                                        int freq_write_cnt,                                        int freq_read_cnt,                                        gf_boolean_t clear_counters){        int ret                                 =       -1;        char *query_str                         =       NULL;        gf_sql_connection_t *sql_conn           =       db_conn;        sqlite3_stmt *prep_stmt                 =       NULL;        long int  for_time_usec                 =       0;        CHECK_SQL_CONN (sql_conn, out);        GF_VALIDATE_OR_GOTO (GFDB_STR_SQLITE3, query_callback, out);        query_str = "select GF_FILE_TB.GF_ID,"                " (select group_concat( GF_PID || ',' || FNAME || ','"                " || FPATH || ',' || W_DEL_FLAG ||',' || LINK_UPDATE , '::')"                " from GF_FLINK_TB where GF_FILE_TB.GF_ID = GF_FLINK_TB.GF_ID)"                "  from GF_FILE_TB where "                /*First condition: For Writes                 * Files that have write wind time smaller than for_time                 * OR                 * File that have write wind time greater than for_time,                 * but write_frequency less than freq_write_cnt*/                "( ((" GF_COL_TB_WSEC " * " TOSTRING(GFDB_MICROSEC) " + "                GF_COL_TB_WMSEC ") < ? )"                " OR "                "( (" GF_COL_TB_WFC " < ? ) AND"                "((" GF_COL_TB_WSEC " * " TOSTRING(GFDB_MICROSEC) " + "                GF_COL_TB_WMSEC ") >= ? ) ) )"                " OR "                /*Second condition: For Reads                 * Files that have read wind time smaller than for_time                 * OR                 * File that have read wind time greater than for_time,                 * but write_frequency less than freq_write_cnt*/                "( ((" GF_COL_TB_RWSEC " * " TOSTRING(GFDB_MICROSEC) " + "                GF_COL_TB_RWMSEC ") < ? )"                " OR "                "( (" GF_COL_TB_RFC " < ? ) AND"                "((" GF_COL_TB_RWSEC " * " TOSTRING(GFDB_MICROSEC) " + "                GF_COL_TB_RWMSEC ") >= ? ) ) )";        for_time_usec = gfdb_time_2_usec(for_time);        ret = sqlite3_prepare (sql_conn->sqlite3_db_conn, query_str, -1,                                &prep_stmt, 0);        if (ret != SQLITE_OK) {                gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,                        "Failed preparing delete statment %s : %s", query_str,                        sqlite3_errmsg(sql_conn->sqlite3_db_conn));                ret = -1;                goto out;        }        /*Bind write wind time*/        ret = sqlite3_bind_int64 (prep_stmt, 1, for_time_usec);        if (ret != SQLITE_OK) {                gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,                        "Failed binding for_time_usec %ld : %s",                        for_time_usec,                        sqlite3_errmsg(sql_conn->sqlite3_db_conn));                ret = -1;                goto out;        }        /*Bind write frequency thresold*/        ret = sqlite3_bind_int (prep_stmt, 2, freq_write_cnt);        if (ret != SQLITE_OK) {                gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,                        "Failed binding freq_write_cnt %d : %s",                        freq_write_cnt,                        sqlite3_errmsg(sql_conn->sqlite3_db_conn));                ret = -1;                goto out;        }        /*Bind write wind time*/        ret = sqlite3_bind_int64 (prep_stmt, 3, for_time_usec);        if (ret != SQLITE_OK) {                gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,                        "Failed binding for_time_usec %ld : %s",                        for_time_usec,                        sqlite3_errmsg(sql_conn->sqlite3_db_conn));                ret = -1;//.........这里部分代码省略.........
开发者ID:ernetas,项目名称:glusterfs,代码行数:101,


示例29: QString

void QgsOSMDatabase::exportSpatiaLiteNodes( const QString& tableName, const QStringList& tagKeys, const QStringList& notNullTagKeys ){  QString sqlInsertPoint = QString( "INSERT INTO %1 VALUES (?" ).arg( quotedIdentifier( tableName ) );  for ( int i = 0; i < tagKeys.count(); ++i )    sqlInsertPoint += QString( ",?" );  sqlInsertPoint += ", GeomFromWKB(?, 4326))";  sqlite3_stmt* stmtInsert;  if ( sqlite3_prepare_v2( mDatabase, sqlInsertPoint.toUtf8().constData(), -1, &stmtInsert, nullptr ) != SQLITE_OK )  {    mError = "Prepare SELECT FROM nodes failed.";    return;  }  QgsOSMNodeIterator nodes = listNodes();  QgsOSMNode n;  while (( n = nodes.next() ).isValid() )  {    QgsOSMTags t = tags( false, n.id() );    // skip untagged nodes: probably they form a part of ways    if ( t.count() == 0 )      continue;    //check not null tags    bool skipNull = false;    for ( int i = 0; i < notNullTagKeys.count() && !skipNull; ++i )      if ( !t.contains( notNullTagKeys[i] ) )        skipNull = true;    if ( skipNull )      continue;    QgsGeometry* geom = QgsGeometry::fromPoint( n.point() );    int col = 0;    sqlite3_bind_int64( stmtInsert, ++col, n.id() );    // tags    for ( int i = 0; i < tagKeys.count(); ++i )    {      if ( t.contains( tagKeys[i] ) )        sqlite3_bind_text( stmtInsert, ++col, t.value( tagKeys[i] ).toUtf8().constData(), -1, SQLITE_TRANSIENT );      else        sqlite3_bind_null( stmtInsert, ++col );    }    sqlite3_bind_blob( stmtInsert, ++col, geom->asWkb(), ( int ) geom->wkbSize(), SQLITE_STATIC );    int insertRes = sqlite3_step( stmtInsert );    if ( insertRes != SQLITE_DONE )    {      mError = QString( "Error inserting node %1 [%2]" ).arg( n.id() ).arg( insertRes );      delete geom;      break;    }    sqlite3_reset( stmtInsert );    sqlite3_clear_bindings( stmtInsert );    delete geom;  }  sqlite3_finalize( stmtInsert );}
开发者ID:AM7000000,项目名称:QGIS,代码行数:62,



注:本文中的sqlite3_bind_int64函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ sqlite3_bind_text函数代码示例
C++ sqlite3_bind_int函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。