311 |
ExecuteScript($db,'sql/patch/upgrade7.sql'); |
ExecuteScript($db,'sql/patch/upgrade7.sql'); |
312 |
// now we use sequence instead of computing a max |
// now we use sequence instead of computing a max |
313 |
// |
// |
314 |
$Res=ExecSql($db,'select max(jr_grpt_id) as L from jrn'); |
$Res2=ExecSql($db,'select coalesce(max(jr_grpt_id),1) as l from jrn'); |
315 |
if ( pg_NumRows($Res) == 1) { |
$Max2= pg_NumRows($Res2) ; |
316 |
$Row=pg_fetch_array($Res,0); |
if ( $Max2 == 1) { |
317 |
$Max=$Row['L']; |
$Row=pg_fetch_array($Res2,0); |
318 |
$Res=ExecSql($db,"select setval('s_grpt',$Max,true)"); |
var_dump($Row); |
319 |
|
$M=$Row['l']; |
320 |
|
ExecSql($db,"select setval('s_grpt',$M,true)"); |
321 |
} |
} |
322 |
} // version == 6 |
} // version == 7 |
323 |
|
|
324 |
} |
} |
325 |
|
|
346 |
ExecuteScript($db,'sql/patch/upgrade5.sql'); |
ExecuteScript($db,'sql/patch/upgrade5.sql'); |
347 |
} // version == 5 |
} // version == 5 |
348 |
|
|
349 |
|
|
350 |
|
//-- |
351 |
|
// update to the version 7 |
352 |
|
//-- |
353 |
|
if ( GetVersion($db) == 6 ) { |
354 |
|
ExecuteScript($db,'sql/patch/upgrade6.sql'); |
355 |
|
} // version == 6 |
356 |
|
|
357 |
|
//-- |
358 |
|
// update to the version 8 |
359 |
|
//-- |
360 |
|
if ( GetVersion($db) == 7 ) { |
361 |
|
ExecuteScript($db,'sql/patch/upgrade7.sql'); |
362 |
|
// now we use sequence instead of computing a max |
363 |
|
// |
364 |
|
$Res2=ExecSql($db,'select coalesce(max(jr_grpt_id),1) as l from jrn'); |
365 |
|
$Max2= pg_NumRows($Res2) ; |
366 |
|
if ( $Max2 == 1) { |
367 |
|
$Row=pg_fetch_array($Res2,0); |
368 |
|
$M=$Row['l']; |
369 |
|
ExecSql($db,"select setval('s_grpt',$M,true)"); |
370 |
|
} |
371 |
|
} // version == 7 |
372 |
|
|
373 |
} |
} |
374 |
$cn=DbConnect(); |
$cn=DbConnect(); |
375 |
if ( GetVersion($cn) <= 4 ) { |
if ( GetVersion($cn) <= 4 ) { |