Comments (6)
You mean PDO::FETCH_NUM
?
from aura.sql.
Not sure what you mean here @gholol -- can you expand a bit?
from aura.sql.
Well, sure guys.
Aura.Sql provides fetchAssoc() method.
We can use it like this
$result = $pdo->fetchAssoc($stm, $bind);
Now, this of course retrieves an ASSOCIATIVE array (where the key is the
first column, and the row arrays are keyed on the column names), and so, I cannot use it with list() function, because list() works only with numeric arrays.
I can do a workaround around this, and write something like:
$result = $pdo->fetchAssoc($stm, $bind);
list($value1,
$value2,
$value3
) = array_keys($result);
But isn't it a bit impractical? Do you have any plans of implementing a function that returns a result as numeric array? (PDO:FETCH_NUM
from aura.sql.
This particular case ...
$result = $pdo->fetchAssoc($stm, $bind);
list($value1,
$value2,
$value3
) = array_keys($result);
... might be addressed by:
$values = $pdo->fetchCol($stm, $bind);
That will populate $values
with the first column of all rows in the result set. (Note that fetchAssoc()
uses the first column as the array key.)
Is that sufficient, or is there another case that needs to be addressed?
from aura.sql.
@gholol Any further thoughts?
from aura.sql.
Hi!
Sorry for not responding, i was at work.
Your suggestion to use fetchCol() was right, it works perfectly ;) So i don't have anything else to rant about.
Have a nice day guys!
from aura.sql.
Related Issues (20)
- Bug with pgsql query HOT 5
- DB Reconnection HOT 5
- Auto adding Ticks HOT 8
- Decode json? (to arrays) HOT 1
- Bug in Queryparser for SQLite HOT 3
- Question HOT 1
- Using 2.x and 3.x in parallel HOT 10
- What is the future of this project? HOT 15
- Create GIthub Actions to automatically build and test this package
- PHP 8.1 Compatibility HOT 8
- Type hint incomplete HOT 7
- Scrutinizer Error HOT 1
- Version that doesn't throw deprecation warnings in 8.1 but works in 8.0? HOT 19
- Works with all versions of PHP from 5.6 to 8.1
- Release note HOT 7
- Abandon 4.x ? HOT 2
- Consider tagging / releasing 3.0.1 please ? HOT 2
- How to debug "Column count doesn't match value count"? HOT 1
- Time for 5.0.2/5.1 HOT 4
- Does Aura.Sql suffer of the problem of useless order by on some ORM prefetches ? HOT 2
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 aura.sql.