Permalink
Browse files

Fix a bunch of places where we were using "= null" instead of "IS NULL".

  • Loading branch information...
1 parent d2cb217 commit 94411b36585a5bdf6225b8af6ae4ee5c21d5779d @bharat bharat committed Dec 2, 2009
@@ -145,7 +145,7 @@ static function stats() {
->join("exif_records", "items.id", "exif_records.item_id", "left")
->where("type", "=", "photo")
->and_open()
- ->where("exif_records.item_id", "=", null)
+ ->where("exif_records.item_id", "IS", null)
->or_where("exif_records.dirty", "=", 1)
->close()
->execute()
@@ -47,7 +47,7 @@ static function update_index($task) {
->join("exif_records", "items.id", "exif_records.item_id", "left")
->where("type", "=", "photo")
->and_open()
- ->where("exif_records.item_id", "=", null)
+ ->where("exif_records.item_id", "IS", null)
->or_where("exif_records.dirty", "=", 1)
->close()
->find_all() as $item) {
@@ -73,15 +73,13 @@ static function update($item) {
static function stats() {
$remaining = db::build()
- ->select("items.id")
->from("items")
->join("search_records", "items.id", "search_records.item_id", "left")
->and_open()
- ->where("search_records.item_id", "=", null)
+ ->where("search_records.item_id", "IS", null)
->or_where("search_records.dirty", "=", 1)
->close()
- ->execute()
- ->count();
+ ->count_records();
$total = ORM::factory("item")->count_all();
$percent = round(100 * ($total - $remaining) / $total);
@@ -45,7 +45,7 @@ static function update_index($task) {
$start = microtime(true);
foreach (ORM::factory("item")
->join("search_records", "items.id", "search_records.item_id", "left")
- ->where("search_records.item_id", "=", null)
+ ->where("search_records.item_id", "IS", null)
->or_where("search_records.dirty", "=", 1)
->find_all() as $item) {
// The query above can take a long time, so start the timer after its done
@@ -198,7 +198,7 @@ static function add($task) {
// they're done.
$entries = ORM::factory("server_add_file")
->where("task_id", "=", $task->id)
- ->where("item_id", "=", null)
+ ->where("item_id", "IS", null)
->order_by("id", "ASC")
->limit(10)
->find_all();

0 comments on commit 94411b3

Please sign in to comment.