@@ -34,7 +34,7 @@ |
||
| 34 | 34 | // Clean up previous sosa table if it exists |
| 35 | 35 | DB::schema()->dropIfExists('maj_sosa'); |
| 36 | 36 | |
| 37 | - DB::schema()->create('maj_sosa', static function (Blueprint $table): void { |
|
| 37 | + DB::schema()->create('maj_sosa', static function(Blueprint $table): void { |
|
| 38 | 38 | |
| 39 | 39 | $table->integer('majs_gedcom_id'); |
| 40 | 40 | $table->integer('majs_user_id')->default(-1); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | public function maxGeneration(): int |
| 73 | 73 | { |
| 74 | - return (int) DB::table('maj_sosa') |
|
| 74 | + return (int)DB::table('maj_sosa') |
|
| 75 | 75 | ->where('majs_gedcom_id', '=', $this->tree->id()) |
| 76 | 76 | ->where('majs_user_id', '=', $this->user->id()) |
| 77 | 77 | ->max('majs_gen'); |
@@ -148,8 +148,7 @@ discard block |
||
| 148 | 148 | ->selectRaw('SUM(majs_gen * majs_gen) AS sum_x2') |
| 149 | 149 | ->get()->first(); |
| 150 | 150 | |
| 151 | - return $row->n == 0 ? 0 : |
|
| 152 | - -($row->n * $row->sum_xy - $row->sum_x * $row->sum_y) / ($row->n * $row->sum_x2 - pow($row->sum_x, 2)); |
|
| 151 | + return $row->n == 0 ? 0 : -($row->n * $row->sum_xy - $row->sum_x * $row->sum_y) / ($row->n * $row->sum_x2 - pow($row->sum_x, 2)); |
|
| 153 | 152 | } |
| 154 | 153 | |
| 155 | 154 | /** |
@@ -173,10 +172,10 @@ discard block |
||
| 173 | 172 | |
| 174 | 173 | $statistics_by_gen = []; |
| 175 | 174 | foreach ($stats_by_gen as $gen => $stats_gen) { |
| 176 | - $statistics_by_gen[(int) $stats_gen->gen] = array( |
|
| 177 | - 'sosaCount' => (int) $stats_gen->total_sosa, |
|
| 178 | - 'sosaTotalCount' => (int) $cumul_stats_by_gen[$gen]->total_cumul, |
|
| 179 | - 'diffSosaTotalCount' => (int) $cumul_stats_by_gen[$gen]->total_distinct_cumul, |
|
| 175 | + $statistics_by_gen[(int)$stats_gen->gen] = array( |
|
| 176 | + 'sosaCount' => (int)$stats_gen->total_sosa, |
|
| 177 | + 'sosaTotalCount' => (int)$cumul_stats_by_gen[$gen]->total_cumul, |
|
| 178 | + 'diffSosaTotalCount' => (int)$cumul_stats_by_gen[$gen]->total_distinct_cumul, |
|
| 180 | 179 | 'firstBirth' => $stats_gen->first_year, |
| 181 | 180 | 'firstEstimatedBirth' => $stats_gen->first_est_year, |
| 182 | 181 | 'lastBirth' => $stats_gen->last_year, |
@@ -220,7 +219,7 @@ discard block |
||
| 220 | 219 | ->where('majs_user_id', '=', $this->user->id()); |
| 221 | 220 | |
| 222 | 221 | return DB::table('maj_sosa') |
| 223 | - ->joinSub($list_gen, 'list_gen', function (JoinClause $join): void { |
|
| 222 | + ->joinSub($list_gen, 'list_gen', function(JoinClause $join): void { |
|
| 224 | 223 | $join->on('maj_sosa.majs_gen', '<=', 'list_gen.majs_gen') |
| 225 | 224 | ->where('majs_gedcom_id', '=', $this->tree->id()) |
| 226 | 225 | ->where('majs_user_id', '=', $this->user->id()); |
@@ -254,26 +253,26 @@ discard block |
||
| 254 | 253 | { |
| 255 | 254 | $table_prefix = DB::connection()->getTablePrefix(); |
| 256 | 255 | $missing_ancestors_by_gen = DB::table('maj_sosa AS sosa') |
| 257 | - ->selectRaw($table_prefix . 'sosa.majs_gen - ? AS majs_gen_norm', [$gen]) |
|
| 258 | - ->selectRaw('FLOOR(((' . $table_prefix . 'sosa.majs_sosa / POW(2, ' . $table_prefix . 'sosa.majs_gen -1 )) - 1) * POWER(2, ? - 1)) + POWER(2, ? - 1) AS root_ancestor', [$gen, $gen]) //@phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 259 | - ->selectRaw('SUM(CASE WHEN ' . $table_prefix . 'sosa_fat.majs_i_id IS NULL AND ' . $table_prefix . 'sosa_mot.majs_i_id IS NULL THEN 1 ELSE 0 END) AS full_root_count') //@phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 260 | - ->selectRaw('SUM(CASE WHEN ' . $table_prefix . 'sosa_fat.majs_i_id IS NULL AND ' . $table_prefix . 'sosa_mot.majs_i_id IS NULL THEN 0 ELSE 1 END) As semi_root_count') //@phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 261 | - ->leftJoin('maj_sosa AS sosa_fat', function (JoinClause $join) use ($table_prefix): void { |
|
| 256 | + ->selectRaw($table_prefix.'sosa.majs_gen - ? AS majs_gen_norm', [$gen]) |
|
| 257 | + ->selectRaw('FLOOR((('.$table_prefix.'sosa.majs_sosa / POW(2, '.$table_prefix.'sosa.majs_gen -1 )) - 1) * POWER(2, ? - 1)) + POWER(2, ? - 1) AS root_ancestor', [$gen, $gen]) //@phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 258 | + ->selectRaw('SUM(CASE WHEN '.$table_prefix.'sosa_fat.majs_i_id IS NULL AND '.$table_prefix.'sosa_mot.majs_i_id IS NULL THEN 1 ELSE 0 END) AS full_root_count') //@phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 259 | + ->selectRaw('SUM(CASE WHEN '.$table_prefix.'sosa_fat.majs_i_id IS NULL AND '.$table_prefix.'sosa_mot.majs_i_id IS NULL THEN 0 ELSE 1 END) As semi_root_count') //@phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 260 | + ->leftJoin('maj_sosa AS sosa_fat', function(JoinClause $join) use ($table_prefix): void { |
|
| 262 | 261 | // Link to sosa's father |
| 263 | - $join->whereRaw($table_prefix . 'sosa_fat.majs_sosa = 2 * ' . $table_prefix . 'sosa.majs_sosa') |
|
| 262 | + $join->whereRaw($table_prefix.'sosa_fat.majs_sosa = 2 * '.$table_prefix.'sosa.majs_sosa') |
|
| 264 | 263 | ->where('sosa_fat.majs_gedcom_id', '=', $this->tree->id()) |
| 265 | 264 | ->where('sosa_fat.majs_user_id', '=', $this->user->id()); |
| 266 | 265 | }) |
| 267 | - ->leftJoin('maj_sosa AS sosa_mot', function (JoinClause $join) use ($table_prefix): void { |
|
| 266 | + ->leftJoin('maj_sosa AS sosa_mot', function(JoinClause $join) use ($table_prefix): void { |
|
| 268 | 267 | // Link to sosa's mother |
| 269 | - $join->whereRaw($table_prefix . 'sosa_mot.majs_sosa = 2 * ' . $table_prefix . 'sosa.majs_sosa + 1') |
|
| 268 | + $join->whereRaw($table_prefix.'sosa_mot.majs_sosa = 2 * '.$table_prefix.'sosa.majs_sosa + 1') |
|
| 270 | 269 | ->where('sosa_mot.majs_gedcom_id', '=', $this->tree->id()) |
| 271 | 270 | ->where('sosa_mot.majs_user_id', '=', $this->user->id()); |
| 272 | 271 | }) |
| 273 | 272 | ->where('sosa.majs_gedcom_id', '=', $this->tree->id()) |
| 274 | 273 | ->where('sosa.majs_user_id', '=', $this->user->id()) |
| 275 | 274 | ->where('sosa.majs_gen', '>=', $gen) |
| 276 | - ->where(function (Builder $query): void { |
|
| 275 | + ->where(function(Builder $query): void { |
|
| 277 | 276 | $query->whereNull('sosa_fat.majs_i_id') |
| 278 | 277 | ->orWhereNull('sosa_mot.majs_i_id'); |
| 279 | 278 | }) |
@@ -282,11 +281,11 @@ discard block |
||
| 282 | 281 | return DB::table('maj_sosa AS sosa_list') |
| 283 | 282 | ->select(['stats_by_gen.root_ancestor AS root_ancestor_sosa', 'sosa_list.majs_i_id as root_ancestor_id']) |
| 284 | 283 | ->selectRaw('1 + SUM( (majs_gen_norm) * ( 2 * full_root_count + semi_root_count) / (2 * POWER(2, majs_gen_norm))) AS mean_gen_depth') //@phpcs:ignore Generic.Files.LineLength.TooLong |
| 285 | - ->selectRaw(' SQRT(' . |
|
| 286 | - ' SUM(POWER(majs_gen_norm, 2) * ( 2 * full_root_count + semi_root_count) / (2 * POWER(2, majs_gen_norm)))' . //@phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 287 | - ' - POWER( SUM( (majs_gen_norm) * ( 2 * full_root_count + semi_root_count) / (2 * POWER(2, majs_gen_norm))), 2)' . //@phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 284 | + ->selectRaw(' SQRT('. |
|
| 285 | + ' SUM(POWER(majs_gen_norm, 2) * ( 2 * full_root_count + semi_root_count) / (2 * POWER(2, majs_gen_norm)))'.//@phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 286 | + ' - POWER( SUM( (majs_gen_norm) * ( 2 * full_root_count + semi_root_count) / (2 * POWER(2, majs_gen_norm))), 2)'.//@phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 288 | 287 | ' ) AS stddev_gen_depth') |
| 289 | - ->joinSub($missing_ancestors_by_gen, 'stats_by_gen', function (JoinClause $join): void { |
|
| 288 | + ->joinSub($missing_ancestors_by_gen, 'stats_by_gen', function(JoinClause $join): void { |
|
| 290 | 289 | $join->on('sosa_list.majs_sosa', '=', 'stats_by_gen.root_ancestor') |
| 291 | 290 | ->where('sosa_list.majs_gedcom_id', '=', $this->tree->id()) |
| 292 | 291 | ->where('sosa_list.majs_user_id', '=', $this->user->id()); |
@@ -315,16 +314,16 @@ discard block |
||
| 315 | 314 | $table_prefix = DB::connection()->getTablePrefix(); |
| 316 | 315 | $multiple_ancestors = DB::table('maj_sosa AS sosa') |
| 317 | 316 | ->select('sosa.majs_i_id AS sosa_i_id') |
| 318 | - ->selectRaw('COUNT(' . $table_prefix . 'sosa.majs_sosa) AS sosa_count') |
|
| 319 | - ->leftJoin('maj_sosa AS sosa_fat', function (JoinClause $join) use ($table_prefix): void { |
|
| 317 | + ->selectRaw('COUNT('.$table_prefix.'sosa.majs_sosa) AS sosa_count') |
|
| 318 | + ->leftJoin('maj_sosa AS sosa_fat', function(JoinClause $join) use ($table_prefix): void { |
|
| 320 | 319 | // Link to sosa's father |
| 321 | - $join->whereRaw($table_prefix . 'sosa_fat.majs_sosa = 2 * ' . $table_prefix . 'sosa.majs_sosa') |
|
| 320 | + $join->whereRaw($table_prefix.'sosa_fat.majs_sosa = 2 * '.$table_prefix.'sosa.majs_sosa') |
|
| 322 | 321 | ->where('sosa_fat.majs_gedcom_id', '=', $this->tree->id()) |
| 323 | 322 | ->where('sosa_fat.majs_user_id', '=', $this->user->id()); |
| 324 | 323 | }) |
| 325 | - ->leftJoin('maj_sosa AS sosa_mot', function (JoinClause $join) use ($table_prefix): void { |
|
| 324 | + ->leftJoin('maj_sosa AS sosa_mot', function(JoinClause $join) use ($table_prefix): void { |
|
| 326 | 325 | // Link to sosa's mother |
| 327 | - $join->whereRaw($table_prefix . 'sosa_mot.majs_sosa = 2 * ' . $table_prefix . 'sosa.majs_sosa + 1') |
|
| 326 | + $join->whereRaw($table_prefix.'sosa_mot.majs_sosa = 2 * '.$table_prefix.'sosa.majs_sosa + 1') |
|
| 328 | 327 | ->where('sosa_mot.majs_gedcom_id', '=', $this->tree->id()) |
| 329 | 328 | ->where('sosa_mot.majs_user_id', '=', $this->user->id()); |
| 330 | 329 | }) |
@@ -333,15 +332,15 @@ discard block |
||
| 333 | 332 | ->whereNull('sosa_fat.majs_sosa') // We keep only root individuals, i.e. those with no father or mother |
| 334 | 333 | ->whereNull('sosa_mot.majs_sosa') |
| 335 | 334 | ->groupBy('sosa.majs_i_id') |
| 336 | - ->havingRaw('COUNT(' . $table_prefix . 'sosa.majs_sosa) > 1') // Limit to the duplicate sosas. |
|
| 337 | - ->orderByRaw('COUNT(' . $table_prefix . 'sosa.majs_sosa) DESC, MIN(' . $table_prefix . 'sosa.majs_sosa) ASC') //@phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 335 | + ->havingRaw('COUNT('.$table_prefix.'sosa.majs_sosa) > 1') // Limit to the duplicate sosas. |
|
| 336 | + ->orderByRaw('COUNT('.$table_prefix.'sosa.majs_sosa) DESC, MIN('.$table_prefix.'sosa.majs_sosa) ASC') //@phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 338 | 337 | ->limit($limit + 1) // We want to select one more than required, for ties |
| 339 | 338 | ->get(); |
| 340 | 339 | |
| 341 | 340 | if ($multiple_ancestors->count() > $limit) { |
| 342 | 341 | $last_count = $multiple_ancestors->last()->sosa_count; |
| 343 | - $multiple_ancestors = $multiple_ancestors->reject(function ($element) use ($last_count): bool { |
|
| 344 | - return $element->sosa_count == $last_count; |
|
| 342 | + $multiple_ancestors = $multiple_ancestors->reject(function($element) use ($last_count): bool { |
|
| 343 | + return $element->sosa_count == $last_count; |
|
| 345 | 344 | }); |
| 346 | 345 | } |
| 347 | 346 | return $multiple_ancestors; |
@@ -147,7 +147,7 @@ |
||
| 147 | 147 | { |
| 148 | 148 | if ( |
| 149 | 149 | count($this->tmp_sosa_table) > 0 && |
| 150 | - ($force || count($this->tmp_sosa_table) >= self::TMP_SOSA_TABLE_LIMIT) |
|
| 150 | + ($force || count($this->tmp_sosa_table) >= self::TMP_SOSA_TABLE_LIMIT) |
|
| 151 | 151 | ) { |
| 152 | 152 | $this->sosa_records_service->insertOrUpdate($this->tree, $this->user, $this->tmp_sosa_table); |
| 153 | 153 | $this->tmp_sosa_table = array(); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | public function generation(int $sosa): int |
| 44 | 44 | { |
| 45 | - return (int) log($sosa, 2) + 1; |
|
| 45 | + return (int)log($sosa, 2) + 1; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -95,14 +95,14 @@ discard block |
||
| 95 | 95 | { |
| 96 | 96 | $table_prefix = DB::connection()->getTablePrefix(); |
| 97 | 97 | return DB::table('families') |
| 98 | - ->join('maj_sosa AS sosa_husb', function (JoinClause $join) use ($tree, $user): void { |
|
| 98 | + ->join('maj_sosa AS sosa_husb', function(JoinClause $join) use ($tree, $user): void { |
|
| 99 | 99 | // Link to family husband |
| 100 | 100 | $join->on('families.f_file', '=', 'sosa_husb.majs_gedcom_id') |
| 101 | 101 | ->on('families.f_husb', '=', 'sosa_husb.majs_i_id') |
| 102 | 102 | ->where('sosa_husb.majs_gedcom_id', '=', $tree->id()) |
| 103 | 103 | ->where('sosa_husb.majs_user_id', '=', $user->id()); |
| 104 | 104 | }) |
| 105 | - ->join('maj_sosa AS sosa_wife', function (JoinClause $join) use ($tree, $user): void { |
|
| 105 | + ->join('maj_sosa AS sosa_wife', function(JoinClause $join) use ($tree, $user): void { |
|
| 106 | 106 | // Link to family husband |
| 107 | 107 | $join->on('families.f_file', '=', 'sosa_wife.majs_gedcom_id') |
| 108 | 108 | ->on('families.f_wife', '=', 'sosa_wife.majs_i_id') |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | }) |
| 112 | 112 | ->select(['sosa_husb.majs_sosa', 'families.f_id']) |
| 113 | 113 | ->where('sosa_husb.majs_gen', '=', $gen) |
| 114 | - ->whereRaw($table_prefix . 'sosa_husb.majs_sosa + 1 = ' . $table_prefix . 'sosa_wife.majs_sosa') |
|
| 114 | + ->whereRaw($table_prefix.'sosa_husb.majs_sosa + 1 = '.$table_prefix.'sosa_wife.majs_sosa') |
|
| 115 | 115 | ->orderBy('sosa_husb.majs_sosa') |
| 116 | 116 | ->get(); |
| 117 | 117 | } |
@@ -134,28 +134,28 @@ discard block |
||
| 134 | 134 | $table_prefix = DB::connection()->getTablePrefix(); |
| 135 | 135 | return DB::table('maj_sosa AS sosa') |
| 136 | 136 | ->select(['sosa.majs_i_id', 'sosa_fat.majs_i_id AS majs_fat_id', 'sosa_mot.majs_i_id AS majs_mot_id']) |
| 137 | - ->selectRaw('MIN(' . $table_prefix . 'sosa.majs_sosa) AS majs_sosa') |
|
| 138 | - ->leftJoin('maj_sosa AS sosa_fat', function (JoinClause $join) use ($tree, $user, $table_prefix): void { |
|
| 137 | + ->selectRaw('MIN('.$table_prefix.'sosa.majs_sosa) AS majs_sosa') |
|
| 138 | + ->leftJoin('maj_sosa AS sosa_fat', function(JoinClause $join) use ($tree, $user, $table_prefix): void { |
|
| 139 | 139 | // Link to sosa's father |
| 140 | - $join->whereRaw($table_prefix . 'sosa_fat.majs_sosa = 2 * ' . $table_prefix . 'sosa.majs_sosa') |
|
| 140 | + $join->whereRaw($table_prefix.'sosa_fat.majs_sosa = 2 * '.$table_prefix.'sosa.majs_sosa') |
|
| 141 | 141 | ->where('sosa_fat.majs_gedcom_id', '=', $tree->id()) |
| 142 | 142 | ->where('sosa_fat.majs_user_id', '=', $user->id()); |
| 143 | 143 | }) |
| 144 | - ->leftJoin('maj_sosa AS sosa_mot', function (JoinClause $join) use ($tree, $user, $table_prefix): void { |
|
| 144 | + ->leftJoin('maj_sosa AS sosa_mot', function(JoinClause $join) use ($tree, $user, $table_prefix): void { |
|
| 145 | 145 | // Link to sosa's mother |
| 146 | - $join->whereRaw($table_prefix . 'sosa_mot.majs_sosa = 2 * ' . $table_prefix . 'sosa.majs_sosa + 1') |
|
| 146 | + $join->whereRaw($table_prefix.'sosa_mot.majs_sosa = 2 * '.$table_prefix.'sosa.majs_sosa + 1') |
|
| 147 | 147 | ->where('sosa_mot.majs_gedcom_id', '=', $tree->id()) |
| 148 | 148 | ->where('sosa_mot.majs_user_id', '=', $user->id()); |
| 149 | 149 | }) |
| 150 | 150 | ->where('sosa.majs_gedcom_id', '=', $tree->id()) |
| 151 | 151 | ->where('sosa.majs_user_id', '=', $user->id()) |
| 152 | 152 | ->where('sosa.majs_gen', '=', $gen - 1) |
| 153 | - ->where(function (Builder $query): void { |
|
| 153 | + ->where(function(Builder $query): void { |
|
| 154 | 154 | $query->whereNull('sosa_fat.majs_i_id') |
| 155 | 155 | ->orWhereNull('sosa_mot.majs_i_id'); |
| 156 | 156 | }) |
| 157 | 157 | ->groupBy('sosa.majs_i_id', 'sosa_fat.majs_i_id', 'sosa_mot.majs_i_id') |
| 158 | - ->orderByRaw('MIN(' . $table_prefix . 'sosa.majs_sosa)') |
|
| 158 | + ->orderByRaw('MIN('.$table_prefix.'sosa.majs_sosa)') |
|
| 159 | 159 | ->get(); |
| 160 | 160 | } |
| 161 | 161 | |
@@ -206,28 +206,28 @@ discard block |
||
| 206 | 206 | $bindings_placeholders = $bindings_values = []; |
| 207 | 207 | foreach ($sosa_records as $i => $row) { |
| 208 | 208 | $gen = $this->generation($row['sosa']); |
| 209 | - if ($gen <= self::MAX_DB_GENERATIONS) { |
|
| 209 | + if ($gen <= self::MAX_DB_GENERATIONS) { |
|
| 210 | 210 | if ($mass_update) { |
| 211 | - $bindings_placeholders[] = '(:tree_id' . $i . ', :user_id' . $i . ', :sosa' . $i . ',' . |
|
| 212 | - ' :indi_id' . $i . ', :gen' . $i . ',' . |
|
| 213 | - ' :byear' . $i . ', :byearest' . $i . ', :dyear' . $i . ', :dyearest' . $i . ')'; |
|
| 211 | + $bindings_placeholders[] = '(:tree_id'.$i.', :user_id'.$i.', :sosa'.$i.','. |
|
| 212 | + ' :indi_id'.$i.', :gen'.$i.','. |
|
| 213 | + ' :byear'.$i.', :byearest'.$i.', :dyear'.$i.', :dyearest'.$i.')'; |
|
| 214 | 214 | $bindings_values = array_merge( |
| 215 | 215 | $bindings_values, |
| 216 | 216 | [ |
| 217 | - 'tree_id' . $i => $tree->id(), |
|
| 218 | - 'user_id' . $i => $user->id(), |
|
| 219 | - 'sosa' . $i => $row['sosa'], |
|
| 220 | - 'indi_id' . $i => $row['indi'], |
|
| 221 | - 'gen' . $i => $gen, |
|
| 222 | - 'byear' . $i => $row['birth_year'], |
|
| 223 | - 'byearest' . $i => $row['birth_year_est'], |
|
| 224 | - 'dyear' . $i => $row['death_year'], |
|
| 225 | - 'dyearest' . $i => $row['death_year_est'] |
|
| 217 | + 'tree_id'.$i => $tree->id(), |
|
| 218 | + 'user_id'.$i => $user->id(), |
|
| 219 | + 'sosa'.$i => $row['sosa'], |
|
| 220 | + 'indi_id'.$i => $row['indi'], |
|
| 221 | + 'gen'.$i => $gen, |
|
| 222 | + 'byear'.$i => $row['birth_year'], |
|
| 223 | + 'byearest'.$i => $row['birth_year_est'], |
|
| 224 | + 'dyear'.$i => $row['death_year'], |
|
| 225 | + 'dyearest'.$i => $row['death_year_est'] |
|
| 226 | 226 | ] |
| 227 | 227 | ); |
| 228 | 228 | } else { |
| 229 | 229 | DB::table('maj_sosa')->updateOrInsert( |
| 230 | - [ 'majs_gedcom_id' => $tree->id(), 'majs_user_id' => $user->id(), 'majs_sosa' => $row['sosa']], |
|
| 230 | + ['majs_gedcom_id' => $tree->id(), 'majs_user_id' => $user->id(), 'majs_sosa' => $row['sosa']], |
|
| 231 | 231 | [ |
| 232 | 232 | 'majs_i_id' => $row['indi'], |
| 233 | 233 | 'majs_gen' => $gen, |
@@ -243,12 +243,12 @@ discard block |
||
| 243 | 243 | |
| 244 | 244 | if ($mass_update) { |
| 245 | 245 | DB::connection()->statement( |
| 246 | - 'INSERT INTO `' . DB::connection()->getTablePrefix() . 'maj_sosa`' . |
|
| 247 | - ' (majs_gedcom_id, majs_user_id, majs_sosa,' . |
|
| 248 | - ' majs_i_id, majs_gen, majs_birth_year, majs_birth_year_est, majs_death_year, majs_death_year_est)' . |
|
| 249 | - ' VALUES ' . implode(',', $bindings_placeholders) . |
|
| 250 | - ' ON DUPLICATE KEY UPDATE majs_i_id = VALUES(majs_i_id), majs_gen = VALUES(majs_gen),' . |
|
| 251 | - ' majs_birth_year = VALUES(majs_birth_year), majs_birth_year_est = VALUES(majs_birth_year_est),' . |
|
| 246 | + 'INSERT INTO `'.DB::connection()->getTablePrefix().'maj_sosa`'. |
|
| 247 | + ' (majs_gedcom_id, majs_user_id, majs_sosa,'. |
|
| 248 | + ' majs_i_id, majs_gen, majs_birth_year, majs_birth_year_est, majs_death_year, majs_death_year_est)'. |
|
| 249 | + ' VALUES '.implode(',', $bindings_placeholders). |
|
| 250 | + ' ON DUPLICATE KEY UPDATE majs_i_id = VALUES(majs_i_id), majs_gen = VALUES(majs_gen),'. |
|
| 251 | + ' majs_birth_year = VALUES(majs_birth_year), majs_birth_year_est = VALUES(majs_birth_year_est),'. |
|
| 252 | 252 | ' majs_death_year = VALUES(majs_death_year), majs_death_year_est = VALUES(majs_death_year_est)', |
| 253 | 253 | $bindings_values |
| 254 | 254 | ); |