[Building Sakai] Sakai BasicSQLService - Can we add dbUpdate() Methods?

Noah Botimer botimer at umich.edu
Tue Jul 19 18:13:00 PDT 2011


While I agree that we should A) generally use Spring JDBC and B) move away from building/maintaining too much that is implemented by reputable libraries, there are existing places where mixing libraries would be even worse.

I looked through BasicSqlService and this would be a very straightforward change. The code in place just discards the desired return value, so the refactoring has a clean, backward-compatible path and almost no code addition.

If there is code that already uses SqlService and needs this, I'd say that adding a dependency and another set of semantics is probably just extra technical overhead. Also, let's not forget that there are a bunch of folks familiar with the voluminous legacy code but not necessarily Spring JDBC (granting that it is pretty simple).

I would be in favor of implementing this with a -1 return in the failure case (when dbWrite would return false). I'll prepare a patch for review unless there is hot dispute.

Thanks,
-Noah

On Jul 19, 2011, at 8:11 PM, Steve Swinsburg wrote:

> I agree, use Spring JDBC if you want to manage your own SQL statements. It handles the rest.
> 
> cheers,
> Steve
> 
> 
> On 20/07/2011, at 3:26 AM, Aaron Zeckoski wrote:
> 
>> SpringJDBC handles this very nicely. I would say it is better to just use that.
>> http://static.springsource.org/spring/docs/2.0.x/api/org/springframework/jdbc/core/JdbcTemplate.html#update(java.lang.String)
>> 
>> Personally, I would to see us moving away from maintaining our own
>> ORM/DB-mapping thing in the longer run (where feasible anyway).
>> 
>> -AZ
>> 
>> 
>> On Tue, Jul 19, 2011 at 1:06 PM, csev <csev at umich.edu> wrote:
>>> Sakai's BasicSQL Service is missing the ability to handle UPDATE statements.  It contains a sequence methods:
>>> 
>>> dbRead() - Returns a record set
>>> dbWrite() - Returns true/false based on success of the SQL statement
>>> dbInsert() - Similar to dbWrite - but returns the generated auto-increment key.
>>> 
>>> Generally UPDATE statements are done with dbWrite() - it returns a true/false indicating if it worked or failed.
>>> 
>>> Sometimes UPDATE semantics need to know the number of records affected in order to know if the UPDATE accomplished the desired results.
>>> 
>>> As best I can tell, there is no way to accomplish this using the current BasisSQLService.
>>> 
>>> I would like to add dbUpdate() methods that are like dbWrite except that they return an integer number of records affected rather than a true/false return.
>>> 
>>> Thoughts / comments / redirects?
>>> 
>>> /Chuck
>>> 
>>> _______________________________________________
>>> sakai-dev mailing list
>>> sakai-dev at collab.sakaiproject.org
>>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>>> 
>>> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"
>>> 
>> 
>> 
>> 
>> -- 
>> Aaron Zeckoski - Software Architect - http://tinyurl.com/azprofile
>> _______________________________________________
>> sakai-dev mailing list
>> sakai-dev at collab.sakaiproject.org
>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>> 
>> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"
> 
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
> 
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"
> 
> 



More information about the sakai-dev mailing list