Skip to content
This repository was archived by the owner on Sep 28, 2022. It is now read-only.

errorInfo attribute added (PDO-like) #19

Merged
merged 1 commit into from
Apr 7, 2020

Conversation

codercms
Copy link
Collaborator

@codercms codercms commented Apr 4, 2020

Examples:

^ Swoole\Coroutine\PostgreSQL {#4
  +error: """
    ERROR:  relation "test" does not exist\n
    LINE 1: SELECT 323r FROM test\n
                             ^\n
    """
  +errorInfo: array:3 [
    0 => "42P01"
    1 => 7
    2 => """
      ERROR:  relation "test" does not exist\n
      LINE 1: SELECT 323r FROM test\n
                               ^\n
      """
  ]
}
^ Swoole\Coroutine\PostgreSQL {#4
  +error: "ERROR:  prepared statement "some_1" does not exist\n"
  +errorInfo: array:3 [
    0 => "26000"
    1 => 7
    2 => "ERROR:  prepared statement "some_1" does not exist\n"
  ]
}

Examples:
```
^ Swoole\Coroutine\PostgreSQL {#4
  +error: """
    ERROR:  relation "test" does not exist\n
    LINE 1: SELECT 323r FROM test\n
                             ^\n
    """
  +errorInfo: array:3 [
    0 => "42P01"
    1 => 7
    2 => """
      ERROR:  relation "test" does not exist\n
      LINE 1: SELECT 323r FROM test\n
                               ^\n
      """
  ]
}
```

```
^ Swoole\Coroutine\PostgreSQL {#4
  +error: """
    ERROR:  relation "test" does not exist\n
    LINE 1: SELECT 323r FROM test\n
                             ^\n
    """
  +errorInfo: array:3 [
    0 => "42P01"
    1 => 7
    2 => """
      ERROR:  relation "test" does not exist\n
      LINE 1: SELECT 323r FROM test\n
                               ^\n
      """
  ]
}
^ false
^ Swoole\Coroutine\PostgreSQL {#4
  +error: "ERROR:  prepared statement "some_1" does not exist\n"
  +errorInfo: array:3 [
    0 => "26000"
    1 => 7
    2 => "ERROR:  prepared statement "some_1" does not exist\n"
  ]
}
```
@codercms
Copy link
Collaborator Author

codercms commented Apr 5, 2020

@twose this PR also fixes case that is prepare method is always returning true even if it actually fails

@codercms codercms mentioned this pull request Apr 5, 2020
@yunnian yunnian merged commit 19816ae into swoole:v4.4.x Apr 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants