Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PG 9.5 Ignore Support #3206

Merged
merged 4 commits into from Feb 14, 2016

Conversation

albertlast
Copy link
Collaborator

again a smale db related pull request.

This added ignore support for the pg 9.5+,
pg 9.5 is current as rc available.
see http://www.postgresql.org/docs/9.5/static/sql-insert.html

Signed-off-by: albertlast

@albertlast albertlast force-pushed the PG9.5SupportIgnore branch 2 times, most recently from 97e7fef to 5821ed7 Compare December 22, 2015 13:20
see http://www.postgresql.org/docs/9.5/static/sql-insert.html

Signed-off-by: albertlast  <albertlast@hotmail.de>
forgot ON CONFLICT statement

Signed-off-by: albertlast  <albertlast@hotmail.de>
@albertlast
Copy link
Collaborator Author

The pr got a bug,
reason db_get_version bring the string back (and had to call db_extend).
String is "9.5rc1" doesn't work with version_comare from php.
I'm attempted to change the function to integer version nummer (server_version_num).
The result would be 90500 (easy to compare),
problem is that this infos are shown in the admin panel there would be the integer than too.

@Oldiesmann
Copy link
Contributor

Easiest way around this is to just look for "beta" or "rc" in the string and only look at the first three characters if so (since you'll never have "9.5.1rc1" or anything like that).

Something like this:

$version = $smcFunc['db_get_version'];
if (stripos($version, 'beta') !== false || stripos($version, 'rc') !== false)
    $version = substr($version, 0, 3);

Signed-off-by: albertlast  <albertlast@hotmail.de>
@@ -91,11 +105,16 @@ function smf_db_search_query($identifier, $db_string, $db_values = array(), $con

if (isset($replacements[$identifier]))
$db_string = preg_replace(array_keys($replacements[$identifier]), array_values($replacements[$identifier]), $db_string);
elseif (preg_match('~^\s*INSERT\sIGNORE~i', $db_string) != 0)
if (preg_match('~^\s*INSERT\sIGNORE~i', $db_string) != 0)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the intention,
why here is a elseif used.

I got some error around this,
so i replace this with a if.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What error did you get? The "elseif" is used because we want to do that if $replacements[$identifier] isn't set.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The query insert_into_log_messages_fulltext goes wrong,
it's take only the if part but it need to take the elseif part too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know either, but it looks like an error, from reading the code..

Signed-off-by: albertlast  <albertlast@hotmail.de>
@albertlast
Copy link
Collaborator Author

Fixed the tab and allman style
about the elseif thing i got no solution because the query insert_into_log_messages_fulltext
needs both

live627 added a commit that referenced this pull request Feb 14, 2016
@live627 live627 merged commit fc30f7f into SimpleMachines:release-2.1 Feb 14, 2016
@albertlast albertlast deleted the PG9.5SupportIgnore branch March 25, 2016 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants