The JStore Functions


newer_version.sql

delimiter //
create function newer_version(class_name VARCHAR(256),the_version TEXT,the_notes VARCHAR(512))
 returns  INT 
begin
select count(*)+1 into  @jscount from java_store where file_name=class_name;
insert into java_store (file_name, version_id, save_time,this_version,notes)
   values(class_name,@jscount,NOW(),the_version,the_notes);
return @jscount;
end;
//
delimiter ;

get_version.sql

 
delimiter //
create function get_version(class_name VARCHAR(256),which_version INT)
 returns  TEXT 
begin
select concat(this_version,'ccss44001100',notes) as  count_string into @version_ans 
   from java_store where file_name=class_name AND version_id=which_version;
return @version_ans;
end;
//
delimiter ;

update_notes.sql

delimiter //
create function update_notes(class_name VARCHAR(256),which_version INT,the_notes VARCHAR(512))
 returns  INT 
begin
update java_store SET notes=the_notes where  file_name=class_name AND version_id=which_version;
return ROW_COUNT();
end;
//
delimiter ;