Comments (2)
Hi! Sorry for the delay in rpelying to you. I'll get on this at the weekend
and put the fixes in place. I've really only just begun the iOS side of
things, so it would be great to have someone else test and/or commit. Feel
free to send along some pull requests.
On 21 November 2013 16:50, erisler-myntpartners [email protected]:
Great work building this framework. I think I've found a logic error that
trips an assert.I'm running Xcode5,iOS7SDK, I added your project as a sub-project to mine
and updated your project with the most recent version of the
iOS-Universal-Framework.Everything builds and connects to my remote postgesql (osx Mavericks,
postgres 92 that is part of the system) db just fine. Here is the issue I'm
encountering:When I run a query against a table that contains rows with empty character
varying values (i.e. zero length strings, NOT null values) the
-_tupleForRow:column: method's NSParameterAssert(size) assert trips when I
call the -fetchRowAsArray method. Your code:-(NSObject* )
_tupleForRow:(NSUInteger)r column:(NSUInteger)c { // check for null
if(PQgetisnull(_result,(int)r,(int)c)) {
return [NSNull null];
}
// get bytes, length
const void* bytes = PQgetvalue(
result,(int)r,(int)c); NSUInteger size = PQgetlength(
result,(int)r,(int)c);
NSParameterAssert(bytes);
NSParameterAssert(size);switch(_format) {
case PGClientTupleFormatText:
return pgdata_text2obj(PQftype(_result,(int)c),bytes,size,_encoding);
case PGClientTupleFormatBinary:
return pgdata_bin2obj(PQftype(_result,(int)c),bytes,size,_encoding);
default:
return nil;
}}
The if(PQgetisnull(_result,(int)r,(int)c)) returns false on empty string
and zeros according to the libpq library documentation but the PQgetlength
will return the string length for text values and the byte length for
binary values. So, on empty string fields this returns 0 and trips your
assert.My fix was to comment out the NSParameterAssert(size); assert. And in the
pgdata_bin2obj and pgdata_text2obj functions I changed the assert from
assert(oid && bytes && size); to assert(oid && bytes);Can you kindly check if all this makes sense?
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/6
.
from postgresql-kit.
Pull request created.
from postgresql-kit.
Related Issues (15)
- PGClientKit implementation on iOS HOT 9
- Library not found issue HOT 6
- stdlib.h: file not found HOT 1
- Mavericks XCode 6 iOS 8.1 compiling postgresql-kit HOT 6
- Provide "Missing SDK" message when the deployment SDK version isn't installed locally HOT 1
- does not compile on 10.10 with Xcode 6.2 HOT 3
- build-frameworks.sh not working on 10.11
- ** BUILD FAILED ** HOT 1
- Test issue
- e sqlite file programmatically ios
- PGServer Starting HOT 1
- PGClientKit.framework/Headers/PGClientKit.h:33:9: 'PGResult+TextTable.h' file not found HOT 3
- Missing libqp-events symbols in final framework build
- compiled Project HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from postgresql-kit.