mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 16:44:07 +01:00
Add phpgw_nextid table and common->nextid function
This commit is contained in:
parent
3604032b53
commit
db844b2ddb
@ -1258,4 +1258,34 @@
|
||||
system("grep -r '^[ \t]*function' *");
|
||||
echo '</pre>';
|
||||
}
|
||||
|
||||
// This will return a value for the next id an app may need to insert values into ldap.
|
||||
/*!
|
||||
@function next_id
|
||||
@abstract return the next higher value for an integer, and increment it in the db.
|
||||
*/
|
||||
function next_id($appname)
|
||||
{
|
||||
global $phpgw;
|
||||
|
||||
if (!$appname) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
$phpgw->db->query("SELECT id FROM phpgw_nextid WHERE appname='".$appname."'");
|
||||
while( $phpgw->db->next_record() ) {
|
||||
$id = $phpgw->db->f("id");
|
||||
}
|
||||
|
||||
if (empty($id) || !$id) {
|
||||
$id = 1;
|
||||
$phpgw->db->query("INSERT INTO phpgw_nextid (appname,id) VALUES ('".$appname."',".$id.")");
|
||||
$phpgw->db->query("UPDATE phpgw_nextid SET id=".$id." WHERE appname='".$appname."'");
|
||||
} else {
|
||||
$id = $id + 1;
|
||||
$phpgw->db->query("UPDATE phpgw_nextid SET id=".$id." WHERE appname='".$appname."'");
|
||||
}
|
||||
|
||||
return intval($id);
|
||||
}
|
||||
}//end common class
|
||||
|
@ -321,7 +321,7 @@
|
||||
note_id int(20) NOT NULL auto_increment,
|
||||
note_owner int(11),
|
||||
note_date int(11),
|
||||
note_category int(9),
|
||||
note_category int(9),
|
||||
note_content text,
|
||||
PRIMARY KEY (note_id)
|
||||
)";
|
||||
@ -336,7 +336,14 @@
|
||||
);";
|
||||
$phpgw_setup->db->query($sql);
|
||||
|
||||
$phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.10pre18';
|
||||
$sql = "create table phpgw_nextid (
|
||||
appname varchar(25),
|
||||
id int(8),
|
||||
UNIQUE (appname)
|
||||
)";
|
||||
$phpgw_setup->db->query($sql);
|
||||
|
||||
$phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.10pre19';
|
||||
$phpgw_info['setup']['oldver']['phpgwapi'] = $phpgw_info['setup']['currentver']['phpgwapi'];
|
||||
update_version_table();
|
||||
// $phpgw_setup->update_version_table();
|
||||
|
@ -1322,6 +1322,20 @@
|
||||
$phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.10pre18';
|
||||
}
|
||||
|
||||
$test[] = '0.9.10pre18';
|
||||
function upgrade0_9_10pre18() {
|
||||
global $phpgw_info, $phpgw_setup;
|
||||
|
||||
$sql = "create table phpgw_nextid (
|
||||
appname varchar(25),
|
||||
id int(8),
|
||||
UNIQUE (appname)
|
||||
)";
|
||||
|
||||
$phpgw_setup->db->query($sql);
|
||||
$phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.10pre19';
|
||||
}
|
||||
|
||||
reset ($test);
|
||||
while (list ($key, $value) = each ($test)){
|
||||
if ($phpgw_info["setup"]["currentver"]["phpgwapi"] == $value) {
|
||||
|
@ -291,7 +291,7 @@
|
||||
note_id serial,
|
||||
note_owner int,
|
||||
note_date int,
|
||||
note_category int,
|
||||
note_category int,
|
||||
note_content text
|
||||
)";
|
||||
$phpgw_setup->db->query($sql);
|
||||
@ -304,7 +304,13 @@
|
||||
)";
|
||||
$phpgw_setup->db->query($sql);
|
||||
|
||||
$phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.10pre18';
|
||||
$sql = "create table phpgw_nextid (
|
||||
appname varchar(25),
|
||||
id int
|
||||
)";
|
||||
$phpgw_setup->db->query($sql);
|
||||
|
||||
$phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.10pre19';
|
||||
$phpgw_info['setup']['oldver']['phpgwapi'] = $phpgw_info['setup']['currentver']['phpgwapi'];
|
||||
update_version_table();
|
||||
?>
|
||||
|
@ -1570,6 +1570,18 @@
|
||||
$phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.10pre18';
|
||||
}
|
||||
|
||||
$test[] = '0.9.10pre18';
|
||||
function upgrade0_9_10pre18() {
|
||||
global $phpgw_info, $phpgw_setup;
|
||||
|
||||
$sql = "create table phpgw_nextid (
|
||||
appname varchar(25),
|
||||
id int
|
||||
)";
|
||||
|
||||
$phpgw_setup->db->query($sql);
|
||||
$phpgw_info['setup']['currentver']['phpgwapi'] = '0.9.10pre19';
|
||||
}
|
||||
|
||||
reset ($test);
|
||||
while (list ($key, $value) = each ($test)){
|
||||
|
@ -11,5 +11,5 @@
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
$phpgw_info["server"]["versions"]["phpgwapi"] = "0.9.10pre18";
|
||||
$phpgw_info["server"]["versions"]["phpgwapi"] = "0.9.10pre19";
|
||||
$phpgw_info["server"]["versions"]["current_header"] = "1.11";
|
||||
|
Loading…
Reference in New Issue
Block a user