SQL Anywhere 12.1

Permalink 1 user found helpful
What is the correct technique to update the source code so the SQL works on more than one database?

I noticed some SQL that works with mysql like...

limit
UNIX_TIMESTAMP

I would like to get the SQL to support multi databases. I am not sure if this is a goal of this project.

 
Mainio replied on at Permalink Reply
Mainio
Adodb (concrete5 built-in database interaction layer) supports this to SOME EXTENT but does not support 100% of the database dialects out there. Also, because concrete5 is using straight SQL in most places instead of active record type database interaction, there might be some MySQL specific SQL calls out there (like you already mentioned, although I don't think LIMIT is MySQL specific). Because of this issue, it would be also a massive work to make it work in 100% of the databases out there.

These issues have been discussed many times before on these forums and the message from the core team seems to be that "this would be nice but it's just an issue about hours in a day". Basically that means that having multi-database support on C5 is not their highest priority and instead they focus on features that bring more value into the product itself (from user and business perspective).

And just a note: MySQL can also handle a massive amount of traffic and be scalable.

Best,
Antti / Mainio
BobPiskac replied on at Permalink Reply
I have Concrete5 5.5.2.1 working with SQL Anywhere 12.0.1. Should I fork the code off and start a new project or try to contribute to this code base?
Mainio replied on at Permalink Reply
Mainio
Yes, if you want to contribute to the core, you should fork the project, make your changes and then make a pull request of those changes back to the main project.

Then they will go through the review of the core team and after some months, maybe they'll be added to the core.
frz replied on at Permalink Reply
frz
That's all correct. We're by no means politically married to MySQL.
Technically it's going to take a lot of work to actually get
completely agnostic however. Since MySQL is just about everywhere, and
can handle traffic at many scales, it's not a top priority for my
team.

If you can do it, and if it will still behave with add-ons, etc.. we'd
love to have it!
best wishes

Franz Maruna
CEO - concrete5.org
http://about.me/frz
BobPiskac replied on at Permalink Reply
Great news, I will submit my changes. SQL Anywhere supports the limit keywords...

I need to test for a few weeks, Do I have source control access or email my code to someone?
Mainio replied on at Permalink Reply
Mainio
http://github.com/concrete5/concrete5
BobPiskac replied on at Permalink Reply
Don't I need an account to check in?
frz replied on at Permalink Reply
frz
I believe you will need a github account, yes.

best wishes

Franz Maruna
CEO - concrete5.org
http://about.me/frz
BobPiskac replied on at Permalink Reply
I need access.

Sample of changes to SQL I need to make. The changes will work on all databases

original
if(p2.cID is null, p1.cInheritPermissionsFromCID, p2.cInheritPermissionsFromCID)

portable
case when p2.cID is null then p1.cInheritPermissionsFromCID else p2.cInheritPermissionsFromCID end case

original
if (p2.cID is null, p1.ctID, p2.ctID)

portable
coalesce(p2.cID, p1.ctID)
Mainio replied on at Permalink Reply
Mainio
You can fork the project from the top right corner by clicking the "fork" button. That will make you your own concrete5 project you have full access to.

If you want to contribute something back to the core, you just make a pull request from your project up to the originating project:
http://help.github.com/articles/using-pull-requests...

But you shouldn't change any SQL clause as it is because that might bring billion other problems in thousand other environments.

If you can make it work with MySQL, MSSQL, PostgreSQL, Oracle, DB2, etc. SQL-based databases with the same code base, I think this is something the core team is interested in if it works well 95% of the add-ons and will not break anything in the core.

Antti / Mainio
BobPiskac replied on at Permalink Reply
Sure it will! Billions and Billions
BobPiskac replied on at Permalink Reply
I have made zero changes to the code. Changed a few SQL statement where clauses. The following SQL get called 50 times before the home page is displayed. WOW

Looking into this...

Number of times variants of the statement were executed in a cluster: 50
First time at which this cluster of statements was detected: 2012-06-05 19:42:22.425
Last time at which this cluster of statements was detected: 2012-06-05 19:42:22.657
SQL text of at least one statement that was found clustered on this connection: select cPointerID from Pages where cID = '1'
BobPiskac replied on at Permalink Reply
I have no zero changes to the code. Changed a few SQL statement where clauses. The following SQL get called 50 times before the home page is displayed. WOW

Looking into this...

Number of times variants of the statement were executed in a cluster: 50
First time at which this cluster of statements was detected: 2012-06-05 19:42:22.425
Last time at which this cluster of statements was detected: 2012-06-05 19:42:22.657
SQL text of at least one statement that was found clustered on this connection: select cPointerID from Pages where cID = '1'
BobPiskac replied on at Permalink Reply
Traced the DB calls. 71 SQL statements to display one web site page. I used the default site. 71 calls just to display the home page. WOW

and your worried about me doing billions and billions.
Mainio replied on at Permalink Reply
Mainio
Not worrying you doing billions of calls, worrying of the case when the changed code gets running into billions of other systems and settings if it is included in core.

Yes, and please note the numbers are exaggerated but just to make sure you know that if you contribute to the core, that code will be running on other sites/systems/settings/databases as well than yours.
BobPiskac replied on at Permalink Reply
Oh, do as I say but not as I do! You already broke the code to work on other systems. I at least test my code on other db software.

I understood what you said. I changed topics when I saw how many SQL were generated to render 1 simple page. My database basically told me I was making too many calls to the same tables too much. It asked me if I needed some training. 19 calls were to the table Pages.

I am learning php and concrete5.

Sun Computers was going after licensing $ for people using MySQL. MySQL is open source, but it costs $ if you don't open source your code.

I opted to use SQL Anywhere. All I had to do to get this to work on Concrete5 was fix about 8 where clauses. Change the hard coded msql_connect string to sasql_connect. It then started to install. The DB installation code has some issues too, but I fixed it.

I will make this work with mysql and SQL Anywhere. Are there any other databases used in production today with Concrete5?
Mainio replied on at Permalink Reply
Mainio
I think someone has hacked it to work with MS SQL but I think the "official release" will not work with MS SQL.

I think Postgres has been requested in the past but no one has made it actually work.
BobPiskac replied on at Permalink Reply
I will fix the installation and server to work with...
MS SQL server
Postgres
MySQL
SQL Anywhere 12 and up.

FYI, SQL Anywhere has a free version to be used as a web server.

http://www.sybase.com/detail?id=1068247&contentOnly=true...

Registration and download link

http://response.sybase.com/forms/SQLAnywhere12WebEditionDownload...
Mainio replied on at Permalink Reply
Mainio
Great contribution!

*thumbs up*
mkly replied on at Permalink Reply
mkly
LIKE ILIKE etc. without and orm it's just impossible. Sorry.
andrew replied on at Permalink Reply
andrew
It should be possible with ADODB. It's built to work with multiple databases. For example, instead of using a direct "replace into" query in $db->Execute(), if you use ADODB's "Replace()" function it will do a replace into query behind the scenes when using mysql, and simulate it on databases that don't support it directly.
BobPiskac replied on at Permalink Reply
I agree. The driver should take care of the vender specific syntax.