Thank you!
--
You received this message because you are subscribed to the Google Groups "Joomla! CMS Development" group.
To post to this group, send an email to joomla-...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-cm...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-cms?hl=en-GB.
Yes I did. I'm in contact with Sudhi since I started my job about PostgreSQL ;)
This is how that queries are handled in db17 branch :
- inside sample_data.sql there is "INSERT IGNORE INTO", sqlazure's
version and sqlsrv one have "INSERT INTO"
- "REPLACE INTO" is present in files (as joomla_update_16ga.sql) that
there isn't in sqlsrv and sqlazure folders
Inside installation/models/configuration.php a "REPLACE INTO" query is
changed with a SELECT and then, if there's a tuple do an UPDATE, else
do an INSERT ; the code is
$query = $db->getQuery(true);
$query->select('id');
$query->from('#__users');
$query->where('id = 42');
$db->setQuery($query);
if($db->loadResult())
{
$query = $db->getQuery(true);
$query->update('#__users');
....
$query->where('id = 42');
}
else
{
$query = $db->getQuery(true);
....
$query->insertInto('#__users', true);
....
}
These are the correct steps with PostgreSQL too, but I think it's
better to put a "replaceInto" command inside database class (not in
JDatabaseQuery class) so every 3pd that wish use "REPLACE INTO" query
does not think about that "SELECT- if UPDATE- else INSERT" command
block because database driver does.
Another commands that I wish to move inside database class is
JInstallationModelDatabase::createDatabase
because PostgreSQL need to create a role for an "user" (from
$option['username'] ) before database creation and set it as owner,
set the privileges, without specifying the CHARSET (PostgreSQL uses
UTF8 by default and doesn't have CHARSET option).
A question about JInstallationModelDatabase::deleteDatabase function
name misunderstanding : this function clears database's table but
doesn't drop the database itself, if I wish call "deleteDatabase" I
think it DROP completely a database, not only clear the content.
Why don't rename it as "dropDatabaseTables" and add a "dropDatabase"
that simply execute a "DROP DATABASE" (in PostgreSQL drop role too) ?
Thank you, and excuse me for this long email.
Eng. Gabriele Pongelli
@all
This is the discussion starting point: integrate, or eventually
change, some cms query inside platform to run them in
database-independent mode.
Hoping we'll approach all of these issues here it is the list:
1) how many files do we have ? I think a joomla.sql and a
sample_data.sql for each driver, where each can solve data type
mismatch and values (tinyint, date value etc) as he/she prefer for
underlying database; the cons is having more file to maintain
2) create inside database driver a "SELECT- if UPDATE- else INSERT"
query block (see my last mail below) where it's not supported "REPLACE
INTO" query, naming it "replaceInto" so calling it will query "REPLACE
INTO" for MySQL or that block for the others while 3pd don't see the
difference.
3) Moving JInstallationModelDatabase::createDatabase inside database
driver: I need this because PostgreSQL needs to create a role for the
username that will connect and set it as OWNER. Another step I've
thought is about authentication and privileges, that I can set in
PostgreSQL only before database creation.
4) Add a dropDatabase function that execute "DROP DATABASE"
5) Rename "deleteDatabase" to "clearDatabase" because the database is
not deleted but only cleared.
6) In addition to the mail below think that an "ALTER" query element
or driver function could be useful.
My last mail on cms mailing list is following
2011/10/17 84.le0n <84....@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "Joomla! CMS Development" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-cms/-/YdZSox5lvCAJ.
- Nascondi testo citato -
** MySQL ** <--> ** PostgreSQL **
tinyint <--> smallint
mediumtext <--> text
varchar(255) <--> character varying(255)
int(10) <--> integer (it become "serial" type if is used for an
"id" table column)
int(11) <--> bigint
tinyint(3) <--> smallint
datetime <--> timestamp
text <--> text
@sudhi and others
I wish to do the latter 1. and 2. points ("if insert ignore or
replace.." and "Modify the code...") inside driver, so it'll be the
default behaviour, no 3pd needs to implement this difference because
it's done inside driver.
I haven't find any changes on your code for "createDatabase"; there
are only in "backupDatabase" and "deleteDatabase" and they are simply
query element translation of what were present (good in a multidb
environment).
I need to move createDatabase inside driver because I can't create the
database with current commands, I need to create an OWNER before and
associate it to the database; I've to run "CREATE DATABASE yyy OWNER
xxx" and not only "CREATE DATABASE yyy", this syntax problem is the
question.
I've a PostgreSQL server running on my laptop, where I'm doing my tests.
@ to everyone: any thought about that starting point list ?
favorable or against ?!?
Eng. Gabriele Pongelli
2011/10/17 sudhendra Seshachala <su...@hooduku.com>:
> I will try to explain at a high level, what we had to do to over come some
> of mysql nuances.
> 1. We did not touch joomla.sql and sample_data.sql for mysql.
> 2. We modified joomla.sql and sample_data.sql for SQLServer.
> In the code - wherever there was mysqlspecific syntax or non ANSI SQL, we
> did either of the below two.
> 1. If insert ignore or replace - we basically check if id exists and
> basically do insert or update.
> 2. Modify the code to leverage the DB framework -- generates sql based on
> the underlying database.
>
> In cases we had to do drop database or drop tables - we used the framework
> to generate the appropriate code.
> Creating and droping databases, we did add the code in the framework to
> generate code appropriate create database and drop database/table statement.
> If I remember correctly - I will revert back on this.
>
> In MySQL - we have table level locking. In SQLServer - it is a "no-op". In
> oracle - there is some sort of row level locking. To accomplish this - moved
> the lock/unlock method to the db framework and made the lock/unlock a
> "no-op" in SQLServer.
> Do you have a postgress SQL instance running somewhere? I can start looking
> at the code as the time permits.
>
> thanks
> Sudhi
> --
> Thanks & Regards
> Sudhi
>
> Hooduku Inc
> 1.888.262.8389
> http://www.hooduku.com
> http://www.hoodukucloud.com
>
>
>
>
>
>> 1) how many files do we have ? I think a joomla.sql and a
>> sample_data.sql for each driver, where each can solve data type
>> mismatch and values (tinyint, date value etc) as he/she prefer for
>> underlying database; the cons is having more file to maintain
I've created "joomla.sql" and "sample_data.sql" for PostgreSQL
database, not yet tested during an installation but it's converted
following the same rules I did for "ddl.sql" file, so I hope it will
work fine.
That two files will be added in my joomla-cms github repo, inside
"installation/sql/postgresql" folder, as searched by
JInstallationModelDatabase::installSampleData() function coming from
installation/models/database.php .
>> 2) create inside database driver a "SELECT- if UPDATE- else INSERT"
>> query block (see my last mail below) where it's not supported "REPLACE
>> INTO" query, naming it "replaceInto" so calling it will query "REPLACE
>> INTO" for MySQL or that block for the others while 3pd don't see the
>> difference.
Waiting your thought.
>> 3) Moving JInstallationModelDatabase::createDatabase inside database
>> driver: I need this because PostgreSQL needs to create a role for the
>> username that will connect and set it as OWNER. Another step I've
>> thought is about authentication and privileges, that I can set in
>> PostgreSQL only before database creation.
Like MySQL does, it's better that the database's user/role is created
BEFORE the database, so I don't need to execute more instruction other
than "CREATE DATABASE" in a PostgreSQL manner.
The syntax between databases remain different, so I prefer create a
JDatabase::getCreateDbQuery( $options, $utf )
that simply does
if ($utf) {
$query = 'CREATE DATABASE '.$db->nameQuote($name).' CHARACTER SET `utf8`';
}
else {
$query = 'CREATE DATABASE '.$db->nameQuote($name);
}
and returns $query, while
JDatabasePostgreSQL::getCreateDbQuery( $options, $utf )
will return
$query = 'CREATE DATABASE ' . $options['database'] . ' OWNER ' .
$options['user'] ;
There are some other configuration that I thought to add like set the
correct privileges only to $options['user'] , but to be really
effective it's necessary to modify pg_hba.conf, so I think this is the
best way to let multidb works.
>> 4) Add a dropDatabase function that execute "DROP DATABASE"
I think it's better that "DROP DATABASE" and "DROP ROLE" will be
executed manually by user not inside Joomla! platform (I don't know if
it could be useful for JCli or other applications, but for CMS it
doesn't ).
>> 5) Rename "deleteDatabase" to "clearDatabase" because the database is
>> not deleted but only cleared.
Waiting your thought.
>> 6) In addition to the mail below think that an "ALTER" query element
>> or driver function could be useful.
Waiting your thought.
I wish this is not a monologue thread, I'm waiting for your answers.
Eng. Gabriele Pongelli
2011/10/18 84.le0n <84....@gmail.com>:
Eng. Gabriele Pongelli
2011/10/21 84.le0n <84....@gmail.com>:
Checking inside JInstallationModelDatabase::initialise() I've found
that #__schema update was done using always
"com_admin/sql/updates/mysql" folder (in db17 version too), now my
working copy has this changed to
'com_admin/sql/updates/' . (($type == 'mysqli') ? 'mysql' : $type)
to solve this issue.
I've found a query problem with some file inside com_admin/sql/updates :
* there's a REPLACE INTO in a file of them and it's not possible to
make the trick with SELECT-if-else and I don't know how to replace it
(with an INSERT or an UPDATE or both ?)
* ALTER TABLE with AFTER syntax to add the column after indicated
column is not supported in PostgreSQL and it is not useful for
relational database, is it possible to drop this syntax from Mysql ?
Eng. Gabriele Pongelli
2011/10/25 84.le0n <84....@gmail.com>:
I've a problem during installation: after creating tables and populating them there is a process commented as "Attempt to refresh manifest caches" that doesn't convert #__ correctly if it is present inside a WHERE statement.
An example of what I'm talking about.
If the query is "SELECT * FROM #__dbtest WHERE ..." this goes well and #__ will correctly translated.
If the query is "SELECT * FROM information_schema.columns WHERE table_name='#__dbtest' " this goes bad and #__ will NOT correctly translated, it remains #__dbtest so I'll give an empty result.
The problem is inside replacePrefix of JDatabase.
Can anyone test and check about this issue ?
A workaround that works for me is a table name substitution done before query composition, but it's not a good solution for this issue.
Trying to install joomla with this workaround gives me other errors inside load() calls inside refreshManifestCache.
Thank you for any help!
Eng. Gabriele Pongelli
AVVERTENZE AI SENSI DEL D.LGS. 196/2003
Le informazioni contenute in questo messaggio di posta elettronica e negli eventuali files allegati, sono da considerarsi strettamente riservati. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceveste per errore questo messaggio, Vi preghiamo cortesemente di darcene notizia all'indirizzo e-mail di cui sopra e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema; costituisce comportamento contrario ai principi dettati dal D.lgs. 196/2003 il trattenere il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse.
This electronic transmission is strictly confidential and intended solely for the addresses. It may contain information which is covered by legal, professional or other privilege. If you are not the intended addressee, you must not disclose, copy or take any action in reliance of this transmission. If you have received this transmission in error, please notify us and delete the received data as soon as possible.
Il giorno 27/ott/2011, alle ore 20:29, Elin Waring <elin....@gmail.com> ha scritto:
> Great news!
>
> Elin