Result array's keys are column name and the values are column types.
Bye,
Eng. Gabriele Pongelli.
Postgresql's working query is
ALTER TABLE "<<table_name>>" ADD COLUMN "<<col_name>>" TYPE bigint NOT NULL
Bye,
Eng. Gabriele Pongelli
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/NwiO1GN19gUJ.--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.
Bye,
Eng. Gabriele Pongelli.
> --
> You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
Yes, database abstraction layer means some abastract data description
convention. Usually this means describing database with some XML layer.
I'm yet to meet a database abstraction layer that works completely
without testing on all platforms. Be it due to quirks in the
abstraction layer itself, people putting minor incompatible issues
into queries (columnname as alias) or pure incompatibilities in the
standard.
I think it is rather telling that ADOdb has a compilable extension
that it can alternatively use to get reasonable performance. I feel
that the Joomla! approach strikes a reasonable balance however you
cannot completely rely upon abstraction without testing. In a sense
Joomla! forces you in a way to do this testing (you could certainly do
it blindly but again I've seen many cases where it should "just work"
and doesn't).
Further quirks in individual databases behaviour mean that optimising
an application often means changing behaviour to meet where you're
targeting. A simple example is MySQL will rewrite any subquery for an
"IN" statement (e.g. WHERE id IN (SELECT user_id FROM #__userfilter
WHERE active = 1)) into a correlated query. The effect is that for
every row in your outer query, the subquery is executed resulting in
MxN performance. This means that you end up with a situation where
doing the subquery first and then doing an implode will, particularly
with two large datasets, result in a significant performance increase.
Many other database engines will happily optimise away this inner
query properly and may even pull it's result from the DB's indexes
given the columns in questions are indexed (Oracle I know behaves this
way). However in rewriting it to be more efficient (sometimes by
orders of magnitude, I took one query that took 5 minutes down to two
queries in ~2 seconds), your other database engines that can
internally cache that inner query lose a performance boost because
each query looks slightly differently because now you're filling in
the contents of the IN with constants not the subquery. And don't get
me started having to debug XML descriptions for database schemas, I'm
yet to see any decent tools that provide clear errors unlike feeding
your favourite DB engine a query (which while far from clear itself in
many cases is usually better than the confusion I've seen from XML DB
schemas). Even within a database system you can't rely on features
existing, MySQL's MyISAM doesn't provide relational integrity while
InnoDB (and almost everything else) does provide this (can't wait for
InnoDB to be the default thus hopefully causing ISAM, itself nearly 50
years old, to disappear at least from popular MySQL use).
tl;dr: even with abstractions you still need to test because you can't
assume your assumptions are correct; see law of leaky abstractions[1]
Sam Moffatt
http://pasamio.id.au
[1] http://www.joelonsoftware.com/articles/LeakyAbstractions.html
(even has an SQL example)
</rant>?
--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/ByrS4iubZPYJ.
So TBQH bothering with Oracle is likely a bit much unless you're in
that environment, though testing in an Oracle like environment is not
that hard. You can configure MySQL to behave in an Oracle like mode
[1] and also PostgreSQL a reasonable level of Oracle compatibility as
well. If you can get your code to work fine in MySQL's Oracle mode and
normal PostgreSQL, supporting Oracle proper isn't going to be a
concern and I'd wait for someone to ask for it first ("Oracle version
available on request, please contact developer for details").
However both Oracle and MSSQL are freely available in their cut down
form. Oracle offers Oracle Database Express Edition 11g [2] and
Microsoft offers a copy of SQL Server Express for free [3] though I
suggest using WebPI to install it [4] as it'll also give you an easy
way to install the SQLSRV PHP drivers if you can tolerate using IIS.
Cheers,
Sam Moffatt
http://pasamio.id.au
Tip of the day: install the Oracle Express Edition in a VM and never
your desktop.
[1] http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html#sqlmode_oracle
[2] http://www.oracle.com/technetwork/database/express-edition/overview/index.html
[3] http://www.microsoft.com/sqlserver/en/us/editions/express.aspx
[4] http://www.microsoft.com/web/platform/database.aspx
> --
> You received this message because you are subscribed to the Google Groups
> "Joomla! General Development" group.
> To view this discussion on the web, visit
> https://groups.google.com/d/msg/joomla-dev-general/-/pUWQkO4WvykJ.
Cheers,
Sam Moffatt
http://pasamio.id.au
@ Mike Pearl
actually an extension developer has to create each .sql file for
installing and uninstalling phase, for each database he/she wants
support, and yes, it's not a good method for a developer who, in a
multi database environment, has to know syntax and make tests for all
databases.
As I've said, there's no ALTER TABLE nor CREATE TABLE or similar
creation query inside JDatabaseQuery, so actually it's only possible
to send these commands inside extern .sql files.
Actually there are some ways to address ALTER/CREATE TABLE capability to 3pd:
1) let them write each sql files for each database, this solution is
in use but not meet really a database abstraction layer
1.1) write some document on the wiki to explain how to translate
common query to all database syntax (CREATE, ALTER, DROP, INSERT) -->
short term solution
2) add these common query to JDatabaseQuery and develop them inside
platform so 3pd can execute queries inside preflight/install/update
method of installer script class
http://docs.joomla.org/Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.7_-_Part_15
--> med term solution, we've to develop them; 3pd can follow this wiki
page to add JDatabaseQuery behavior for all databases and also
maintain sql files for MySQL (unique database type explained in
manifest file to use sql file).
3) inside manifest file add some new xml definition about creation and
altering tables, somewhere translated to JDatabaseQuery during install
phase
--> long term solution, we've to develop same as 2) and add
xml<->JDatabaseQuery translation handling .
I think that a good starting point is 2) , and you?
About subqueries, actual working example is this
http://docs.joomla.org/How_to_use_the_database_classes_in_your_script#Subqueries
but it works having at least two separate JDatabaseQuery objects.
Some times ago I've thought about ALTER TABLE / CREATE , putting them
in my PostgreSQL driver but this add too much extra code not requested
in my driver and not yet discussed.
Bye,
Eng. Gabriele Pongelli.
Regards,
Andrew Eddie
Bye,
Eng. Gabriele Pongelli.