mirror of
				https://github.com/nerzhul/ocsms.git
				synced 2025-10-30 18:07:36 +00:00 
			
		
		
		
	Migrate one function to the new querybuilder for NC 14
This commit is contained in:
		
							parent
							
								
									b860267599
								
							
						
					
					
						commit
						80d025d023
					
				| @ -39,12 +39,14 @@ class SmsMapper extends Mapper { | |||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public function getAllIds ($userId) { | 	public function getAllIds ($userId) { | ||||||
| 		$query = \OCP\DB::prepare('SELECT sms_id, sms_mailbox FROM ' . | 		$qb = $this->db->getQueryBuilder(); | ||||||
| 			'*PREFIX*ocsms_smsdatas WHERE user_id = ?'); | 		$qb->select('sms_id, sms_mailbox') | ||||||
| 		$result = $query->execute(array($userId)); | 			->from('ocsms_smsdatas') | ||||||
|  | 			->where($qb->expr()->eq('user_id', $qb->createNamedParameter($userId))); | ||||||
|  | 		$result = $qb->execute(); | ||||||
| 
 | 
 | ||||||
| 		$smsList = array(); | 		$smsList = array(); | ||||||
| 		while($row = $result->fetchRow()) { | 		while($row = $result->fetch()) { | ||||||
| 			// This case may not arrive, but we test if the DB is consistent
 | 			// This case may not arrive, but we test if the DB is consistent
 | ||||||
| 			if (!in_array((int) $row["sms_mailbox"], SmsMapper::$mailboxNames)) { | 			if (!in_array((int) $row["sms_mailbox"], SmsMapper::$mailboxNames)) { | ||||||
| 				continue; | 				continue; | ||||||
| @ -58,6 +60,7 @@ class SmsMapper extends Mapper { | |||||||
| 				array_push($smsList[$mbox], $row["sms_id"]); | 				array_push($smsList[$mbox], $row["sms_id"]); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  | 		$result->closeCursor(); | ||||||
| 		return $smsList; | 		return $smsList; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user