Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
f9998843
Commit
f9998843
authored
15 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Fix: Error in creating function with postgresql
parent
99e5f46a
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
htdocs/install/etape1.php
+4
-4
4 additions, 4 deletions
htdocs/install/etape1.php
htdocs/install/etape2.php
+8
-6
8 additions, 6 deletions
htdocs/install/etape2.php
htdocs/install/pgsql/functions/functions.sql
+6
-1
6 additions, 1 deletion
htdocs/install/pgsql/functions/functions.sql
with
18 additions
and
11 deletions
htdocs/install/etape1.php
+
4
−
4
View file @
f9998843
...
@@ -356,7 +356,7 @@ if ($_POST["action"] == "set")
...
@@ -356,7 +356,7 @@ if ($_POST["action"] == "set")
print
$langs
->
trans
(
"DatabaseCreation"
)
.
' : '
;
print
$langs
->
trans
(
"DatabaseCreation"
)
.
' : '
;
print
$dolibarr_main_db_name
;
print
$dolibarr_main_db_name
;
print
'</td>'
;
print
'</td>'
;
print
'<td>'
.
$langs
->
trans
(
"Error"
)
.
' '
.
$db
->
lasterrno
()
.
'</td></tr>'
;
print
'<td>'
.
$langs
->
trans
(
"Error"
)
.
' '
.
$db
->
lasterrno
()
.
'<
br>'
.
$db
->
lasterror
()
.
'<
/td></tr>'
;
// Affiche aide diagnostique
// Affiche aide diagnostique
print
'<tr><td colspan="2"><br>'
;
print
'<tr><td colspan="2"><br>'
;
...
@@ -365,7 +365,7 @@ if ($_POST["action"] == "set")
...
@@ -365,7 +365,7 @@ if ($_POST["action"] == "set")
print
'<br>'
;
print
'<br>'
;
print
'</td></tr>'
;
print
'</td></tr>'
;
dolibarr_install_syslog
(
'etape1: Failed to create database '
.
$dolibarr_main_db_name
.
' '
.
$db
->
lasterrno
(),
LOG_ERR
);
dolibarr_install_syslog
(
'etape1: Failed to create database '
.
$dolibarr_main_db_name
.
' '
.
$db
->
lasterrno
()
.
' '
.
$db
->
lasterror
()
,
LOG_ERR
);
$error
++
;
$error
++
;
}
}
$db
->
close
();
$db
->
close
();
...
...
This diff is collapsed.
Click to expand it.
htdocs/install/etape2.php
+
8
−
6
View file @
f9998843
...
@@ -388,14 +388,14 @@ if ($_POST["action"] == "set")
...
@@ -388,14 +388,14 @@ if ($_POST["action"] == "set")
$buf
=
fgets
(
$fp
,
4096
);
$buf
=
fgets
(
$fp
,
4096
);
if
(
substr
(
$buf
,
0
,
2
)
<>
'--'
)
if
(
substr
(
$buf
,
0
,
2
)
<>
'--'
)
{
{
$buffer
.
=
$buf
;
$buffer
.
=
$buf
.
"§"
;
}
}
}
}
fclose
(
$fp
);
fclose
(
$fp
);
}
}
//$buffer=preg_replace('/;\';/',";'§",$buffer);
// Si plusieurs requetes, on boucle sur chaque
// If several requests, we loop on each of them
$buffer
=
preg_replace
(
'/;\';/'
,
";'§"
,
$buffer
);
$listesql
=
explode
(
'§'
,
$buffer
);
$listesql
=
explode
(
'§'
,
$buffer
);
foreach
(
$listesql
as
$buffer
)
foreach
(
$listesql
as
$buffer
)
{
{
...
@@ -403,6 +403,7 @@ if ($_POST["action"] == "set")
...
@@ -403,6 +403,7 @@ if ($_POST["action"] == "set")
if
(
$buffer
)
if
(
$buffer
)
{
{
dolibarr_install_syslog
(
"Request: "
.
$buffer
,
LOG_DEBUG
);
dolibarr_install_syslog
(
"Request: "
.
$buffer
,
LOG_DEBUG
);
print
"<!-- Insert line : "
.
$buffer
.
"<br>-->
\n
"
;
$resql
=
$db
->
query
(
$buffer
);
$resql
=
$db
->
query
(
$buffer
);
if
(
$resql
)
if
(
$resql
)
{
{
...
@@ -411,14 +412,15 @@ if ($_POST["action"] == "set")
...
@@ -411,14 +412,15 @@ if ($_POST["action"] == "set")
}
}
else
else
{
{
if
(
$db
->
errno
()
==
'DB_ERROR_RECORD_ALREADY_EXISTS'
)
if
(
$db
->
errno
()
==
'DB_ERROR_RECORD_ALREADY_EXISTS'
||
$db
->
errno
()
==
'DB_ERROR_KEY_NAME_ALREADY_EXISTS'
)
{
{
//
print "
<tr><td>
Insert
ion
li
g
ne : $buffer
</td><td>
//print "Insert line :
".
$buffer
."<br>\n";
}
}
else
else
{
{
$ok
=
0
;
$ok
=
0
;
print
$langs
->
trans
(
"ErrorSQL"
)
.
" : "
.
$db
->
errno
()
.
" - '
$buffer
' - "
.
$db
->
lastqueryerror
()
.
"<br>"
;
print
$langs
->
trans
(
"ErrorSQL"
)
.
" : "
.
$db
->
errno
()
.
" - '
"
.
$buffer
.
"
'
<br>
\n
"
;
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
htdocs/install/pgsql/functions/functions.sql
+
6
−
1
View file @
f9998843
-- ============================================================================
-- ============================================================================
-- Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
-- Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
-- Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
--
--
-- This program is free software; you can redistribute it and/or modify
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- it under the terms of the GNU General Public License as published by
...
@@ -18,6 +19,9 @@
...
@@ -18,6 +19,9 @@
-- $Id$
-- $Id$
-- ============================================================================
-- ============================================================================
CREATE
LANGUAGE
plpgsql
;
CREATE
OR
REPLACE
FUNCTION
UNIX_TIMESTAMP
(
TIMESTAMP
WITHOUT
TIME
ZONE
)
RETURNS
BIGINT
LANGUAGE
SQL
IMMUTABLE
STRICT
AS
'SELECT EXTRACT(EPOCH FROM $1)::bigint;'
;
CREATE
OR
REPLACE
FUNCTION
UNIX_TIMESTAMP
(
TIMESTAMP
WITHOUT
TIME
ZONE
)
RETURNS
BIGINT
LANGUAGE
SQL
IMMUTABLE
STRICT
AS
'SELECT EXTRACT(EPOCH FROM $1)::bigint;'
;
CREATE
OR
REPLACE
FUNCTION
UNIX_TIMESTAMP
(
TIMESTAMP
WITH
TIME
ZONE
)
RETURNS
BIGINT
LANGUAGE
SQL
IMMUTABLE
STRICT
AS
'SELECT EXTRACT(EPOCH FROM $1)::bigint;'
;
CREATE
OR
REPLACE
FUNCTION
UNIX_TIMESTAMP
(
TIMESTAMP
WITH
TIME
ZONE
)
RETURNS
BIGINT
LANGUAGE
SQL
IMMUTABLE
STRICT
AS
'SELECT EXTRACT(EPOCH FROM $1)::bigint;'
;
...
@@ -33,6 +37,7 @@ CREATE OR REPLACE FUNCTION MONTH(TIMESTAMP WITH TIME ZONE) RETURNS INTEGER AS $$
...
@@ -33,6 +37,7 @@ CREATE OR REPLACE FUNCTION MONTH(TIMESTAMP WITH TIME ZONE) RETURNS INTEGER AS $$
CREATE
OR
REPLACE
FUNCTION
MONTH
(
DATE
)
RETURNS
INTEGER
AS
$$
SELECT
EXTRACT
(
MONTH
FROM
$
1
)::
INTEGER
;
$$
LANGUAGE
SQL
IMMUTABLE
;
CREATE
OR
REPLACE
FUNCTION
MONTH
(
DATE
)
RETURNS
INTEGER
AS
$$
SELECT
EXTRACT
(
MONTH
FROM
$
1
)::
INTEGER
;
$$
LANGUAGE
SQL
IMMUTABLE
;
CREATE
OR
REPLACE
FUNCTION
DAY
(
TIMESTAMP
without
TIME
ZONE
)
RETURNS
INTEGER
AS
$$
SELECT
EXTRACT
(
DAY
FROM
$
1
)::
INTEGER
;
$$
LANGUAGE
SQL
IMMUTABLE
;
CREATE
OR
REPLACE
FUNCTION
DAY
(
TIMESTAMP
without
TIME
ZONE
)
RETURNS
INTEGER
AS
$$
SELECT
EXTRACT
(
DAY
FROM
$
1
)::
INTEGER
;
$$
LANGUAGE
SQL
IMMUTABLE
;
CREATE
OR
REPLACE
FUNCTION
DAY
(
TIMESTAMP
WITH
TIME
ZONE
)
RETURNS
INTEGER
AS
$$
SELECT
EXTRACT
(
DAY
FROM
$
1
)::
INTEGER
;
$$
LANGUAGE
SQL
STABLE
;
CREATE
OR
REPLACE
FUNCTION
DAY
(
TIMESTAMP
WITH
TIME
ZONE
)
RETURNS
INTEGER
AS
$$
SELECT
EXTRACT
(
DAY
FROM
$
1
)::
INTEGER
;
$$
LANGUAGE
SQL
STABLE
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment