从查询中返回bool [英] Return bool from query

查看:83
本文介绍了从查询中返回bool的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我有一个mySQL系统,其中包含新闻发布部分:

管理员可以创建包含文本的新项目,并且他们可以选择

创建''fulltexts'',所以你会得到阅读更多......在首页上,

点击它并阅读全文。


mySQL(查询)是否有可能检查''全文'是否是'

是否为空,只返回true或false,所以我不必将

全文放入mysql_fetch_array()来决定是否为

显示''read_more'',或者我应该在DB中创建一个额外的布尔字段

说全文y / n?


Greetings Frizzle。

解决方案

frizzle写道:

你好,
管理员可以创建包含文本的新项目,并且他们可以选择创建''全文'',所以你'' d得到阅读更多......在首页上,点击它并阅读全文。

mySQL(查询)是否有可能检查''fulltext''是否为空,并且只返回true或false,所以我不必将
全部全文放入mysql_fetch_array()以决定是否显示''read_more'',或者我应该创建一个DB中的额外布尔字段
说全文y / n?

问候Frizzle。




把它放在一个单独的表中只是文章的ID和文字。如果

id存在于第二个表中,则会有更多文本。


-

====== ============

删除x来自我的电子邮件地址

Jerry Stuckle

JDS计算机培训公司
js ******* @ attglobal.net

==================




Jerry Stuckle写道:

frizzle写道:

你好,
我有一个带有新闻发布部分的mySQL系统:
管理员可以在其中创建包含文本的新项目,并且他们可以选择创建''全文'',所以你会得到阅读更多......在首页上,点击它并阅读全文。

mySQL(查询)是否有可能检查''fulltext''是否为空,并且只返回true或false,所以我不必将
全部全文放入mysql_fetch_array()以决定是否显示''read_more'',或者我应该创建一个DB中的额外布尔字段
说全文y / n?

问候Frizzle。



把它放在一个单独的表中,只有文章'的身份和文字。如果第二个表中存在id,则会有更多文本。

-
==================
删除x来自我的电子邮件地址
Jerry Stuckle
JDS计算机培训公司
js ***** **@attglobal.net
==================




这会让我查一下额外的桌子。那会不会更快地添加额外的布尔字段?


Frizzle。

< br>

frizzle写道:

Jerry Stuckle写道:

frizzle写道:

你好,

我有一个带有新闻发布部分的mySQL系统:
管理员可以创建包含文本的新项目,并且他们可以选择创建''全文'',所以你会得到阅读更多......在首页上,点击它并阅读全文。

mySQL(查询)是否有可能检查''fulltext''是否为空,并且只返回true或false,所以我不必将
全部全文放入mysql_fetch_array()以决定是否显示''read_more'',或者我应该创建一个DB中的额外布尔字段
说全文y / n?

问候Frizzle。



把它放在一个单独的表中,只有文章'的身份和文字。如果第二个表中存在id,则会有更多文本。

-
==================
删除x来自我的电子邮件地址
Jerry Stuckle
JDS计算机培训公司
js*******@attglobal.net
=========== =======



这会让我对额外的表格进行查询。那么加入一个额外的布尔字段会不会更快?

Frizzle。




为什么?加入很快。可能比在第一张表中处理空文本字段不必要地快得多。


-

===== =============

删除x来自我的电子邮件地址

Jerry Stuckle

JDS计算机培训公司
js ******* @ attglobal.net

==================


Hi there,

I have a mySQL system with a news publishing part in it:
Admins can create new items with text in it, and they have an option to
create ''fulltexts'', so you''d get "read more ..." on the front page,
click it and read the fulltext.

Is there a possibility for mySQL (query) to check if ''fulltext'' is
empty or not, and only return true or false, so i don''t have to put the
whole fulltext into the mysql_fetch_array() to decide wether or not to
show ''read_more'', or should i create an extra boolean field in the DB
saying fulltext y/n ?

Greetings Frizzle.

解决方案

frizzle wrote:

Hi there,

I have a mySQL system with a news publishing part in it:
Admins can create new items with text in it, and they have an option to
create ''fulltexts'', so you''d get "read more ..." on the front page,
click it and read the fulltext.

Is there a possibility for mySQL (query) to check if ''fulltext'' is
empty or not, and only return true or false, so i don''t have to put the
whole fulltext into the mysql_fetch_array() to decide wether or not to
show ''read_more'', or should i create an extra boolean field in the DB
saying fulltext y/n ?

Greetings Frizzle.



Put it in a separate table with just the article''s id and the text. If
the id exists in the second table, there is more text.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================



Jerry Stuckle wrote:

frizzle wrote:

Hi there,

I have a mySQL system with a news publishing part in it:
Admins can create new items with text in it, and they have an option to
create ''fulltexts'', so you''d get "read more ..." on the front page,
click it and read the fulltext.

Is there a possibility for mySQL (query) to check if ''fulltext'' is
empty or not, and only return true or false, so i don''t have to put the
whole fulltext into the mysql_fetch_array() to decide wether or not to
show ''read_more'', or should i create an extra boolean field in the DB
saying fulltext y/n ?

Greetings Frizzle.



Put it in a separate table with just the article''s id and the text. If
the id exists in the second table, there is more text.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================



This would have me quering against an extra table. Would''nt it be
quicker to add an extra boolean field then?

Frizzle.


frizzle wrote:

Jerry Stuckle wrote:

frizzle wrote:

Hi there,

I have a mySQL system with a news publishing part in it:
Admins can create new items with text in it, and they have an option to
create ''fulltexts'', so you''d get "read more ..." on the front page,
click it and read the fulltext.

Is there a possibility for mySQL (query) to check if ''fulltext'' is
empty or not, and only return true or false, so i don''t have to put the
whole fulltext into the mysql_fetch_array() to decide wether or not to
show ''read_more'', or should i create an extra boolean field in the DB
saying fulltext y/n ?

Greetings Frizzle.



Put it in a separate table with just the article''s id and the text. If
the id exists in the second table, there is more text.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


This would have me quering against an extra table. Would''nt it be
quicker to add an extra boolean field then?

Frizzle.



Why? Joins are quick. Probably a lot faster than unnecessarily
processing empty text fields in the first table.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


这篇关于从查询中返回bool的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆