views

What are views good for?

﹥>﹥吖頭↗ 提交于 2019-12-17 07:04:18
问题 I'm just trying to get a general idea of what views are used for in RDBMSes. That is to say, I know what a view is and how to make one. I also know what I've used them for in the past. But I want to make sure I have a thorough understanding of what a view is useful for and what a view shouldn't be useful for. More specifically: What is a view useful for? Are there any situations in which it is tempting to use a view when you shouldn't use one? Why would you use a view in lieu of something

MySql views performance [closed]

那年仲夏 提交于 2019-12-17 07:02:48
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . If you are going down the road of using views, how can you ensure good performance? Or is it better not to use views in the first place and just incorporate the equivalent into your select statements? 回答1: It Depends. It totally depends on what you are viewing through view. But

View's SELECT contains a subquery in the FROM clause

隐身守侯 提交于 2019-12-17 06:06:50
问题 I have two tables and I need to create a view. The tables are: credit_orders(id, client_id, number_of_credits, payment_status) credit_usage(id, client_id, credits_used, date) I use the following query to do this. The query without the "create view" part works well but with "create view", it shows the error "View's SELECT contains a subquery in the FROM clause". What could be the issue & possible solution: create view view_credit_status as (select credit_orders.client_id, sum(credit_orders

Problem Using Partial View In for each loop

时光怂恿深爱的人放手 提交于 2019-12-14 03:58:13
问题 I'm a little confused here, I am trying use a partial view in a for each loop like so <% foreach (var item in (IEnumerable<MVCLD.Models.Article>)ViewData["LatestWebsites"]){%> <% Html.RenderPartial("articlelisttemaple", item); %> <% } %> And my partial view looks like this <div class="listingholders"> <h4><%=Html.ActionLink(item.ArticleTitle, "details", "article", new { UrlID = item.UrlID, ArticleName = item.ArticleTitle.ToString().niceurl() }, null)%> </h4> <p><%= Html.Encode(item

Rounded buttons

一世执手 提交于 2019-12-14 03:45:16
问题 I want to have something like this five buttons, one button surrounded by four other buttons. Just like this: I know that with Android that we can only have square type views so how would it be possible to do this? OpenGl or something? Anyone have any links to something related? Basically I want curved buttons that are close together. 回答1: My guess is that at the end of the day it will be easier to do this in a custom view. But if you want to use stock views, I'd suggest the following. First,

ListView items won't show focus when touched

天大地大妈咪最大 提交于 2019-12-14 03:44:30
问题 I've got a ListView that works just great, except for this minor annoyance. I can use the trackball/dpad to move up and down my list, and the background changes according to which row has focus. But when I touch the row (click or long click), there's no background change letting me know what's been focused. I've tried setting 'focusable' and 'focusable in touch mode' to true on the rows, but it still doesn't work. Just in case it matters somehow: I am setting onClickListeners for each row.

codeigniter: loading multiple views

丶灬走出姿态 提交于 2019-12-14 03:09:27
问题 i want to assign a variable $layout_data['navigation']=$this->load('layout/navigation') navigation is just a list. when i pass this variable to my layout the list comes at the top. here are my codes: htaccess RewriteEngine On RewriteBase /ci/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /ci/index.php/$1 [L] controller home <?php class Home extends CI_Controller{ function index() { $layout_data['navigation']=$this->load->view('navigation'); $this-

Changing the type of a column used in other views

别说谁变了你拦得住时间么 提交于 2019-12-14 00:23:13
问题 create table base (name character varying(255)); create view v1 as select *, now() from base; create view v2 as select * from v1 where name = 'joe'; alter table base alter column name type text; Gives this error: cannot alter type of a column used by a view or rule DETAIL: rule _RETURN on view v1 depends on column "name" This is sort of annoying, because now I have to recreate all the views that reference the base.name column. It's especially annoying when I have views that reference other

How to make a TextView editable at the click of a button?

亡梦爱人 提交于 2019-12-13 22:34:13
问题 I have an app that displays certain content from a database and lets users edit it. I have an activity that displays those details in some textviews. Now, there is an "EDIT" button at the bottom of the screen. When this button is clicked, I want to make the textview's editable (which are initially read-only) so that the database can be updated. Also, I want the "EDIT" button to turn into a "SAVE" button. I understand I can just use another activity for this, but is there any way to do this

Mysql - “EXPLAIN SELECT” from a VIEW is looking in all rows of the main table

梦想与她 提交于 2019-12-13 19:17:22
问题 I have 2 tables: t_cities ( idCity , idCountry , name , population ) t_countries ( idCountry , name ) t_cities has 50000 rows so I create a VIEW with the cities from UK (only 1100): CREATE VIEW v_city_uk AS SELECT * FROM t_cities WHERE idCountry = 140 Everything is fine so far, I get a VIEW with 1100 rows. The query SELECT COUNT(*) FROM v_city_uk returns 1100, but the EXPLAIN: EXPLAIN SELECT COUNT(*) FROM v_city_uk says that it is checking the 50000 rows to execute this query. Why? Is there