Skip to content

Latest commit

 

History

History
115 lines (104 loc) · 25.2 KB

exceptions.md

File metadata and controls

115 lines (104 loc) · 25.2 KB

VeloxException codes/descriptions

Note: Exception codes are not necessarily sequential per class, method or function; they are, however, unique across the library.

Database\Connection

Code Text Explanation
10 Invalid database type constant An unsupported database type constant was passed. See constants.php.
11 Database host not provided Connection information must be passed to the constructor.
12 Database name not provided Connection information must be passed to the constructor.
13 Database user not provided Connection information must be passed to the constructor.
14 Database password not provided Connection information must be passed to the constructor.
15 SQL Server connections require either the sqlsrv or pdo_sqlsrv extensions to be loaded. Velox uses the sqlsrv extension for Microsoft SQL Server connections.
16 Unidentified database engine or incorrect parameters Velox was unable to connect to the database using the supplied information.
17 SQL Server error(s): The Microsoft SQL Server instance returned the given error(s).
18 Transactional method called without active transaction The called method can't be invoked before Connection::beginTransaction().
19 Query SQL is not set A Query object was passed to Connection::execute() without its sql property set.
20 SQL statement failed to prepare The underlying prepare function/method failed. See chained exception for details.
21 Query failed to execute The database failed to execute the query. See chained exception for details.
46 Placeholder 'xxxx' does not exist in prepared statement SQL A parameter was passed to a prepared statement with an incorrect placeholder name.
51 This PHP installation has not been built with ODBC support. PHP must be built with ODBC support in order to use Velox with ODBC connections.
52 Savepoint not supported on this database engine Velox doesn't support current transaction savepoints for this database engine.
53 pdo_sqlsrv required to connect to SQL Server using PDO. PDO connections to SQL Server require the pdo_sqlsrv extension.
54 SQL Server native connections require the sqlsrv extension to be loaded. Any SQL Server connections not using either PDO or ODBC require the sqlsrv extension.
55 Connection type not supported or extension not available Specified connection type must be CONN_PDO, CONN_ODBC, or CONN_NATIVE. If none was specified, Velox was unable to connect using available extensions.
56 Invalid result type constant An invalid result type constant was passed. See constants.php.
57 Invalid query type constant An invalid query type constant was passed. See constants.php.
58 PDO connection cannot be closed with the close() method Connection::close() has no effect on a PDO connection. To close the connection, unset the Connection instance.
59 pdo_odbc required to connect to ODBC using PDO. PDO connections to ODBC require the pdo_odbc extension.
64 The mysqli extension is required to connect to MySQL using CONN_NATIVE. Native MySQL connections require the mysqli extension.
79 The PDO extension is not installed. The Connection instance was set to use a PDO connection, but the PDO extension is not installed.
*** PDO error: PDO returned an error when connecting to database (error code is for PDOException)
*** ODBC error: odbc_connect returned an error when connecting to database (error code is ODBC state)
*** MySQLi error: MySQLi returned an error when connecting to database (error code is SQLSTATE)

Database\oneShot

Code Text Explanation
60 Input is not supported for Query objects. Query objects do not support parameters; therefore no input can be specified.

Database\Procedures\Query

Code Text Explanation
22 Query results not yet available Query::getResults() was called before query execution finished.

Database\Procedures\PreparedStatement

Code Text Explanation
50 Value for :parameter is not a scalar or null. The value assigned to this parameter was array, object, or some other non-primitive. Only strings, numbers, booleans, or nulls can be assigned as parameter values.

Database\Procedures\StatementSet

Code Text Explanation
23 Operand missing in 'where' array The specified condition did not include an operand to check for.
24 BETWEEN operator used without second operand If BETWEEN is used as an operator, two operands must be specified in the array.
25 Criteria must be set before StatementSet can be executed. StatementSet cannot be executed without specifying at least one set of conditions.
36 Unsupported operator The operator specified is invalid or not supported
44 IN operand must be in the form of an array When using IN, the operand must be an array of values to check for.
47 Element at index xxxx does not contain the correct keys. The given element in the array passed to addCriteria() does not contain the appropriate properties for this type of query.
63 Criteria format is invalid The structure of the array passed to addCriteria() isn't in the form expected. Check to see if the proper nesting is used.

Database\Procedures\Transaction

Code Text Explanation
26 Transaction has no active connection A query string was passed to Transaction::addQuery() without first setting a connection to use.
27 Query in transaction failed The transaction was rolled back after a failed query. See the chained exception for details.
39 User-defined function failed A custom function added to the Transaction failed. See the chained exception for details.
61 Attempted to add parameter set to Transaction without a leading PreparedStatement Transaction::addParameterSet() requires the first assigned procedure to be a PreparedStatement.
62 Attempted to add criteria to Transaction without a leading StatementSet Transaction::addCriteria() requires the first assigned procedure to be a StatementSet.

Structures\ResultSet

Code Text Explanation
28 Specified key column does not exist The column name specified for the key column doesn't exist in the results

Structures\Model

Code Text Explanation
29 The PreparedStatement returned multiple result sets. Make sure that $resultType is set to VELOX_RESULT_UNION or VELOX_RESULT_UNION_ALL. Model uses only one result set at a time.
37 The associated procedure for xxxx has not been defined. In order to call the given Model method, the corresponding procedure must have been defined in the constructor call.
38 Column 'xxxx' does not exist in result set. Attempted to filter on a column that doesn't exist in the result set.
40 Select query required for DML queries on nested Models A nested Model was defined without a select query set on the parent Model. Submodels need this in order to match the parent's primary key.
41 Primary key column name must be specified for parent Model Without a primary key, submodel rows can't be linked to parent Model rows.
42 Name and foreign key arguments cannot be empty strings The names and foreign keys of submodels must be specified.
43 Foreign key column 'xxxx' does not exist in submodel. The specified foreign key isn't a column in the submodel it was defined for. Make sure the key matches a column in the underlying query.
45 Submodel updates are not allowed when the parent Model update is a PreparedStatement PreparedStatement placeholders don't supply the necessary column names. Only a StatementSet can do this.
47 Model->insert: Invalid value passed for PreparedStatement parameter. An iterable (array or object) was passed in as a value to a PreparedStatement named parameter. If this was intended to be a submodel query, make sure the submodel doesn't have the same name as a named parameter.
48 Model rows cannot be inserted by array access. Use Model->insert() instead. Primary key values in the underlying database may differ from the Model array indices, so Model cannot automatically determine the appropriate value for a given position.
49 Offset out of bounds Attempted to access an array offset that doesn't exist in the Model. (Note: Model array keys are not the same as primary key indices.)
68 Specified pivot-by column 'xxxx' does not exist in dataset. The column on which the Model data is to be pivoted can't be found.
69 Index column 'xxxx' does not exist in dataset. The column which is to be used as the index for the pivot results can't be found.
70 Value column 'xxxx' does not exist in dataset. The column which is expected to contain the data to be pivoted can't be found.
71 Value(s) 'xxxx' specified in pivot columns array do not exist in 'xxxx' column. The specified values can't be found in the pivot-by column. If this is expected due to filtering, this exception can be suppressed by passing true to Model->pivot()'s sixth argument.
72 Join conditions must be specified Model->join() requires valid join conditions for anything other than a cross join.
73 Join column specified does not exist in both Models A string name was provided as a join column and this name did not match an equivalent column name in both Models.
74 Join conditions array must contain exactly three strings If an array is passed for the join conditions argument, it must contain exactly three elements: the left side column name, a supported operator (as a string), and the right side column name.
75 Left side column does not exist in invoking Model The first element of the join conditions array must match the name of a column in the Model on which the join method is invoked.
76 The provided operator is invalid The second element of the join conditions array must be a string containing a supported SQL comparison operator.
77 Right side column does not exist in joining Model The third element of the join conditions array must match the name of a column in the Model to be joined.
78 Identical column names exist in both Models Both models contain one or more columns with identical names that cannot be reconciled. If the columns in question are part of an equijoin, try passing the column name as a single string; otherwise, assign a unique instanceName to at least one of the Models to resolve the ambiguity.
79 Both old and new column names must be specified. A non-empty string must be specified for both arguments.
80 Column 'xxxx' does not exist in Model. The old column name specified is not one of the existing columns in this Model.
81 Column 'xxxx' already exists in Model. The new column name can't be one that already exists in this Model.

Transport\Export

Code Text Explanation
30 Invalid flags set Flags must be a sum of TO_ and AS_ constants (see constants.php)
31 Filename is missing If the TO_FILE flag is used, the file name must be specified.
32 Only one to-browser Export can be called per request. A TO_BROWSER Export() call cannot send more than one response at a time.
33 Array contains elements other than instances of Model If an array is passed to Export, it must only contain Models.
34 XML export requires the xmlwriter extension The XML generated with an AS_XML Export() call is built with the xmlwriter extension.
35 A CSV file can have only one worksheet. You will need to export each Model separately. Multiple worksheets are not supported by the CSV specification.

Exceptions 66 and 67 are unused.