小编Arn*_* C.的帖子

触发计数行给出ORA-04091:表是变异的,触发器/函数可能看不到它

更新我的表时出现此错误

 UPDATE "Username"."EMPPROJECT" 
 SET ENDDATE = TO_DATE('2016-09-11 00:00:00', 'YYYY-MM-DD HH24:MI:SS') 
 WHERE ROWID = 'AAF+8XAAEAAGBIGAAB'
   AND ORA_ROWSCN = '537035617'
Run Code Online (Sandbox Code Playgroud)

保存对表"Username"的更改时出错."EMPPROJECT":第8行:
ORA-04091:表Username.EMPPROJECT正在变异,触发器/函数可能看不到它ORA-06512:在"Username.CHECKOVERLAPDATEUPDATE",第4行
ORA-04088 :执行触发器'Username.CHECKOVERLAPDATEUPDATE'时出错

触发器的定义如下:

create or replace trigger checkOverlapDateUpdate 
before Update on EmpProject
for each row
declare
    countOfOverlap integer;
begin
    select count(*) 
    into countOfOverlap 
    from EmpProject EP 
    where isOverlapping(:new.startDate, :new.endDate, startDate, endDate) = 1 
      and EP.EmpID = :new.EmpId;

    if countOfOverlap > 0 
    then
        RAISE_APPLICATION_ERROR(-00000, 'Overlapping Insertion Dates');
        rollback;
    end if;
end;
Run Code Online (Sandbox Code Playgroud)

sql oracle plsql database-trigger sql-update

1
推荐指数
1
解决办法
180
查看次数

组合接口而不定义新接口

在 go 中,您可以将内联接口与函数签名结合起来吗?或者这是不可能的,唯一的选择是创建结合较小接口的第三个接口?

// _Interfaces_ are named collections of method
// signatures.

package main

import (
    "fmt"
    "math"
)

// Here's a basic interface for geometric shapes.
type geometry interface {
    area() float64
    perim() float64
}

type appearance interface {
    color() string
    texture() string
}



// For our example we'll implement this interface on
// `rect` and `circle` types.
type rect struct {
    width, height float64
}
type circle struct {
    radius float64
}

// To implement an interface in …
Run Code Online (Sandbox Code Playgroud)

syntax interface go

1
推荐指数
1
解决办法
45
查看次数

Listview自定义布局多项选择

我想创建一个允许多项选择的列表视图.典型的解决方案是获取游标并使用SimpleCursorAdapter.

        SimpleCursorAdapter adapter2 = new SimpleCursorAdapter(this,
                    R.layout.simple_list_item_multiple_choice, cur2, cols2, views2);
Run Code Online (Sandbox Code Playgroud)

使用时,我能够正常工作R.layout.simple_list_item_multiple_choice.当选择多个项目时,我会使复选标记生效.

所以我决定尝试使用自定义布局.这是我的布局的XML代码.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >


    <TextView
        android:id="@+id/name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"

        android:textAppearance="?android:attr/textAppearanceLarge" />


    <TextView
        android:id="@+id/lookup"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"

        android:textAppearance="?android:attr/textAppearanceSmall" />


    <TextView
        android:id="@+id/hasphone"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"

        android:textAppearance="?android:attr/textAppearanceSmall" />

    <CheckedTextView
        android:id="@+id/checkedTextView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"

        android:checkMark="?android:attr/listChoiceIndicatorMultiple"/>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

所以这是我的问题.使用相同的代码并在我的listview上将ChoiceMode设置为多个,可以很好地扩展布局.光标中的数据填充正确.

但是,我遇到的问题是,当我点击该项目时,复选标记不会显示为选中(框中的复选框).是否有一些我不想要的东西,不涉及创建自定义适配器?


l2.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
Run Code Online (Sandbox Code Playgroud)

l2是我的列表视图.

xml android listview simplecursoradapter

0
推荐指数
1
解决办法
6072
查看次数

反射获取字段标签

在 go 中有一种使用反射来获取字段标签的好方法,只需将字段包装在反射库中的函数中即可。

我基本上是在尝试创建一个瘦数据访问对象,它允许在数据库中获取列名,而无需到处进行硬编码。

下面是带有 db 列名称作为标签的结构。

    // Table Structures
type CusipTableRow struct {
    Id          int64  `db:"id"`
    Cusip       string `db:"cusip"`
    Symbol      string `db:"symbol"`
    Active      int8   `db:"active"`
    Added_Time  int32  `db:"added_timestamp"`
    Description string `db:"description"`
    Exchange    string `db:"exchange"`
    AssetType   string `db:"asset_type"`
}
Run Code Online (Sandbox Code Playgroud)

除了下载另一个关于如何使用反射本质上调用这样的库以返回带有标签值的字符串之外的任何建议。

var row CusipTableRow
row.GetColumnName(row.Id) //Return column name based on tag.
Run Code Online (Sandbox Code Playgroud)

我正在考虑可能尝试使用 map[address] fieldTag,但由于没有完全掌握 unsafe 包而没有运气让它起作用。如果这种方法行得通,我想这样的电话可能会奏效:

row.GetColumnName(&row.Id) //Return column name based on tag.
Run Code Online (Sandbox Code Playgroud)

任何想法和建议都会很棒。

谢谢

reflection go

-1
推荐指数
1
解决办法
47
查看次数