本文整理汇总了C++中ns_sql::escape_string方法的典型用法代码示例。如果您正苦于以下问题:C++ ns_sql::escape_string方法的具体用法?C++ ns_sql::escape_string怎么用?C++ ns_sql::escape_string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ns_sql
的用法示例。
在下文中一共展示了ns_sql::escape_string方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create_storage_for_worm_results
void ns_image_server_captured_image_region::create_storage_for_worm_results(ns_image_server_image & im, const bool interpolated,ns_sql & sql){
im.host_id = image_server.host_id();
im.capture_time = ns_current_time();
if (experiment_name.size() == 0 || experiment_id == 0 || sample_name.size() == 0)
load_from_db(region_images_id,&sql);
const std::string experiment_dir(ns_image_server_captured_image::experiment_directory(experiment_name,experiment_id));
const std::string region_dir(region_base_directory(region_name,ns_sample_directory(sample_name,sample_id,experiment_dir),experiment_dir));
im.path = region_dir + DIR_CHAR + "detected_data";
im.filename = filename(&sql);
if (interpolated) im.filename += "_i";
im.filename += ".wrm";
im.partition = image_server.image_storage.get_partition_for_experiment(experiment_id,&sql);
sql.send_query("BEGIN");
if (im.id != 0){
sql << "UPDATE images SET host_id = " << im.host_id << ", creation_time=" << ns_current_time() << ", currently_under_processing=1, "
<< "path = '" << sql.escape_string(im.path) << "', filename='" << sql.escape_string(im.filename) << "', partition='" << im.partition << "' "
<< "WHERE id = " << im.id;
sql.send_query();
}
else{
//create a new image if it doesn't exist.
sql << "INSERT INTO images SET host_id = " << im.host_id << ", creation_time=" << ns_current_time() << ", currently_under_processing=1, "
<< "path = '" << sql.escape_string(im.path) << "', filename='" << sql.escape_string(im.filename) << "', partition='" << im.partition << "' ";
im.id = sql.send_query_get_id();
}
sql.send_query("COMMIT");
}