ruby - 创建带索引的数组,并与其他数组进行比较
问题描述
我正在尝试创建一个带有索引的数组来搜索值并与来自以下的另一个数组进行比较pgcon
:
@trunks = []
#trunks local
@trunks_local = []
#dados_local
@bd_local = {}
@c_local = PG.connect(:hostaddr => 'myhost', :port => 5432, :dbname => "testdb", :user => "test", :connect_timeout => 90)
@bd_local = @c_local.exec("SELECT trunk_id, name,phone_number,active FROM callback_trunks")
@bd_local.each.with_index(0) do |h|
@trunks_local << h
end
这是比较:
@trunks.each.with_index(0) do |trunks|
@trunks_local.each.with_index(0) do |trunk_local|
解决方案
推荐阅读
- uisegmentedcontrol - 为什么旋转屏幕(Xcode 11 beta5)时 UISegmentedControl 中选定的段颜色变得清晰?
- azure-sql-database - ADFV2、VNET 和链接服务
- python - 在 Keras 中对 4D 数据执行 Conv2D
- android - 搜索过滤器不在列表视图中显示搜索到的项目
- leaflet - 单击标记后,地图如何以移动标记为中心?
- php - 如何在论坛中增加以下视图
- javascript - 使用 Chrome 扩展(特别是)修改 Twitch 剪辑 DOM
- c++ - 一段时间后 SolvePNP 返回错误的 rvec 和 tvec
- azure - Azure 存储帐户与存储作为 RG 中的资源
- django-models - Django:如何在两个数据库表中搜索,或者两个如何合并两个相关的类