如何从iphone上的sqlite数据库读取浮点数(REAL)? [英] How do you read floating numbers (REAL) from a sqlite database on the iphone?

查看:434
本文介绍了如何从iphone上的sqlite数据库读取浮点数(REAL)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从sqlite db读取浮点小数点

I need to read floating point decimals from sqlite db

我在数据库中创建了INTEGER的变量类型

I have created Variable type in database as INTEGER

我使用sqlite3_column_int读取NSInteger变量

I am reading with sqlite3_column_int to NSInteger variables

哪些部分应该更改,以便我可以从数据库读取浮点整数

which parts should changed so i can read floating point integers from database

感谢您的回答对这个主题的新手感谢。

thanks for answers sorry im a newbie in this topics

推荐答案

没有浮点整数。它们在基本层面上是相互排斥的(很好的浮点数可以落在整数边界上,但是你得到了这个想法):P

There's no such thing as a floating-point integer. They're mutually exclusive on a fundamental level (well floating point numbers can fall on integer boundaries but you get the idea) :P.

但是,是使用 sqlite3_column_double(sqlite3_stmt *,int)函数。

NSNumber *f = [NSNumber numberWithFloat:(float)sqlite3_column_double(stmt, col)];

这篇关于如何从iphone上的sqlite数据库读取浮点数(REAL)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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