|
|
 Rank: Aficionado
Joined: 12/21/2007 Posts: 122 Location: Belgium
|
Hello everyone, Here is a link to a brand new version of the data layer. (Full project files.) Currently, it offers the following functionality: * Generalized SQL data access trough a specialized set of classes * Support for multiple databases - SQL Server support built-in - MySQL support built-in * Extensions and utilities - Extensions that perform tasks on executed queries - logging - Utilities that create queries - installerSuccessful testcase: (works with Sql Server and MySql) * install Umbraco * install Warren’s Buckley Creative Website Wizard ( use the modified version here, because the original made a few direct calls to the SQL Server interface, I changed this to data layer calls) * edit pages, add pages, … Known issues:* it can be impossible to access the Umbraco control panel right after the installation with Firefox. I’ve seen several Firefox crashes as well. Not sure if this is related to my code. No problems with IE. * this code has not been extensively tested - I do not dare say that I only make 1 mistake every 100 lines of code I write. And for this project, I had to alter more than 1.000. So there could be a lot of bugs. Changes in the code:* new Datalayer project * every single database call in other Umbraco code was altered (a few 100 I guess) * lots of minor changes to code and queries for compatibility Future wishes:* make all SQL-calls clean with ISqlParameters and a uniform syntax * this is a first step to get rid of all SQL code in the business layer - SQL queries are replaced by function call to a certain data layer class - the class translates this into “general” SQL - this SQL is passed to specific database adapters - other data layer classes might translate this into another language * this data layer will consist of utilities much like the installer routine I already wrote - So, say hello to sexy code like Code:if(installer.IsEmptyDatabase) installer.Install() (yes, this already works!) I hope to see the data layer integrated in Umbraco soon, hopefully in version 3.1. The code is based on change set 29144, and as you understand it is unfeasible to make all changes again since only few files have remain unchanged. The MySQL support is still experimental, but the SQL Server support should be rock solid. Please, test as much as you can... Happy new year, Ruben Umbraco Core Team Developer | Working on vNext | LinkedIn
|
|
 Rank: Aficionado
Joined: 12/21/2007 Posts: 122 Location: Belgium
|
...and if this code is somewhat approved, comments are coming also. (As you can already see in the ISqlHelper.cs file.) Umbraco Core Team Developer | Working on vNext | LinkedIn
|
|
 Rank: Addict
Joined: 3/17/2008 Posts: 820 Location: Nyborg, Denmark
|
Ruben, what's your codeplex username. This awesome addition should be committed :-D
Thank you for all your hard work! It's terrific!
Jeeeez, did I really start this :-)
|
|
 Rank: Addict
Joined: 7/19/2006 Posts: 733 Location: Leigh-on-Sea, Essex, UK
|
Sounds great work Ruben! Niels/Ruben can you let me know what changes I need to make to my package for this to work with this new datalayer and the current datalayer? Thanks, Warren Warren Buckley an Umbraco MVP 08-09 & level 1 certified developer
|
|
 Rank: Aficionado
Joined: 12/21/2007 Posts: 122 Location: Belgium
|
Hi Niels, My CodePlex username is RubenV. But we should commit carefully, since a lot of changes have been made. How would you propose to get things arranged? (I never worked on a CodePlex project before, but I have experience with SVN systems.) How do you connect to CodePlex? Maybe we need to talk about the license as well. (My code may be used as open source, but I like to know under what license it will go). We should also test all code paths that use databases carefully. Do we do this before or after a CodePlex commit? I'm now deploying a website that uses my datalayer. I already have a small buglist. (Most bugs will not be inside the datalayer itself, but compatibility problems in other places of the code.) * Editing macro's not possible - fixed, IDataReader had to implement IEnumerable * Using to many connections? I got MySql "too many connection errors" after a few hours. I fixed this using a persistent connection. Not sure if this is only MySql related, could be a bug in the connector. * Set date problem (MySql only, sometimes the date format is incompatible) * Simultaneous insert of data type and template (doesn't work, have yet to check out) * Empty trash (doesn't work, have yet to check out) * deleting data type property (doesn't work, have yet to check out) * uploading media [umbraco.cms.businesslogic.Content.XmlGenerate(XmlDocument xd) - "if exists(select nodeId from cmsContentXml where nodeId ="] * Open search (Warren's package, doesn't work, have yet to check out) Ruben Umbraco Core Team Developer | Working on vNext | LinkedIn
|
|
 Rank: Addict
Joined: 7/19/2006 Posts: 733 Location: Leigh-on-Sea, Essex, UK
|
Ruben, my package has a problem with open search which I need to take a look at, when I get some free time. I want to finalise my package and get documentation done and maybe revisit it when your datalayer changes are released into umbraco. Warren :) Warren Buckley an Umbraco MVP 08-09 & level 1 certified developer
|
|
 Rank: Aficionado
Joined: 12/21/2007 Posts: 122 Location: Belgium
|
Warren, You can find the changes you need inside the ZIP-file. If I remember well, only the Installer file had to be changed. If you need any help, please ask. It's just all calls to the Microsoft SqlHelper that had to be replaced by calls to the umbraco SqlHelper. But maybe you should check first if your package can't achieve what you're doing using the business layer, because if that's the case (I haven't checked this), you have a better independence between components. But it's still an early version, maybe Niels should decide first if, how and when he's going to release the datalayer. (Version 3.1?) When it is released into public, I (or others) will look through all available packages and change code if needed. BTW Warren, great package! I taught me all of Umbraco in a few minutes. Umbraco Core Team Developer | Working on vNext | LinkedIn
|
|
 Rank: Addict
Joined: 7/19/2006 Posts: 733 Location: Leigh-on-Sea, Essex, UK
|
Thanks Ruben, it is good to hear that you found my package useful. I will fix all remaining bugs with it first and get it released as v1.00 and write documentation for it and then I will make the relevant changes with you and Niel's help to make the code in the installer universal. Warren Warren Buckley an Umbraco MVP 08-09 & level 1 certified developer
|
|
 Rank: Aficionado
Joined: 12/21/2007 Posts: 122 Location: Belgium
|
Today, version 0.2 of the data layer has been committed to CodePlex. I'm writing a document that explains all changes. Umbraco Core Team Developer | Working on vNext | LinkedIn
|
|
 Rank: Addict
Joined: 2/19/2007 Posts: 634 Location: Belgium
|
Great, do you have a script to generate the mysql db ?
Umbraco tips and tricks: http://www.nibble.be - umbraco mvp 08/09 - certified level 1 & 2 professional
|
|
 Rank: Aficionado
Joined: 12/21/2007 Posts: 122 Location: Belgium
|
Yes, it's inside the installer (part of the data layer now). You can find the SQL source in the datalayer\SqlHelpers\MySql\Sql directory. Umbraco Core Team Developer | Working on vNext | LinkedIn
|
|
 Rank: Addict
Joined: 3/17/2008 Posts: 820 Location: Nyborg, Denmark
|
I just bought a royalty free license for vistadb and I'll try to create a provider. It should be a no-brainer and mean that future umbraco distributions are possible without a separate db server. Vistadb is a fast, full managed embedded database with SQL2005 compatibility and minimal memory footprint (less than 1mb).
This would really rock. In case it works, we could make it the default option (SQL Server is really only ness. if you're running a very large site - say +10.000 nodes)
/n
Jeeeez, did I really start this :-)
|
|
 Rank: Aficionado
Joined: 8/12/2006 Posts: 132 Location: Norway
|
Great work Ruben! :thumbup:
Kenneth Solberg - core dev - level 2 cert pro - my blog
|
|
 Rank: Aficionado
Joined: 12/21/2007 Posts: 122 Location: Belgium
|
OMG Niels, that will be really great. :dribble: If the compatibility is as good as they state, it can go right away with the 3.1 version. Umbraco Core Team Developer | Working on vNext | LinkedIn
|
|
Rank: Aficionado
Joined: 7/19/2006 Posts: 148 Location: aalleren, Denmark
|
Fantastic news! Just looked at the vistaDB, looks great, but what options do you have for migrating a vistaDB site to SQL Server / mysql in case the site gets to the +1000 page "limit" Umbracian Personal blog: Objects.dk
|
|
 Rank: Aficionado
Joined: 12/21/2007 Posts: 122 Location: Belgium
|
Hi Per, interesting question. But I think this should be relatively easy to implement. (In fact, a general solution for database migration.) The only thing we'd have to do is creating a Migratemethod in the installer. Then we could just: * Installer.Install() for the new database, whatever brand it is * Installer.Migrate(oldConnectionString) The Migrate method could be straightforward: Code: for each table in oldDB/newDB (should be the same) results = SELECT * from table using oldConnectionString for each result in results INSERT result INTO table
We probably wouldn't need specific SQL versions, as these all are standard functions. Just some extra care would need to be taken e.g. for disabling auto increment and re-enabling it. Umbraco Core Team Developer | Working on vNext | LinkedIn
|
|
 Rank: Aficionado
Joined: 12/21/2007 Posts: 122 Location: Belgium
|
And I'm just thinking... VistaDB would probably make support for other data sources unnecessary. Why bother to store in, let's say, XML if you can have a full take-away db solution. BTW, funny quote: If VistaDB was a woman... I'd marry it. Umbraco Core Team Developer | Working on vNext | LinkedIn
|
|
 Rank: Aficionado
Joined: 10/30/2007 Posts: 187 Location: Bellingham
|
Ruben - This is awesome...thanks! Just curious, what do you suppose the effort would be to make a database agnostic DAL for Umbraco? Not in any way to detract from what you've done, but it would practically paridise to have Umbraco work with *ANY* database/datastore. There are many possibilities out there now: VisatDB, Firebird, AmazonDB, etc, etc.... Thanks again, -Paul motusconnect.com :: level-2 certified :: MVP 2008/2009 See you at Codegarden08 US in Chicago!
|
|
 Rank: Addict
Joined: 3/17/2008 Posts: 820 Location: Nyborg, Denmark
|
From what I've seen so far at Rubens code, it seems to support any db (ie, you "just" need to create a new layer which is pretty easy. I'm pretty sure I'll have a working vistadb during this week).
/n
Jeeeez, did I really start this :-)
|
|
 Rank: Aficionado
Joined: 12/21/2007 Posts: 122 Location: Belgium
|
Hi Paul, As Niels says, implementing a data layer for database X is possible for all values of X. As long as you're patient enough :) For SQL databases, this should indeed be straightforward. But if you say really database agnostic... You'd have to create a data layer that abstracts much further. Which we'll surely do for v4. I've mailed you a document that can answer your question in detail. Ruben Umbraco Core Team Developer | Working on vNext | LinkedIn
|
|
|
Guest |