`
Hooopo
  • 浏览: 335265 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Showing SQL statements in the Rails console

阅读更多
1.windows下创建_irbrc文件,并设置环境变量
2.在_irbrc文件里加入:
if ENV['RAILS_ENV']
  # Called after the irb session is initialized and Rails has been loaded
  IRB.conf[:IRB_RC] = Proc.new do
    logger = Logger.new(STDOUT)
    ActiveRecord::Base.logger = logger
    ActiveResource::Base.logger = logger
  end
end

3.
>> User.last
  User Load (0.0ms)   SELECT * FROM `users` ORDER BY users.id DESC LIMIT 1
=> #<User id: created_at: "2009-10-22 08:42:16", updated_at: "2009-10-22 08:42:16">
>>
分享到:
评论

相关推荐

    HANA SQLStatements ALL

    标题 "HANA SQLStatements ALL" 指的是 SAP HANA 数据库系统中的 SQL 语句大全,这通常涵盖了用于各种报告的 SQL 查询和操作。在 SAP HANA 中,SQL(结构化查询语言)是用于管理和处理数据库的标准语言,它允许用户...

    SQLStatements.zip

    标题“SQLStatements.zip”暗示了这个压缩包包含与SQL语句相关的资料,特别是针对SAP HANA数据库管理系统。描述提到“HANA script for Admin”,这表明这些内容是为HANA数据库管理员准备的,可能涉及管理和优化...

    8.2 Optimizing SQL Statements

    在数据库应用开发中,SQL语句是核心执行逻辑的实现方式,无论是通过解释器直接执行还是通过API在后台提交。为了提高应用性能,尤其是MySQL数据库应用,优化SQL语句显得至关重要。本部分将深入探讨如何优化各种SQL...

    ElasticSearch SQL 教程

    If you (or others you know) are versed in SQL statements and newer to the Elasticsearch query syntax but want to benefit from the power Elasticsearch, this is the talk for you. After making its debut ...

    IntroSQL_V4_All_SQL_Statements

    从给定的文件信息中,我们可以提取到一系列与MySQL数据库管理相关的知识点,这些知识点主要集中在数据库的创建、用户管理、权限授予以及数据表的构建上。以下是对这些知识点的详细阐述: ### 数据库用户管理 ...

    SQL-statements-Collection.rar_Grant_sql statements

    下列语句部分是MsSql语句,不可以在access...SQL分类: DDL—数据定义语言(CREATE,ALTER,DROP,DECLARE) DML—数据操纵语言(SELECT,DELETE,UPDATE,INSERT) DCL—数据控制语言(GRANT,REVOKE,COMMIT,ROLLBACK)

    Microsoft SQL Server 2012 tutorials - writing transact-sql statements

    The information contained in this book is provided without any express, statutory, or implied warranties. Neither the authors, Microsoft Corporation, nor its resellers, or distributors will be held ...

    oracle advanced sql 高级SQL教程 ORACLE官方教材

    Using a Subquery in the FROM Clause 4-10 Scalar Subquery Expressions 4-11 Scalar Subqueries: Examples 4-12 Correlated Subqueries 4-14 Using Correlated Subqueries 4-16 Using the EXISTS Operator 4-18 ...

    Pro Oracle SQL

    Pro Oracle SQL unlocks the power of SQL in the Oracle Database—one of the most potent SQL implementations on the market today. To master it requires a three-pronged approach: learn the language ...

    SQL The Ultimate Beginner's Guide to Learn SQL Programming

    The SQL (the Structured Query Language , Structured Query Language ) is a special language used to define data, provide access to data and their processing. The SQL language refers to nonprocedural ...

    Learning SQL.rar_Sql queries_learning sql_objects

    2.SQL Data Statements--those used to create, manipulate, and retrieve data stored in your database example statements include select, update, insert, and delete 3.SQL Schema Statements--those used to ...

    SQL代码美化程序

    ** Formats SQL on-the-fly in popular tools and editors using hotkey functionality. ** Minimizes to the system tray for quick access. ** Includes a command line for batch conversion of single files, ...

    Access text files using SQL statements by DB Query Analyzer

    DB Query Analyzer是一款由马根峰开发的数据库查询分析工具,专为实现通过SQL语句访问文本文件的梦想而设计。这款工具具有强大的功能,能够高效地处理大量数据,比如在大约59秒内处理包含2,500,000条记录的文件。其...

    SQL Server 2014 Development Essentials - Masood-Al-Farooq, Basit A. [SRG].pdf

    Chapter 2, Understanding DDL and DCL Statements in SQL Server, introduces the reader to the SQL Server 2014 Transact-SQL language elements and SQL Server 2014 Management Studio (SSMS 2014). This ...

    SQL Statement

    SQL 语句基础知识点 SQL 语句是结构化查询语言(Structured Query Language)的缩写,用于管理关系数据库管理系统(RDBMS)。SQL 语句可以创建、修改、查询和删除数据库中的数据。 一、基础语句 1. SELECT 语句:...

    Sybex - Mastering Visual Basic .NET Transact SQL (VBL).pdf

    This statement looks and feels very much like the straight SQL statements, yet it’s not part of standard SQL. Then we’ll look at T-SQL in depth. If you need to look up a function or how to declare a...

    Powerbuilder_Sql Extract

    This does not allow various SQL database analysis products access to the various DW SQL statements for processing. It is the design of this utility to provide a bridge between the PowerBuilder ...

    Oracle Database 12c PL-SQL programming

    Filled with detailed examples and expert strategies from an Oracle ACE, Oracle Database 12c PL/SQL Programming explains how to retrieve and process data, write PL/SQL statements, execute effective ...

Global site tag (gtag.js) - Google Analytics