Method: Mysql::Stmt#execute
- Defined in:
- lib/vendor/mysql.rb
#execute(*values) ⇒ Mysql::Stmt
Execute prepared statement.
855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 |
# File 'lib/vendor/mysql.rb', line 855 def execute(*values) raise ClientError, "not prepared" unless @param_count raise ClientError, "parameter count mismatch" if values.length != @param_count values = values.map{|v| @charset.convert v} begin @sqlstate = "00000" nfields = @protocol.stmt_execute_command @statement_id, values if nfields @fields = @protocol.retr_fields nfields @result = StatementResult.new @fields, @protocol, @charset else @affected_rows, @insert_id, @server_status, @warning_count, @info = @protocol.affected_rows, @protocol.insert_id, @protocol.server_status, @protocol.warning_count, @protocol. end return self rescue ServerError => e @last_error = e @sqlstate = e.sqlstate raise end end |