mirror of
https://github.com/processone/ejabberd.git
synced 2024-09-27 14:30:55 +02:00
Fix some queries to work with older PostgreSQL and MySQL
This commit is contained in:
parent
7309f9f88a
commit
408f6c4d14
@ -221,7 +221,7 @@ table_exists(Host, Table) ->
|
|||||||
fun(pgsql, _) ->
|
fun(pgsql, _) ->
|
||||||
case
|
case
|
||||||
ejabberd_sql:sql_query_t(
|
ejabberd_sql:sql_query_t(
|
||||||
?SQL("select @()b exists (select from pg_tables "
|
?SQL("select @()b exists (select * from pg_tables "
|
||||||
" where tablename=%(Table)s)"))
|
" where tablename=%(Table)s)"))
|
||||||
of
|
of
|
||||||
{selected, [{Res}]} ->
|
{selected, [{Res}]} ->
|
||||||
@ -460,14 +460,14 @@ format_default(sqlite, _DBVersion, Column) ->
|
|||||||
end;
|
end;
|
||||||
format_default(mysql, _DBVersion, Column) ->
|
format_default(mysql, _DBVersion, Column) ->
|
||||||
case Column#sql_column.type of
|
case Column#sql_column.type of
|
||||||
text -> <<"''">>;
|
text -> <<"('')">>;
|
||||||
{text, _} -> <<"''">>;
|
{text, _} -> <<"('')">>;
|
||||||
bigint -> <<"0">>;
|
bigint -> <<"0">>;
|
||||||
integer -> <<"0">>;
|
integer -> <<"0">>;
|
||||||
smallint -> <<"0">>;
|
smallint -> <<"0">>;
|
||||||
numeric -> <<"0">>;
|
numeric -> <<"0">>;
|
||||||
boolean -> <<"false">>;
|
boolean -> <<"false">>;
|
||||||
blob -> <<"''">>;
|
blob -> <<"('')">>;
|
||||||
timestamp -> <<"CURRENT_TIMESTAMP">>
|
timestamp -> <<"CURRENT_TIMESTAMP">>
|
||||||
%{char, N} -> <<"''">>;
|
%{char, N} -> <<"''">>;
|
||||||
%bigserial -> <<"0">>
|
%bigserial -> <<"0">>
|
||||||
|
Loading…
Reference in New Issue
Block a user