当前位置: 首页>>代码示例>>PHP>>正文


PHP Dal::insert_id方法代码示例

本文整理汇总了PHP中Dal::insert_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Dal::insert_id方法的具体用法?PHP Dal::insert_id怎么用?PHP Dal::insert_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dal的用法示例。


在下文中一共展示了Dal::insert_id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Save

 /**
  function Save()
  Required parameters :- Parent type, Parent id, Body of report and Reporter id
  @return Report id if data is successfully saved.
 */
 public function save()
 {
     Logger::log("Enter: function ReportAbuse::save");
     if (empty($this->parent_type)) {
         Logger::log(" Throwing exception REQUIRED_PARAMETERS_MISSING | Message: Parent type is empty", LOGGER_ERROR);
         throw new PAException(REQUIRED_PARAMETERS_MISSING, 'parent type is Empty.');
     }
     if (empty($this->parent_id)) {
         Logger::log(" Throwing exception REQUIRED_PARAMETERS_MISSING | Message: Parent id is empty", LOGGER_ERROR);
         throw new PAException(REQUIRED_PARAMETERS_MISSING, 'Parent id is missing.');
     }
     if (empty($this->body)) {
         Logger::log(" Throwing exception REQUIRED_PARAMETERS_MISSING | Message: body of Report abuse is empty", LOGGER_ERROR);
         throw new PAException(REQUIRED_PARAMETERS_MISSING, 'Body of Report can\'t be empty.');
     }
     if (empty($this->reporter_id)) {
         Logger::log(" Throwing exception REQUIRED_PARAMETERS_MISSING | Message: Reporter id is empty", LOGGER_ERROR);
         throw new PAException(REQUIRED_PARAMETERS_MISSING, 'Log into People Aggregator before sending report');
     }
     if (!User::user_exist((int) $this->reporter_id)) {
         Logger::log(" Throwing exception USER_NOT_FOUND | Message: User does not exist", LOGGER_ERROR);
         throw new PAException(USER_NOT_FOUND, 'User does not exist.');
     }
     if (!$this->is_valid_type($this->parent_type)) {
         Logger::log(" Throwing exception INVALID_ARGUMENTS | Message: Not a valid parent type", LOGGER_ERROR);
         throw new PAException(INVALID_ARGUMENTS, 'parent type is invalid');
     }
     $sql = "INSERT INTO {report_abuse}\n      (parent_type, parent_id, reporter_id, body, created)\n      VALUES (?, ?, ?, ?, ?)";
     $this->created = time();
     $data = array($this->parent_type, $this->parent_id, $this->reporter_id, $this->body, $this->created);
     Dal::query($sql, $data);
     $this->report_id = Dal::insert_id();
     Logger::log("Exit: function ReportAbuse::save");
     return $this->report_id;
 }
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:40,代码来源:ReportAbuse.php

示例2: save

 public function save()
 {
     Logger::log("Enter: function ActivityType::save()");
     if (empty($this->title) || empty($this->points) || empty($this->type)) {
         Logger::log("Throwing exception in ActivityType::save(). Required parameter missing.", LOGGER_ERROR);
         throw new PAException(REQUIRED_PARAMETERS_MISSING, "Required parameter missing");
     }
     $sql = "INSERT INTO {activity_types} (id, title, description, type, points) " . "VALUES ('" . $this->id . "', '" . $this->title . "', '" . $this->description . "', '" . $this->type . "', " . $this->points . ") " . "ON DUPLICATE KEY UPDATE title = '" . $this->title . "', description = '" . $this->description . "', type = '" . $this->type . "', points = " . $this->points;
     $res = Dal::query($sql);
     $this->id = Dal::insert_id();
     Logger::log("Exit: function ActivityType::save()");
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:12,代码来源:ActivityType.class.php

示例3: save

 /**
  * This function saves an entry in footer_links table
  * input type: Values are set for object eg links = new FooterLink; $links->caption= 'sys';
  * return type: id
  */
 public function save()
 {
     Logger::log("Enter: function FooterLink::save()");
     if (!empty($this->id)) {
         $sql = "UPDATE {footer_links} SET caption = ?, url = ?, is_active = ?, extra = ? WHERE id = " . $this->id;
     } else {
         $sql = "INSERT INTO {footer_links} (caption, url, is_active, extra) VALUES \n        (?, ?, ?, ?) ";
     }
     $data = array($this->caption, $this->url, $this->is_active, $this->extra);
     $res = Dal::query($sql, $data);
     $id = Dal::insert_id();
     Logger::log("Enter: function FooterLink::save");
     return $id;
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:19,代码来源:FooterLink.php

示例4: create

 /**
  * Purpose: this function creates a new role
  * @param class variables that must be set prior to calling this function
  * Class variables are set by method set_vars();
  * @return id of the role created
  */
 public function create()
 {
     Logger::log("Enter: function Roles::create");
     $this->created = $this->changed = time();
     if (empty($this->name)) {
         throw new PAException(REQUIRED_PARAMETERS_MISSING, "Please specify Role name,it can not be left blank.");
     }
     if (empty($this->description)) {
         throw new PAException(REQUIRED_PARAMETERS_MISSING, "Please specify Role description ,it can not be left blank.");
     }
     $res = Dal::query("INSERT INTO {admin_roles} (name, description, created, changed) VALUES (?, ?, ?, ?)", array($this->name, $this->description, $this->created, $this->changed));
     $this->id = Dal::insert_id();
     Logger::log("Exit: function Roles::create");
     return $this->id;
 }
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:21,代码来源:Roles.php

示例5: save

 public function save()
 {
     if ($this->badge_id) {
         Dal::query("UPDATE {blog_badges} SET badge_config=? WHERE user_id=? AND badge_id=?", array(serialize($this->config), $this->user_id, $this->badge_id));
     } else {
         if (!$this->user_id) {
             throw new PAException(OPERATION_NOT_PERMITTED, "New widget requires user_id to save");
         }
         if (!$this->badge_tag) {
             throw new PAException(OPERATION_NOT_PERMITTED, "New widget requires badge_tag to save");
         }
         if (!$this->title) {
             $this->title = $this->badge_tag;
         }
         Dal::query("INSERT INTO {blog_badges} SET user_id=?, badge_tag=?, title=?, badge_config=?", array($this->user_id, $this->badge_tag, $this->title, serialize($this->config)));
         $this->badge_id = Dal::insert_id();
     }
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:18,代码来源:Widget.php

示例6: __construct

 public function __construct($host, $noisy = FALSE)
 {
     if (!trim($host)) {
         throw new PAException(BAD_PARAMETER, "Invalid host");
     }
     $dom = Dal::query_one_assoc("SELECT * FROM spam_domains WHERE domain=?", array($host));
     if ($dom) {
         // exists
         foreach ($dom as $k => $v) {
             $this->{$k} = $v;
         }
     } else {
         // need to create it
         $this->domain = $host;
         $this->count = $this->blacklisted = $this->whitelisted = 0;
         if ($noisy) {
             echo "Querying blacklists for {$host}:";
         }
         foreach (array("multi.uribl.com", "multi.surbl.org") as $bl) {
             if ($noisy) {
                 echo " {$bl}";
             }
             if (gethostbyname("{$host}.{$bl}") != "{$host}.{$bl}") {
                 $this->blacklisted = DOMAIN_BLACKLISTED_AUTOMATICALLY;
                 if ($noisy) {
                     echo " BLACKLISTED!";
                 }
                 break;
             }
         }
         if ($noisy) {
             echo "\n";
         }
         Dal::query("INSERT INTO spam_domains SET domain=?, blacklisted=?", array($this->domain, $this->blacklisted));
         $this->id = Dal::insert_id();
     }
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:37,代码来源:SpamDomain.php

示例7: link

 public static function link($file_id, $params)
 {
     //INNODB TODO: start transaction
     // Verify file
     list($incomplete, $link_count) = Dal::query_one("SELECT incomplete, link_count FROM files WHERE file_id=?", array($file_id));
     if ($incomplete) {
         throw new PAException(FILE_NOT_FOUND, "File {$file_id} was not completely saved; cannot create a link to it");
     }
     // Validate $params and build SQL to add link
     $role = $params['role'];
     if (empty($role)) {
         throw new PAException(BAD_PARAMETER, "Storage role must be provided to link()");
     }
     $sql = "INSERT INTO file_links SET file_id=?, role=?";
     $sqlargs = array($file_id, $role);
     $required_params = NULL;
     unset($params['role']);
     switch ($role) {
         case 'thumb':
             $required_params = array("file", "dim");
             break;
         case 'media':
             $required_params = array("network", "content");
             break;
         case 'avatar':
         case 'header':
             if (!empty($params['user'])) {
                 $required_params = array("user");
             } else {
                 if (!empty($params['group'])) {
                     $required_params = array("network", "group");
                 } else {
                     $required_params = array("network");
                 }
             }
             break;
         case 'ad':
             $required_params = array("network", "ad");
             break;
         case 'emblem':
             $required_params = array("network");
             break;
         default:
             throw new PAException(BAD_PARAMETER, "Invalid storage role '{$role}'");
     }
     // Map user param names to SQL column names
     $param_name_mapping = array("network" => "network_id", "user" => "user_id", "group" => "group_id", "ad" => "ad_id", "content" => "content_id", "file" => "parent_file_id", "dim" => "dim");
     // Process required params, removing them from $params as we go
     foreach ($required_params as $param_name) {
         if (empty($params[$param_name])) {
             throw new PAException(BAD_PARAMETER, "Required parameter '{$param_name}' (for role {$role}) not provided to link() for file {$file_id}");
         }
         $value = $params[$param_name];
         switch ($param_name) {
             case "network":
             case "user":
             case "group":
             case "ad":
             case "content":
                 if (!is_numeric($value)) {
                     throw new PAException(BAD_PARAMETER, "'{$param_name}' parameter must be numeric");
                 }
                 break;
             case "dim":
                 if (!preg_match("/^\\d+x\\d+\$/", $value)) {
                     throw new PAException(BAD_PARAMETER, "'dim' parameter must be of the format <width>x<height>");
                 }
                 break;
             case "file":
                 $parent_file_id = $value;
                 if ($parent_file_id == $file_id) {
                     throw new PAException(BAD_PARAMETER, "Cannot link a file in as a derivative of itself (file_id == parent_file_id == {$file_id})");
                 }
                 $parent_file = Dal::query_one("SELECT incomplete FROM files WHERE file_id=?", array($parent_file_id));
                 if (empty($parent_file)) {
                     throw new PAException(FILE_NOT_FOUND, "Parent of derivative file in link must exist (file {$file_id}, parent file {$parent_file_id})");
                 }
                 break;
         }
         $sql .= ", " . $param_name_mapping[$param_name] . "=?";
         $sqlargs[] = $params[$param_name];
         unset($params[$param_name]);
     }
     // If $params is not empty by now, we must have some extra params, that aren't allowed
     if (count($params) > 0) {
         throw new PAException(BAD_PARAMETER, "Invalid parameters (" . implode(", ", array_keys($params)) . ") provided to link() for role {$role}, file {$file_id}");
     }
     // Now store the link and increment the file link count
     Dal::query($sql, $sqlargs);
     $link_id = Dal::insert_id();
     Dal::query("UPDATE files SET last_linked=NOW(), link_count=link_count+1 WHERE file_id=?", array($file_id));
     //INNODB TODO: commit
     return $link_id;
 }
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:94,代码来源:Storage.php

示例8: save

 /**
  * Saves network to databse.
  * used for creating and updating the network
  * @access public.
  * called after $this->set_params()
  */
 public function save()
 {
     global $error, $error_msg;
     $error = false;
     Logger::log("[ Enter: function Network::save]\n");
     //first check whether it is insert or update
     // global var $path_prefix has been removed - please, use PA::$path static variable
     if ($this->network_id) {
         $old_type = Network::find_network_type($this->network_id);
         //update
         $update_fields = array('name', 'tagline', 'category_id', 'description', 'extra', 'type', 'inner_logo_image');
         $sql = " UPDATE {networks} SET changed = ? ";
         $data_array = array(time());
         foreach ($update_fields as $field) {
             if (isset($this->{$field})) {
                 $sql .= " , {$field} = ? ";
                 array_push($data_array, $this->{$field});
             }
         }
         $sql .= " WHERE network_id = ? ";
         array_push($data_array, $this->network_id);
         $res = Dal::query($sql, $data_array);
         //fix for changing a network from private to public
         //the waiting_members must be changed to members
         $new_type = $this->type;
         if ($old_type == PRIVATE_NETWORK_TYPE && $new_type == REGULAR_NETWORK_TYPE) {
             Network::approve_all($this->network_id);
         }
     } else {
         //insert
         // here we have to do a lot of steps
         //first check if network already exists with same address
         if (Network::check_already($this->address)) {
             Logger::log("Thowing Exception NETWORK_ALREADY_EXISTS");
             throw new PAException(NETWORK_ALREADY_EXISTS, "Network with same address already exists");
         }
         // checks the permissions of directory network
         $network_folder = PA::$project_dir . "/networks";
         if (!is_writable($network_folder)) {
             Logger::log("Thowing Exception NETWORK_DIRECTORY_PERMISSION_ERROR");
             throw new PAException(NETWORK_DIRECTORY_PERMISSION_ERROR, "Network folder ({$network_folder}) is not writable. Please check the permissions");
         }
         //if we have come this far we can insert the network easily
         // TODO add acl permission check
         //insert into networks
         $this->created = time();
         $this->type = $this->type ? $this->type : REGULAR_NETWORK_TYPE;
         $res = Dal::query("INSERT INTO {networks} (name, address, tagline, type,category_id, description,is_active, created, changed, extra, member_count, owner_id, inner_logo_image) VALUES ( ?, ?, ?,?, ?, ?, ?, ?, ?, ?, 1, ?, ? )", array($this->name, $this->address, $this->tagline, $this->type, $this->category_id, $this->description, 1, $this->created, $this->changed, $this->extra, $this->user_id, $this->inner_logo_image));
         $this->network_id = Dal::insert_id();
         //insert into networks_users
         $user_created = Dal::query_first("SELECT created FROM users WHERE user_id=?", $this->user_id);
         $res = Dal::query("INSERT INTO {networks_users} (network_id, user_id, user_type, created) VALUES (?, ?, ?, ?)", array($this->network_id, $this->user_id, NETWORK_OWNER, $user_created));
         //Now we have inserted new network we need to create other directory and config files as well
         try {
             $this->do_network_setup();
         } catch (PAException $e) {
             $error = TRUE;
             $error_msg = "{$e->message}";
         }
         if ($error) {
             $this->do_rollback();
             throw new PAException(NETWORK_INTERNAL_ERROR, "Some internal error occured while setting up the network. Message: {$error_msg}");
         }
     }
     //.. insert
     Logger::log("[ Exit: function Network::save]\n");
     return $this->network_id;
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:74,代码来源:Network.php

示例9: save

 function save()
 {
     $ct = Dal::query_first("SELECT COUNT(*) FROM {fans} WHERE is_active=1 AND user_id=? AND subject_type=? AND subject_id=?", array($this->user_id, $this->subject_type, $this->subject_id));
     $is_new = $ct ? 0 : 1;
     if ($is_new) {
         if (!isset($this->is_active)) {
             $this->is_active = 1;
         }
     }
     $sql = $is_new ? "INSERT INTO {fans} SET " : "UPDATE {fans} SET ";
     $args = array();
     $set_fragments = array();
     foreach (Fan::$columns as $col) {
         switch ($col) {
             case 'fan_id':
                 // never set
                 continue;
             case 'updated':
                 // always set automatically
                 $set_fragments[] = "{$col}=NOW()";
                 break;
             case 'created':
                 // set automatically if new, otherwise copy
                 if ($is_new) {
                     $set_fragments[] = "{$col}=NOW()";
                     break;
                 }
                 // else fallthrough
             // else fallthrough
             default:
                 $set_fragments[] = "{$col}=?";
                 $args[] = $this->{$col};
         }
     }
     $sql .= implode(", ", $set_fragments);
     if (!$is_new) {
         $sql .= " WHERE fan_id=?";
         $args[] = $this->fan_id;
     }
     Dal::query($sql, $args);
     if ($is_new) {
         $this->fan_id = Dal::insert_id();
     }
     /*
         // update denormalization
         Dal::query("UPDATE {items} SET fan_count=(
           SELECT COUNT(*) FROM {fans} WHERE is_active=1 AND subject_type=? AND subject_id=?)
           WHERE is_active=1 AND subject_type=? AND subject_id=?", array(
           $this->subject_type, $this->subject_id,
           $this->subject_type, $this->subject_id));
         Dal::query("UPDATE {users} SET fan_count=(
           SELECT COUNT(*) FROM {fans} WHERE is_active=1 AND user_id=?)
           WHERE is_active=1 AND user_id=?", array(
           $this->user_id, $this->user_id));
     */
     return $this->fan_id;
 }
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:57,代码来源:EntityRelation.php

示例10: load_tag_ids

 /**
  * Load the updated_tags_id by inserting the given tags to database
  * If the tag is already present in database then it will retrieve that value
  * Else this function will enter the tag into the database and then retrieve the value of tag_id and tag_name.
  *
  * @param array tags contain the tags whose tag_id needs to be returned
  *
  * @return array
  */
 static function load_tag_ids($tags)
 {
     Logger::log("Enter: function Tag::load_tag_ids");
     $updated_tags_id = array();
     $num = count($tags);
     for ($i = 0; $i <= $num - 1; $i++) {
         $sql = 'SELECT tag_id FROM {tags} WHERE tag_name= ?';
         $data = array($tags[$i]);
         $res = Dal::query($sql, $data);
         if ($res->numRows() > 0) {
             $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
             $updated_tags_id[$i] = $row->tag_id;
         } else {
             $sql = 'INSERT into {tags} (tag_name) values (?)';
             $data = array(strtolower($tags[$i]));
             Dal::query($sql, $data);
             //find last insert id
             $updated_tags_id[$i] = Dal::insert_id();
         }
     }
     Logger::log("Exit: function Tag::load_tag_ids");
     return $updated_tags_id;
 }
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:32,代码来源:Tag.php

示例11: save

 /**
  * This function saves an entry for advertisements table
  * input type: Values are set for object eg advertisement = new Advertisement; $advertisement->title= 'sys';
  * return type: ad_id
  */
 public function save()
 {
     Logger::log("Enter: function Advertisement::save()");
     if (empty($this->title)) {
         Logger::log("Exit: function Advertisement::save(). Title of the ad found blank.");
         throw new CNException(BAD_PARAMETER, __('Ad Title can not have empty.'));
     }
     if (empty($this->page_id)) {
         Logger::log("Exit: function Advertisement::save(). Page not specified.");
         throw new CNException(BAD_PARAMETER, __('Ad Target page is not specified.'));
     }
     $data = array($this->user_id, $this->ad_image, $this->url, $this->ad_script, $this->title, $this->description, $this->page_id, $this->orientation, $this->created, $this->changed, $this->is_active);
     if (!empty($this->ad_id)) {
         $sql = "UPDATE {advertisements} SET user_id = ?, ad_image = ?, url = ?, ad_script = ?, title = ?, description = ?, page_id = ?, orientation = ?, created = ?, changed = ?, is_active = ? WHERE ad_id = ?";
         array_push($data, $this->ad_id);
     } else {
         $sql = "INSERT INTO {advertisements} (user_id, ad_image, url, ad_script, title, description, page_id, orientation, created, changed, is_active, type, group_id) VALUES\n        (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
         array_push($data, $this->type);
         array_push($data, @$this->group_id);
     }
     $res = Dal::query($sql, $data);
     $ad_id = Dal::insert_id();
     Logger::log("Enter: function Advertisement::save");
     return $ad_id;
 }
开发者ID:Cyberspace-Networks,项目名称:CoreSystem,代码行数:30,代码来源:CNAdvertisement.php

示例12: insert_UserPopularity

 /**
  * Insert a new Record - dynamic method: insert_UserPopularity()
  *
  *
  * Generated with the DalClassGenerator created by: 
  * Zoran Hron <zhron@broadbandmechanics.com> 
  *
  * @param popularity
  * @param time
  * @result id
  **/
 public function insert_UserPopularity($popularity, $time)
 {
     // items to be inserted in the database
     $params = array(null, $popularity, $time);
     $__id = null;
     // insert query
     $sql = "INSERT INTO { user_popularity } ( user_id, popularity, time ) VALUES ( ?,?,? );";
     // perform insert in the database
     $res = Dal::query($sql, $params);
     if ($res) {
         $__id = Dal::insert_id();
     }
     return $__id;
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:25,代码来源:UserPopularity.class.php

示例13: save

 /**
  * Save the persona data to the database.
  *
  * When creating a new persona, set all the attributes for the persona 
  * (except persona_id) and call save. Save will set the persona_id for 
  * the persona.
  *
  */
 public function save()
 {
     Logger::log("Enter: function Persona::save");
     // If we have decoded the JSON coniguration string into the structured
     // configuration data, it will be non-null, so encode it back as a JSON
     // string into configuration, to save it.
     if ($this->configuration_data != null) {
         $this->encode_configuration();
     }
     try {
         if (!$this->user_id || !$this->persona_service_id) {
             Logger::log("Throwing exception REQUIRED_PARAMETERS_MISSING | Message: Required parameters missing", LOGGER_ERROR);
             throw new PAException(REQUIRED_PARAMETERS_MISSING, "Required parameters missing");
         }
         if ($this->is_new) {
             $this->is_new = false;
             $sql = 'INSERT INTO {personas} (user_id, persona_service_id, sequence, name, configuration) values (?, ?, ?, ?, ?)';
             $data = array($this->user_id, $this->persona_service_id, $this->sequence, $this->name, $this->configuration);
             Dal::query($sql, $data);
             $this->persona_id = Dal::insert_id();
         } else {
             $sql = 'UPDATE {personas} SET user_id = ?, persona_service_id = ?, sequence = ?, name = ?, configuration = ? WHERE persona_id = ?';
             $data = array($this->user_id, $this->persona_service_id, $this->sequence, $this->name, $this->configuration, $this->persona_id);
             Dal::query($sql, $data);
         }
         // All done - commit to database.
         Dal::commit();
     } catch (PAException $e) {
         Dal::rollback();
         throw $e;
     }
     Logger::log("Exit: function Persona::save");
 }
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:41,代码来源:Persona.php

示例14: save

 /**
  * saves category data 
  * @access public
  * if category_id is set it updates else inserts
  * return null
  */
 public function save()
 {
     Logger::log("Enter: function Category::save");
     //check for required parameters
     if (!$this->name) {
         Logger::log("Throwing exception REQUIRED_PARAMETERS_MISSING | Message: Required parameters missing", LOGGER_ERROR);
         throw new CNException(REQUIRED_PARAMETERS_MISSING, "Required parameters missing");
     }
     // ..eof check
     if ($this->category_id) {
         //update
         // TODO to move category's position
         $this->changed = time();
         $sql = "UPDATE {categories} SET name = ?, description = ?, type = ?, changed = ? WHERE category_id = ? AND is_active = 1";
         $data = array($this->name, $this->description, $this->type, $this->changed, $this->category_id);
         $res = Dal::query($sql, $data);
     } else {
         //insert
         $position = Category::get_position($this->parent_id);
         $this->created = time();
         $this->changed = $this->created;
         $sql = 'INSERT into {categories} ( name, description, type, is_active, created, changed ) values ( ?, ?, ?, ?, ?, ? )';
         $data = array($this->name, $this->description, $this->type, ACTIVE, $this->created, $this->changed);
         $res = Dal::query($sql, $data);
         $insert_id = Dal::insert_id();
         $position .= $insert_id . ">";
         $sql = " UPDATE {categories} SET position = ? WHERE category_id = ? ";
         $data = array($position, $insert_id);
         $res = Dal::query($sql, $data);
     }
     //..eof insert else
     Logger::log("Exit: function Category::save");
     return;
 }
开发者ID:Cyberspace-Networks,项目名称:CoreSystem,代码行数:40,代码来源:CNCategory.php

示例15: insert_PaForumPost

 /**
  * Insert a new Record - dynamic method: insert_PaForumPost()
  *
  *
  * Generated with the DalClassGenerator created by: 
  * Zoran Hron <zhron@broadbandmechanics.com> 
  *
  * @param title
  * @param content
  * @param user_id
  * @param parent_id
  * @param thread_id
  * @param is_active
  * @param created_at
  * @param updated_at
  * @param modified_by
  * @result id
  **/
 public function insert_PaForumPost($title, $content, $user_id, $parent_id, $thread_id, $is_active, $created_at, $updated_at, $modified_by)
 {
     // items to be inserted in the database
     $params = array(null, $title, $content, $user_id, $parent_id, $thread_id, $is_active, $created_at, $updated_at, $modified_by);
     $__id = null;
     // insert query
     $sql = "INSERT INTO { pa_forum_post } ( id, title, content, user_id, parent_id, thread_id, is_active, created_at, updated_at, modified_by ) VALUES ( ?,?,?,?,?,?,?,?,?,? );";
     // perform insert in the database
     $res = Dal::query($sql, $params);
     if ($res) {
         $__id = Dal::insert_id();
     }
     return $__id;
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:32,代码来源:PaForumPost.class.php


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