Hi. As I looked into Piwigo i liked the general concept, but I don't like mySQL, so I was happy to see that 2.1.0 would support PostgreSQL.
But I do get the below error-message (seems like tables and stuff are set up correctly in postgresql). I don't think postgres uses the "set =" syntax?
INSERT INTO piwigo_languages SET id = 'pt_BR', name = 'Brasil [BR]' ;
ERROR: syntax error at or near "SET" LINE 3: SET id = 'pt_BR', ^
Hi Hansi,
Nice to see that PostgreSQL is interesting to users. I admit that I believe SQLite is more relevant than PostgreSQL for Piwigo, but the first feedback is from a PostgreSQL user, not an SQLite user :-)
Concerning your problem of insert syntax. I was nearly sure this syntax would not work with something else than MySQL.
@nicolas : I will add a:
pwg_db_simple_insert( LANGUAGES_TABLE, array( 'id' => 'pt_BR', 'name' => 'Brasil [BR]', ) );
(simpler than mass_insert)
Offline
plg wrote:
@nicolas : I will add a:
Code:
pwg_db_simple_insert( LANGUAGES_TABLE, array( 'id' => 'pt_BR', 'name' => 'Brasil [BR]', ) );(simpler than mass_insert)
I propose to use the standard syntax of "INSERT INTO" :
insert into (COLUMNS) values(VALUES)
I didin't see that syntax (insert into set ...) before !
Offline
The problem is the same in admin/include/themes.class.php.
Offline
nicolas wrote:
I propose to use the standard syntax of "INSERT INTO" :
Code:
insert into (COLUMNS) values(VALUES)I didin't see that syntax (insert into set ...) before !
It's a matter of readibility. The "standard" syntax is less readable. This is why I've used the "insert into set" syntax (and P@t reused it in language manager).
Because yes, we like to have more readable code, I think that:
pwg_db_simple_insert( LANGUAGES_TABLE, array( 'id' => 'pt_BR', 'name' => 'Brasil [BR]', ) );
is more readable than:
$query = ' INSERT INTO '.LANGUAGES_TABLE.' (id, name) VALUES ("pt_BR", "Brasil [BR]") ;'; pwg_query($query);
The more you add columns, the more readable pwg_db_simple_insert is, compared to "insert into values".
Offline
plg wrote:
nicolas wrote:
I propose to use the standard syntax of "INSERT INTO" :
Code:
insert into (COLUMNS) values(VALUES)I didin't see that syntax (insert into set ...) before !
It's a matter of readibility. The "standard" syntax is less readable. This is why I've used the "insert into set" syntax (and P@t reused it in language manager).
Because yes, we like to have more readable code, I think that:Code:
pwg_db_simple_insert( LANGUAGES_TABLE, array( 'id' => 'pt_BR', 'name' => 'Brasil [BR]', ) );is more readable than:
Code:
$query = ' INSERT INTO '.LANGUAGES_TABLE.' (id, name) VALUES ("pt_BR", "Brasil [BR]") ;'; pwg_query($query);The more you add columns, the more readable pwg_db_simple_insert is, compared to "insert into values".
And the code of pwg_db_simple_insert function is the same as the one I proposed ? If yes, it's ok for me.
Offline
nicolas wrote:
I didin't see that syntax (insert into set ...) before !
+1
If someone has a link to (insert into set ...) I will be interested in.
http://www.postgresql.org/docs/8.4/inte … nsert.html
Offline
Any way, languages table is missing in piwigo_structure-pgsql and piwigo_structure-sqlite.sql...
And there is still pwg_stuffs table????
nicolas, can you fix it?
Offline
P@t wrote:
Any way, languages table is missing in piwigo_structure-pgsql and piwigo_structure-sqlite.sql...
And there is still pwg_stuffs table????
nicolas, can you fix it?
FIx is ready on my working copy. I wait for acceptance on my proposition ?
Offline
nicolas wrote:
And the code of pwg_db_simple_insert function is the same as the one I proposed ? If yes, it's ok for me.
If we have a clean function pwg_db_simple_insert then we can use "insert into values" syntax, which is compatible everywhere I suppose.
Offline