本文整理汇总了PHP中S::sqlMulti方法的典型用法代码示例。如果您正苦于以下问题:PHP S::sqlMulti方法的具体用法?PHP S::sqlMulti怎么用?PHP S::sqlMulti使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类S
的用法示例。
在下文中一共展示了S::sqlMulti方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addEducations
/**
* 批量添加教育经历
* @param array $data
* @return bool
*/
function addEducations($data)
{
if (!S::isArray($data)) {
return false;
}
return $this->_db->update("INSERT INTO " . $this->_tableName . "(uid,schoolid,educationlevel,starttime) VALUES " . S::sqlMulti($data));
}
示例2: addCareers
/**
* 添加工作经历
* @param array $data
* @return bool
*/
function addCareers($data)
{
if (!S::isArray($data)) {
return false;
}
return $this->_db->update("INSERT INTO {$this->_tableName} (uid,companyid,starttime) VALUES " . S::sqlMulti($data) . "");
}
示例3: update
function update($uploaddb)
{
global $windid, $winduid, $timestamp, $pintro;
foreach ($uploaddb as $key => $value) {
$this->attachs[] = array('aid' => $this->aid, 'pintro' => $pintro[$value['id']] ? $pintro[$value['id']] : substr($value['name'], 0, strrpos($value['name'], '.')), 'path' => $value['fileuploadurl'], 'uploader' => $windid, 'uptime' => $timestamp, 'ifthumb' => $value['ifthumb']);
}
if ($this->attachs) {
$this->db->update("INSERT INTO pw_cnphoto (aid,pintro,path,uploader,uptime,ifthumb) VALUES " . S::sqlMulti($this->attachs));
$this->pid = $this->db->insert_id();
$cnalbum = $this->db->get_one("SELECT * FROM pw_cnalbum WHERE aid=" . S::sqlEscape($this->aid));
if ($this->atype) {
if (!$cnalbum['private']) {
updateDatanalyse($this->pid, 'groupPicNew', $timestamp);
}
} else {
$statistics = L::loadClass('Statistics', 'datanalyse');
$statistics->photouser($winduid, count($this->attachs));
}
if (isset($cnalbum['lastphoto']) && !$cnalbum['lastphoto']) {
$lastphoto = $this->getLastPhotoThumb();
$lastphotosqlAdd = ",lastphoto= " . S::sqlEscape($lastphoto);
}
$this->db->update("UPDATE pw_cnalbum SET photonum=photonum+" . S::sqlEscape(count($this->attachs)) . ",lasttime=" . S::sqlEscape($timestamp) . $lastphotosqlAdd . " WHERE aid=" . S::sqlEscape($this->aid));
}
return true;
}
示例4: addSchools
/**
* 批量添加多所学校
* @param string $schoolNames 学校名称
* @return int $Id 学校
*/
function addSchools($fieldData)
{
if (!S::isArray($fieldData)) {
return false;
}
return $this->_db->update("INSERT INTO " . $this->_tableName . " (schoolname,areaid,type) VALUES " . S::sqlMulti($fieldData));
}
示例5: _updateDb
function _updateDb()
{
global $db;
$fileContent = $this->_getFileContent();
$temparray = explode("\t", $fileContent);
$data = s::isArray($temparray) ? array_count_values($temparray) : array();
$nowtime = PwStrtoTime(get_date($this->_timestamp, 'Y-m-d'));
$sql = array();
foreach ($data as $key => $val) {
$key = trim($this->_filterCheckKeyword($key));
if (!$key) {
continue;
}
$sql[] = array($key, $val, $nowtime);
if (++$count > 1000) {
break;
}
}
if (!$sql) {
return false;
}
$db->query("INSERT INTO pw_searchstatistic(keyword,num,created_time) VALUES " . S::sqlMulti($sql));
$deleteTime = $this->_timestamp - 86400 * 90;
$db->query("DELETE FROM pw_searchstatistic WHERE created_time < {$deleteTime}");
return true;
}
示例6: updates
function updates($array)
{
foreach ($array as $key => $value) {
$array[$key] = $this->_serializeData($value);
}
$this->_db->update("REPLACE INTO " . $this->_tableName . " (invokepieceid,data,cachetime) VALUES " . S::sqlMulti($array, false));
}
示例7: update
/**
* 批量更新缓存数据
*
* @param array $data 缓存数据,array('KEY'=>'VALUE')
* @param int $expire 缓存数据自动过期时间(秒)
* @return bool
*/
function update($data, $expire = 180)
{
$tmpvhash = $dcache = $kcache = array();
$expire = $this->now + $expire;
$keys = array_keys($data);
if ($keys) {
$query = $this->cache->query("SELECT skey,vhash FROM " . $this->table . " WHERE skey IN (" . S::sqlImplode($keys, false) . ")");
while ($rt = $this->cache->fetch_array($query)) {
$tmpvhash[$rt['skey']] = $rt['vhash'];
}
}
foreach ($data as $key => $value) {
$v = $this->_serialize($value);
$vhash = md5($v);
if (!isset($tmpvhash[$key]) || $tmpvhash[$key] != $vhash) {
$dcache[] = array($key, $expire, $vhash, $v);
} else {
$kcache[] = $key;
}
}
if ($dcache) {
$this->cache->update("REPLACE INTO " . $this->table . " (skey,expire,vhash,value) VALUES " . S::sqlMulti($dcache, false));
}
if ($kcache) {
$this->cache->update("UPDATE " . $this->table . " SET expire=" . S::sqlEscape($expire, false) . "WHERE skey IN (" . S::sqlImplode($kcache, false) . ")");
}
$this->_expire();
}
示例8: updates
function updates($array)
{
foreach ($array as $key => $value) {
$array[$key]['data'] = $this->_serialize($value['data']);
}
$this->_db->update("REPLACE INTO " . $this->_tableName . " (sign,data,cachetime) VALUES " . S::sqlMulti($array, false));
}
示例9: insert
function insert($fieldsData)
{
if (!S::isArray($fieldsData)) {
return false;
}
$this->_db->update("INSERT INTO " . $this->_tableName . " (uid,name,type,size,attachurl,uploadtime,descrip,ifthumb) VALUES " . S::sqlMulti($fieldsData));
return true;
}
示例10: addAreas
/**
* 批量添加
*
* @param array $fieldsData
* @return boolean
*/
function addAreas($fieldsData)
{
if (!S::isArray($fieldsData)) {
return false;
}
$this->_db->update("INSERT INTO " . $this->_tableName . " (name,joinname,parentid,vieworder) VALUES " . S::sqlMulti($fieldsData));
return true;
}
示例11: saveModesData
/**
* 保存用户模块缓存数据
* @param $uid int 用户id
* @param $modes array 获取模块数据及数量 array('article' => 1, 'write' => 2, ...)
*/
function saveModesData($uid, $data, $conf)
{
$array = array();
foreach ($data as $key => $value) {
$array[] = array('uid' => $uid, 'type' => $key, 'expire' => S::isArray($conf[$key]) && isset($conf[$key]['expire']) ? $this->now + S::int($conf[$key]['expire']) : $this->now + 608400, 'num' => S::isArray($conf[$key]) ? S::int($conf[$key]['num']) : $conf[$key], 'value' => $this->_serialize($value));
}
if ($array) {
$this->_db->update("REPLACE INTO " . $this->_tableName . " (uid,type,expire,num,value) VALUES " . S::sqlMulti($array, false));
}
}
示例12: _logDelta
function _logDelta($tableName, $ids, $state)
{
if (!S::isArray($ids)) {
return false;
}
$_tmp = array();
foreach ($ids as $id) {
$_tmp[] = array('id' => $id, 'state' => $state);
}
$GLOBALS['db']->update("REPLACE INTO " . S::sqlMetadata($tableName) . " (id,state) VALUES " . S::sqlMulti($_tmp));
}
示例13: add
function add($uid, $blackList)
{
if (!$uid || !$blackList || !is_array($blackList)) {
return false;
}
$array = array();
foreach ($blackList as $val) {
$array[] = array($uid, $val);
}
$this->_db->update("INSERT INTO " . $this->_tableName . ' (uid, touid) VALUES ' . S::sqlMulti($array));
}
示例14: adds
function adds($tid, $pid, $uids)
{
$tid = intval($tid);
$pid = intval($pid);
if (!$tid || !S::isArray($uids)) {
return false;
}
$data = array();
foreach ($uids as $v) {
$data[] = array('tid' => $tid, 'pid' => $pid, 'uid' => intval($v));
}
$data && $this->_db->update("REPLACE INTO {$this->_tableName} (tid,pid,uid) VALUES " . S::sqlMulti($data));
}
示例15: addSpreads
/**
* 批量增加套餐信息
* @param array $fieldData
* @return bool
*/
function addSpreads($fieldData)
{
if (!S::isArray($fieldData)) {
return false;
}
$data = array();
foreach ($fieldData as $value) {
$value = $this->_checkAllowField($value, $this->_allowFields);
if (!S::isArray($value)) {
continue;
}
$data[] = $value;
}
if (!S::isArray($data)) {
return false;
}
return $this->_db->query(pwQuery::buildClause('INSERT INTO :table VALUES :data', array($this->_tableName, S::sqlMulti($data))));
}